[elbe-devel] [PATCH 4/4] elbeproject: Pass other components for src cdrom

Olivier Dion dion at linutronix.de
Mon Mar 23 19:53:56 CET 2020


For every components, if its path exists, ensures that
/etc/apt/sources.list is created.  Then iterates over the list of
installed packages and recorded it in tuple.  This informations is
then passed down to mk_source_cdrom to download include the source in
the desired components.

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

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index b64a5fcb..2ec7f3ed 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -472,7 +472,31 @@ class ElbeProject (object):
                 if not cdrom_size and self.xml.has("src-cdrom/size"):
                     cdrom_size = size_to_int(self.xml.text("src-cdrom/size"))
 
-                validation.info("Source CD %s", sysrootstr)
+                validation.info("Source CD\n%s", sysrootstr)
+
+                others = {}
+
+                sysroot_host_path = os.path.join(self.sdkpath, "sysroots", "host")
+
+                components = [(self.targetpath, "target"),
+                              (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))
+
                 try:
                     self.repo_images += mk_source_cdrom(env.rfs,
                                                         self.arch,
@@ -480,7 +504,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))
-- 
2.25.1




More information about the elbe-devel mailing list