From: Adriaan Schmidt <adriaan.schmidt@siemens.com>
To: isar-users@googlegroups.com
Cc: Adriaan Schmidt <adriaan.schmidt@siemens.com>
Subject: [PATCH] add support for rebuilding essential packages
Date: Mon, 20 Feb 2023 11:32:14 +0100 [thread overview]
Message-ID: <20230220103214.2704911-1-adriaan.schmidt@siemens.com> (raw)
There are cases when we need to rebuild a package that is installed during
bootstrap (we call those "essential package" here). This patch introduces
`ISAR_REBUILD_ESSENTIAL_PKGS` which can be set in (distro/layer) config, and
lists all essential packages.
During build, Isar ensures that essential packages are built before any others,
so that their locally built versions are available in isar-apt, and will
be used in any subsequent package builds.
Signed-off-by: Adriaan Schmidt <adriaan.schmidt@siemens.com>
---
This has interdependencies with the proposed multiarch feature,
and builds on v2 of that series.
Adriaan
---
meta/classes/dpkg-base.bbclass | 1 +
meta/classes/essential.bbclass | 39 ++++++++++++++++++++++++++++++++++
meta/classes/image.bbclass | 1 +
3 files changed, 41 insertions(+)
create mode 100644 meta/classes/essential.bbclass
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 55cc6655..ce301346 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -10,6 +10,7 @@ inherit debianize
inherit terminal
inherit repository
inherit deb-dl-dir
+inherit essential
DEPENDS ?= ""
RPROVIDES ?= "${PROVIDES}"
diff --git a/meta/classes/essential.bbclass b/meta/classes/essential.bbclass
new file mode 100644
index 00000000..cb444674
--- /dev/null
+++ b/meta/classes/essential.bbclass
@@ -0,0 +1,39 @@
+# This software is a part of ISAR.
+# Copyright (C) 2023 Siemens AG
+
+ISAR_REBUILD_ESSENTIAL_PKGS ?= ""
+
+python() {
+ isar_rebuild_essential_pkgs = (d.getVar('ISAR_REBUILD_ESSENTIAL_PKGS', True) or '').split()
+ build_compat = d.getVar('ISAR_ENABLE_COMPAT_ARCH', True) == "1"
+ build_native = not d.getVar('DISTRO_ARCH', True) == d.getVar('HOST_ARCH')
+
+ # construct list of essential packages that should be rebuilt:
+ # if we can't build compat, don't include any -compat packages
+ # if we don't need native (because DISTRO_ARCH == HOST_ARCH), don't build native
+ # otherwise, automatically include compat/native when we can build them
+ essential_packages = []
+ for p in isar_rebuild_essential_pkgs:
+ if p.endswith('-compat') and build_compat:
+ essential_packages.append(p)
+ elif p.endswith('-native') and build_native:
+ essential_packages.append(p)
+ else:
+ essential_packages.append(p)
+ if build_compat:
+ essential_packages.append(f'{p}-compat')
+ if build_native:
+ essential_packages.append(f'{p}-native')
+
+ # bail out if this recipe is in the essential list
+ if d.getVar('PN') in essential_packages:
+ return
+
+ # add dependencies to all packages from the essential list
+ for p in essential_packages:
+ if d.getVar('do_prepare_build'):
+ d.appendVarFlag('do_prepare_build', 'depends', f' {p}:do_deploy_deb')
+ if d.getVar('do_install_rootfs'):
+ d.appendVarFlag('do_install_rootfs', 'depends', f' {p}:do_deploy_deb')
+}
+
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index ce7c549c..550785ea 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -80,6 +80,7 @@ image_do_mounts() {
}
inherit multiarch
+inherit essential
ROOTFSDIR = "${IMAGE_ROOTFS}"
ROOTFS_FEATURES += "clean-package-cache clean-pycache generate-manifest export-dpkg-status clean-log-files clean-debconf-cache"
--
2.30.2
next reply other threads:[~2023-02-20 10:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-20 10:32 Adriaan Schmidt [this message]
2023-02-20 11:24 ` Jan Kiszka
2023-02-28 7:06 ` Cedric Hombourger
2023-02-28 7:19 ` Jan Kiszka
2023-03-06 6:06 ` Uladzimir Bely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230220103214.2704911-1-adriaan.schmidt@siemens.com \
--to=adriaan.schmidt@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox