From d50f56f93d108f57250cc1a543c3b96bf74e7ddb Mon Sep 17 00:00:00 2001 From: Thomas Bonnefille Date: Mon, 5 Jan 2026 16:10:16 +0100 Subject: [PATCH 1/2] Revert "dbsfed.xsd: remove artifacts from old documentation" This reverts commit 98a0c58ff774d88ef2dfb868a4fba38123ae6c92. --- elbepack/schema/dbsfed.xsd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elbepack/schema/dbsfed.xsd b/elbepack/schema/dbsfed.xsd index 7809eb5c2..d815c0d3d 100644 --- a/elbepack/schema/dbsfed.xsd +++ b/elbepack/schema/dbsfed.xsd @@ -1133,7 +1133,7 @@ SPDX-FileCopyrightText: Linutronix GmbH - avoid installation of packages into sysroot + avoid installation of packages into sysroot or target From da20aba172d10a6a1b43838d6ef9987b485ca70d Mon Sep 17 00:00:00 2001 From: Thomas Bonnefille Date: Fri, 12 Dec 2025 11:58:53 +0100 Subject: [PATCH 2/2] elbepack: aptpkgutils: implement recursive package blacklisting in diet builds Implements package blacklisting for diet builds, this allows the user to create a list of packages to exclude from the target. This will recursively avoid installing a package and all its dependencies on the target even if this package comes as a dependency of another package. This must be carefully used as it can create packages with lacking dependencies. Signed-off-by: Thomas Bonnefille --- elbepack/aptpkgutils.py | 8 ++++++-- elbepack/efilesystem.py | 12 +++++++++++- elbepack/rpcaptcache.py | 4 ++-- elbepack/schema/dbsfed.xsd | 7 +++++++ 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py index 3bcfb795e..d25fb5d7b 100644 --- a/elbepack/aptpkgutils.py +++ b/elbepack/aptpkgutils.py @@ -67,17 +67,21 @@ def getdeps(pkg): yield d.name -def getalldeps(c, pkgname): - retval = [] +def getalldeps(c, pkgname, blacklist=()): + retval = [pkgname] togo = [pkgname] while togo: pp = togo.pop() + if pp in blacklist: + continue pkg = c[pp] for p in getdeps(pkg.candidate): if p in retval: continue + if p in blacklist: + continue if p not in c: continue retval.append(p) diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py index ec5eb6a9f..491f63be0 100644 --- a/elbepack/efilesystem.py +++ b/elbepack/efilesystem.py @@ -112,13 +112,20 @@ def extract_target(src, xml, dst, cache): arch = xml.text('project/buildimage/arch', key='arch') if xml.tgt.has('diet'): + if xml.has('target/pkg-blacklist/'): + blacklist = [p.et.text for p in xml.node('target/pkg-blacklist/target')] withdeps = [] for p in pkglist: - deps = cache.get_dependencies(p) + if p in blacklist: + continue + deps = cache.get_dependencies(p, blacklist) withdeps += [d.name for d in deps] withdeps += [p] pkglist = list(set(withdeps)) + elif xml.has('target/pkg-blacklist/'): + logging.error( + 'Impossible to blacklist packages outside of diet mode') file_list = [] for line in pkglist: @@ -133,6 +140,9 @@ def extract_target(src, xml, dst, cache): copy_filelist(src, file_list, dst) else: # first copy most diretories + if xml.has('target/pkg-blacklist/'): + logging.error( + 'Impossible to blacklist packages outside of diet mode') for f in src.listdir(): subprocess.call(['cp', '-a', '--reflink=auto', f, dst.fname('')]) diff --git a/elbepack/rpcaptcache.py b/elbepack/rpcaptcache.py index bc6623636..ad376a75c 100644 --- a/elbepack/rpcaptcache.py +++ b/elbepack/rpcaptcache.py @@ -224,8 +224,8 @@ def commit(self): ElbeInstallProgress(fileno=sys.stdout.fileno())) self.cache.open(progress=ElbeOpProgress()) - def get_dependencies(self, pkgname): - deps = getalldeps(self.cache, pkgname) + def get_dependencies(self, pkgname, blacklist): + deps = getalldeps(self.cache, pkgname, blacklist) return [APTPackage(self.cache[p]) for p in deps] def get_installed_pkgs(self, section='all'): diff --git a/elbepack/schema/dbsfed.xsd b/elbepack/schema/dbsfed.xsd index d815c0d3d..04b81999f 100644 --- a/elbepack/schema/dbsfed.xsd +++ b/elbepack/schema/dbsfed.xsd @@ -3094,6 +3094,13 @@ SPDX-FileCopyrightText: Linutronix GmbH + + + + avoid installing the specified packages into the target (only works in diet mode) + + +