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

Torben Hohn torben.hohn at linutronix.de
Fri May 8 11:56:38 CEST 2020


On Mon, May 04, 2020 at 01:42:03PM -0400, Olivier Dion wrote:
> 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()

hmm... i dont think, that you need to call update()
you are only interested in the installed_packages. can you try without
that ?

> +
> +                        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))

Hmm... it strikes me, that you download the package sources with the
normal chroot Buildenv. Please verify, if the host-sysroot has similar
package sources. IIRC, the host sysroot might be a different codename.

I think, you should actually download the sources at this stage.
And really use the tmp_env aptcache.


> +
> +
>                  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)

now you have others here. 
I dont really see them very different from env.rfs 

Please try to generalize this, so that the others and env.rfs could be
part of the same dict/list

Maybe pass in a list of BuildEnv or something ?

>                  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
> 
> 
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel

-- 
Torben Hohn
Linutronix GmbH | Bahnhofstrasse 3 | D-88690 Uhldingen-Mühlhofen
Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99

Hinweise zum Datenschutz finden Sie hier (Informations on data privacy 
can be found here): https://linutronix.de/kontakt/Datenschutz.php

Linutronix GmbH | Firmensitz (Registered Office): Uhldingen-Mühlhofen | 
Registergericht (Registration Court): Amtsgericht Freiburg i.Br., HRB700 
806 | Geschäftsführer (Managing Directors): Heinz Egger, Thomas Gleixner



More information about the elbe-devel mailing list