[elbe-devel] [PATCH v2 4/4] elbeproject: Pass other components to mk_source_cdrom

Olivier Dion dion at linutronix.de
Mon May 4 19:42:03 CEST 2020


For every components other than main, get the list of installed
packages for it using its build environment.

As a special case, since the target component is a subset of chroot,
we reuse the default build environment.  For this purpose, the list of
packages returned by elbe_report() is used.

Signed-off-by: Olivier Dion <dion at linutronix.de>
---
 elbepack/elbeproject.py | 40 +++++++++++++++++++++++++++++++++++++---
 1 file changed, 37 insertions(+), 3 deletions(-)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 3bf0f178..6f4c4d90 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -441,7 +441,8 @@ class ElbeProject (object):
         self.pdebuild_build(cpuset=-1, profile="")
 
     def build_cdroms(self, build_bin=True,
-                     build_sources=False, cdrom_size=None):
+                     build_sources=False, cdrom_size=None,
+                     tgt_pkg_lst=[]):
         self.repo_images = []
 
         env = None
@@ -479,6 +480,38 @@ class ElbeProject (object):
                     cdrom_size = size_to_int(self.xml.text("src-cdrom/size"))
 
                 validation.info("Source CD %s", sysrootstr)
+
+                others = {}
+
+                sysroot_host_path = os.path.join(self.sdkpath, "sysroots", "host")
+
+                components = [(sysroot_host_path, "sysroot-host")]
+
+                if env.path != self.chrootpath:
+                    components.append((self.chrootpath, "chroot"))
+
+                for path, name in components:
+                    if os.path.exists(path):
+                        validation.info("(including %s packages)", name)
+                        others[name] = []
+                        tmp_env = BuildEnv(self.xml, path)
+                        with tmp_env:
+                            tmp_env.seed_etc()
+                        cache = self.get_rpcaptcache(env=tmp_env)
+                        cache.update()
+
+                        for pkg in cache.get_installed_pkgs():
+                            others[name].append((pkg.name, pkg.installed_version))
+
+                # Target is a special case since we can not assume
+                # that dpkg or apt are installed
+                others["target"] = []
+                for pkg_name in tgt_pkg_lst:
+                    cache = self.get_rpcaptcache()
+                    pkg = cache.get_pkg(pkg_name)
+                    others["target"].append((pkg.name, pkg.installed_version))
+
+
                 try:
                     self.repo_images += mk_source_cdrom(env.rfs,
                                                         self.arch,
@@ -486,7 +519,8 @@ class ElbeProject (object):
                                                         init_codename,
                                                         self.builddir,
                                                         cdrom_size=cdrom_size,
-                                                        xml=self.xml)
+                                                        xml=self.xml,
+                                                        others=others)
                 except SystemError as e:
                     # e.g. no deb-src urls specified
                     validation.error(str(e))
@@ -625,7 +659,7 @@ class ElbeProject (object):
 
         self.targetfs.part_target(self.builddir, grub_version, grub_fw_type)
 
-        self.build_cdroms(build_bin, build_sources, cdrom_size)
+        self.build_cdroms(build_bin, build_sources, cdrom_size, tgt_pkg_lst=tgt_pkgs)
 
         if self.postbuild_file:
             logging.info("Postbuild script")
-- 
2.26.2




More information about the elbe-devel mailing list