[elbe-devel] [PATCH] Check for matching version before installing dev packges for sdk

Soest Laurent Laurent.Soest at bernina.com
Wed Nov 27 11:36:08 CET 2019


> > Hello this is my first attempt to post to a mailing list.
> > If I did not follow the correct process  / missed something please tell me.
> 
> For the next version, please do not include this remark. You should send a
> cover letter with such additional information.
> 
> >
> > When building the sdk, "-dev" package versions were more recent than the
> ones we had "pinned" for the image.
> > This patch tries to find the matching version for "-dev" packages installed to
> the sdk.
> >
> > sdk -dev packages should use the same version as installed packages in
> > the rootfs
> > ---
> >  elbepack/rpcaptcache.py | 18 +++++++++++++++++-
> >  1 file changed, 17 insertions(+), 1 deletion(-)
> >
> > diff --git a/elbepack/rpcaptcache.py b/elbepack/rpcaptcache.py index
> > afb29ed6f..eb953e4fc 100644
> > --- a/elbepack/rpcaptcache.py
> > +++ b/elbepack/rpcaptcache.py
> > @@ -145,6 +145,9 @@ class RPCAPTCache(InChRootObject):
> >          src_list = [
> >              p.candidate.source_name for p in self.cache if (
> >                  p.is_installed and p.name not in ignore_pkgs)]
> > +        version_dict = {
> > +            p.name: p.candidate.version for p in self.cache if (
> > +                p.is_installed and p.name not in ignore_pkgs)}
> >          # go through all packages, remember package if its source package
> >          # matches one of the installed packages and the binary package is a
> >          # '-dev' package
> > @@ -154,6 +157,12 @@ class RPCAPTCache(InChRootObject):
> >                      s.name.endswith('-dev')))]
> >          for p in dev_list:
> >              if p.name not in ignore_dev_pkgs:
> > +                srcname = p.name[:-len('-dev')]
> 
> There should be means to get the source name via python-apt from the
> package meta data.
> 

The patch is intentionally not using the python-apt source_name from meta data.
The variable name is probably misleading, I can fix that in the next version.
The variable should hold the name of the package without the "-dev" suffix,
not the actual name of the source.
When there are packages installed related to the same source name but
the source version differs, the keys would not be unique. Whereas the package 
name stripped from "-dev" should be unique.

> > +                if srcname in version_dict:
> > +                    version = version_dict[srcname]
> > +                    candidate = p.versions.get(version)
> > +                    if candidate:
> > +                        p.candidate = candidate
> >                  p.mark_install()
> >          # ensure that the symlinks package will be installed (it's needed for
> >          # fixing links inside the sysroot @@ -168,7 +177,14 @@ class
> > RPCAPTCache(InChRootObject):
> >
> >          for p in dbgsym_list:
> >              if p in self.cache:
> > -                self.cache[p].mark_install()
> > +                pkg = self.cache[p]
> > +                srcname = pkg.name[:-len('-dbgsym')]
> 
> Same here.
> 
> > +                if srcname in version_dict:
> > +                    version = version_dict[srcname]
> > +                    candidate = pkg.versions.get(version)
> > +                    if candidate:
> > +                        pkg.candidate = candidate
> > +                pkg.mark_install()
> >
> >      def cleanup(self, exclude_pkgs):
> >          for p in self.cache:
> >


More information about the elbe-devel mailing list