From patchwork Mon Sep 23 14:27:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "cedric.hombourger@siemens.com" X-Patchwork-Id: 3830 Return-Path: Received: from shymkent.ilbers.de ([unix socket]) by shymkent (Cyrus 2.5.10-Debian-2.5.10-3+deb9u2) with LMTPA; Mon, 23 Sep 2024 16:27:30 +0200 X-Sieve: CMU Sieve 2.4 Received: from mail-qv1-f57.google.com (mail-qv1-f57.google.com [209.85.219.57]) by shymkent.ilbers.de (8.15.2/8.15.2/Debian-8+deb9u1) with ESMTPS id 48NERTaA002982 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 23 Sep 2024 16:27:30 +0200 Received: by mail-qv1-f57.google.com with SMTP id 6a1803df08f44-6c3643faf9dsf78507616d6.1 for ; Mon, 23 Sep 2024 07:27:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1727101644; cv=pass; d=google.com; s=arc-20240605; b=Wl6sOn4KAeaY/LhNm64Klj7AzbzNF6sgLkoI0nINDdc1ZtO6pR6FengAyqDdFKHjCy i+uEp35I2G/YsYeqVru/Aai/dSGLxnAeU5Jra4qvG1HmryaKYhrQnJn5D9TVbudzPmp4 zzClLobrjCMzMTVypasi90H2a2gs47as/qJDOX6jjjkGGgGj/weMepFWqk6myl8Brkqj wc7yv3qgQn8zH8A2dxFjpq+648ocZjnHuuW7SahycANileC8qMp+FEEO0lZ92n84YfCm H31VNSUk7Xa8qcozWELhVNvWbFEQ6thbTpACUcogGSHMjS+06TjJFcZ2EhpDN+Llpcxs a3iw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:feedback-id:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kJ2IHzvLfzZ3itGbeoRveLp4F/se99YDn1BmGacTY7s=; fh=yk0pTOnEGCxBR6pNXGB68ZYI5/Bf+FNP5Oh2Hq7pTeU=; b=Lp5FWe068o+cdK8WMlghYdjVWgY97OEPpYw54PSTWllYh5U8OcBQSmlus1jz8ObER9 A3mbQ6HjKLfNNTPG1S1HSoY78CYHgz+rKHR+cSQXx9CXEWZL/UosOnELPDsMqC7lKpah 19zpH5oS+RKYHYcjAOeoK1IIMOkEd/M/NklWNMgtsWkA2wOzLYHhjbMvxmrFW522q8zb HZ9doGbIZxWAnTct39Rk94zLP/oAhJjYa9KCQawH/L0cpRSJcycv5Al2Pf/hXrxFsxgM XtiMFmVyfrYikGmnwmbpFS7DLkOQMuynrnu+v8cZddw/gXMuQu3ON/gGxm3Ef+GK9JBg Z1xA==; darn=isar-build.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=MRQCc2+n; spf=pass (google.com: domain of fm-1212295-20240923142721cd482e180dd51d059f-ufhpbx@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-1212295-20240923142721cd482e180dd51d059f-UFhPbX@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1727101644; x=1727706444; darn=isar-build.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=kJ2IHzvLfzZ3itGbeoRveLp4F/se99YDn1BmGacTY7s=; b=DVXhOqzykFCzNNiJEByplt3YkLOG6Vou1cGkqdDT5CZ3ZMB/pwGyaVLlziWvkk3nOs C1EsiE9urOZiBsyAdOsctEsxAaTRlXqJBlVtlqKCvBpqCf8QJGPZK/AEBgitLi1Y04El VZmtf1LJhYLxv4nKFhjQhhOfn60qDWkC0y8xz0FcWwOZXiZTSdKDjUalo0v79FrL6vZ9 ebhaJ66PP/jNaaROgkG4dbk+T3vf1hWwNv1UCd6qDpX75hi+u2LbedEUVa1nnWebm91K dCGo535LDPr7hfEl/guPD6QkY6zqc+hPsUsI3HbN2elXgmwyOkCRdeOpUjgf0qevcnec 64Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727101644; x=1727706444; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:feedback-id :mime-version:message-id:date:subject:cc:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=kJ2IHzvLfzZ3itGbeoRveLp4F/se99YDn1BmGacTY7s=; b=XX8GncBOLdNwyZ22TTrxISteh3RSFvId3hKFkT7oJQBUXVJPOnCHGIg2laMKV94f2Y PuwqUERmG1Bo21jizSSXvknmdspe4L5PfPjVHWgb22Sjawy2WFrF0rEvbZT48qpDBPT0 me0duWcvT1QvQhcTO8w0MuqWCVHRMJHWe2zFKO8LHNDcNRWVEssz/2urmopIbZDsQrrb bReRG48bP1/OEe8FYdXLhs6cLrxoyF3xEP0zXgChOhco2QIC63WrNS/UuZydycOtW3IS KWGWnOuKNsgrN8XVfBKf3tC+2TldXgTmFJSLrnzm8PDEPpEMYDDrq57Qk6rY1XkiFPPX JPHQ== X-Forwarded-Encrypted: i=2; AJvYcCU+SzQ49GfmobUmY3+WkQDw5wc/GHHRmuSwCytaKhUNevevEyrj9CezR0jIQI9PWfjvybYAZ3w=@isar-build.org X-Gm-Message-State: AOJu0YxvIT+vW1FT51vON7eOs4ZX7Fa63U8ArKw/ZgoyXcSEmrUdoAaw 6du5M/EamLilGhs0v9Ig2sNqqL3N8Mutd/scfZuCzteIHuFEgBNC X-Google-Smtp-Source: AGHT+IEHQREL1yU+ZeXIKm7JcrOtZodRZv1Pay7oLDNgAoghKe+2nGDVRkMSNZ6CfZXqCCR5KsACFQ== X-Received: by 2002:a05:6214:3990:b0:6c3:5dcf:bf5a with SMTP id 6a1803df08f44-6c7bd5e2475mr182982556d6.37.1727101643593; Mon, 23 Sep 2024 07:27:23 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a05:6214:2302:b0:6b0:7204:3b2 with SMTP id 6a1803df08f44-6c6b482082bls474946d6.2.-pod-prod-09-us; Mon, 23 Sep 2024 07:27:22 -0700 (PDT) X-Received: by 2002:a05:620a:4482:b0:7a1:d73f:53d2 with SMTP id af79cd13be357-7acb8d8ae73mr1919265185a.20.1727101642731; Mon, 23 Sep 2024 07:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1727101642; cv=none; d=google.com; s=arc-20240605; b=gm2CmfMumfJ8yObFYRTotgemj24h19ObJfvjCUQWZ84pwXn7m9Wmwvw4Rc5hwj7ASV E9p6ZD3xnFkYh04WLMsCc6wnE5XCxOpa8HmUHQ1K+4hg14P/fgb2yU7f+xzv4seAme86 OYEB4pbVtrHxCS/mXpQS6EYlYUvrnvZsyhDKqOT4j2DpkMIeCOqbawH4Cdg35g6YA+3v 4NHIfqFrg2SNic3XE8BB3+SGEvNwHpYsqHxscG9OhonFEEg/Ni22+8ch/bP6zlcEmFia ZTPNWl7yjyaP3aTuoz9G5uBCqt3fIVCZlS/pRq9dujVOh7iTOmkh0AiJJJ2vd0DSgPdv lC3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=feedback-id:content-transfer-encoding:mime-version:message-id:date :subject:cc:to:from:dkim-signature; bh=bTSON0SSup0PZayWX7CzAbWyxpgtmmgFMuArDGHA1gw=; fh=1z37pEVhqwMLlkT4FDzOga7XBsM6Rzv6sXOq0pipxqo=; b=ckKmTpCFwowyHjgzkPFyYUfGbJ0nuE5atCPTwNp22sErxaJQlnUZhIEH6SxgT4hXSl DjkHh1n+unt+oFELYw2n/nVact4Z/mQpXeubfZCSq05XV5BhMsRfLxEfGqegEusE6jAl GdBYh7DlnWasLtK2NioK3VExUOedNUoo3hQ7ILAPPhs/PhUm/7V0DkdxIRV+tgdoTqjJ f0SqlipoJXjqhTvwqBLY1GgfJK1Ahm4Po0YgB+MSaNIWwFX5jTyDIS2MRI2NxftkYAzg KnHxr0Srqjn2+zmzvcLnrgsCbqBY3oTzOFkkv2hh8hkBD1XWQUWic+ALb6/ySumzaUTw NW1A==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=MRQCc2+n; spf=pass (google.com: domain of fm-1212295-20240923142721cd482e180dd51d059f-ufhpbx@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-1212295-20240923142721cd482e180dd51d059f-UFhPbX@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net. [185.136.64.228]) by gmr-mx.google.com with ESMTPS id af79cd13be357-7acb08db638si44341285a.5.2024.09.23.07.27.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Sep 2024 07:27:22 -0700 (PDT) Received-SPF: pass (google.com: domain of fm-1212295-20240923142721cd482e180dd51d059f-ufhpbx@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) client-ip=185.136.64.228; Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 20240923142721cd482e180dd51d059f for ; Mon, 23 Sep 2024 16:27:21 +0200 X-Patchwork-Original-From: "'Cedric Hombourger' via isar-users" From: "cedric.hombourger@siemens.com" To: isar-users@googlegroups.com Cc: Cedric Hombourger Subject: [PATCH] image: copy .list files from SRC_URI to the image Date: Mon, 23 Sep 2024 16:27:04 +0200 Message-Id: <20240923142704.389438-1-cedric.hombourger@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1212295:519-21489:flowmailer X-Original-Sender: cedric.hombourger@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@siemens.com header.s=fm2 header.b=MRQCc2+n; spf=pass (google.com: domain of fm-1212295-20240923142721cd482e180dd51d059f-ufhpbx@rts-flowmailer.siemens.com designates 185.136.64.228 as permitted sender) smtp.mailfrom=fm-1212295-20240923142721cd482e180dd51d059f-UFhPbX@rts-flowmailer.siemens.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=siemens.com X-Original-From: Cedric Hombourger Reply-To: Cedric Hombourger Precedence: list Mailing-list: list isar-users@googlegroups.com; contact isar-users+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: isar-users@googlegroups.com X-Google-Group-Id: 914930254986 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Status: No, score=-4.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H2,RCVD_IN_RP_CERTIFIED,RCVD_IN_RP_RNBL,RCVD_IN_RP_SAFE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on shymkent.ilbers.de X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= There are use-cases where the .list files used by Isar / apt during the build would not be the same as the initial .list files presented to the end-user of the image (e.g. build from base-apt or from a local mirror). If any .list files are listed in the SRC_URI of an image recipe, they will be copied to /etc/apt/sources.list.d/ verbatim and in lieu of the bootstrap sources that were used by Isar. Signed-off-by: Cedric Hombourger --- doc/user_manual.md | 14 ++++++++++++++ meta/classes/image.bbclass | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/doc/user_manual.md b/doc/user_manual.md index 847f4b07..89c3a293 100644 --- a/doc/user_manual.md +++ b/doc/user_manual.md @@ -769,6 +769,20 @@ inherit image ``` +If the resulting image should not ship apt sources used during the build but custom ones (e.g. for end-users to point +to an external or simply different server when they "apt-get update", custom list files may be listed in `SRC_URI`: +Isar will copy them to `/etc/apt/sources.list.d/` and omit bootstrap sources. Possible use-cases: + + * image built from base-apt (which is by definition local to the build host) + + * image built from an internal mirror, not reachable by devices running the produced image + + * ship template list files for the end-user to edit (e.g. letting him uncomment `deb` or `deb-src` entries) + +It should be noted that Isar will not validate or even load supplied list files: they are simply copied verbatim to +the root file-system just before creating an image out of it (loading sources from the network would make the build +non-reproducible). + ### Additional Notes The distribution selected via the `DISTRO` variable may need to run a post-configuration script after the root file-system diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index c29d9e26..0c162aa3 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -392,6 +392,18 @@ python do_deploy() { } addtask deploy before do_build after do_image +def apt_list_files(d): + lists = [] + sources = d.getVar("SRC_URI").split() + for s in sources: + _, _, local, _, _, parm = bb.fetch.decodeurl(s) + base, ext = os.path.splitext(os.path.basename(local)) + if ext and ext in (".list"): + lists.append(local) + return lists + +IMAGE_LISTS = "${@ ' '.join(apt_list_files(d)) }" + do_rootfs_finalize() { sudo -s <<'EOSUDO' set -e @@ -429,6 +441,12 @@ do_rootfs_finalize() { mv "${ROOTFSDIR}/etc/apt/sources-list" \ "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" fi + if [ -n "${IMAGE_LISTS}" ]; then + rm -f "${ROOTFSDIR}/etc/apt/sources.list.d/bootstrap.list" + for l in ${IMAGE_LISTS}; do + cp "${WORKDIR}"/${l} "${ROOTFSDIR}/etc/apt/sources.list.d/" + done + fi rm -f "${ROOTFSDIR}/run/blkid/blkid.tab" rm -f "${ROOTFSDIR}/run/blkid/blkid.tab.old"