[elbe-devel] [PATCH 3/5] cdroms: fix difference in pkg lists after bin-cdrom.iso rebuild

Torben Hohn torben.hohn at linutronix.de
Fri Jan 8 14:36:51 CET 2021


On Fri, Jan 08, 2021 at 12:06:30PM +0100, Bastian Germann wrote:
> Am 17.12.20 um 14:32 schrieb Torben Hohn:
> > Rebuild of a bin-cdrom.iso results in different packages in the
> > build output. This triggers an Error in the "Full Packagelist validation".
> > 
> > This happens because some packages on the CDROM do not have the same
> > Priority set as on the debian mirror. Priority on the CDROM is taken
> > from the control file inside the pkg, while the priority on the debian
> > mirror is change via an overrides file for some packages.
> > 
> > debootstrap looks at the Packages file, to decide which pkgs are required.
> > 
> > The fix is to make sure, that the generated CDROM has the exact same
> > Priorities set, as the debian mirror:
> 
> no commas in the previous sentence.
> 
> > 
> > * Extend aptpkgutils.PackageBase with priority fields.
> > * Fill them from both APTPAckage and XMLPackage.
> > * Extend the schema to allow recording the priority for a pkg.
> > * Actually record the new attribute into the DOM, when adding a pkg.
> > * add a "prio=" parameter to repomanager.RepoBase.includedeb() and
> >    set that everywhere.
> 
> I think, the implementation's idea is okay as it is.

what is required to get an r-b ?
I dont really see, what i need to do now :S


> 
> > 
> > Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
> > ---
> >   elbepack/aptpkgutils.py                | 22 ++++++++++++++++------
> >   elbepack/cdroms.py                     |  4 ++--
> >   elbepack/commands/fetch_initvm_pkgs.py |  2 +-
> >   elbepack/elbexml.py                    |  2 ++
> >   elbepack/repomanager.py                | 18 +++++++++++-------
> >   schema/dbsfed.xsd                      |  7 +++++++
> >   6 files changed, 39 insertions(+), 16 deletions(-)
> > 
> > diff --git a/elbepack/aptpkgutils.py b/elbepack/aptpkgutils.py
> > index 49a02dfb8..407b25caa 100644
> > --- a/elbepack/aptpkgutils.py
> > +++ b/elbepack/aptpkgutils.py
> > @@ -143,8 +143,10 @@ class PackageBase:
> >       # pylint: disable=too-many-instance-attributes
> > -    def __init__(self, name, installed_version,
> > -                 candidate_version, installed_md5, candidate_md5,
> > +    def __init__(self, name,
> > +                 installed_version, candidate_version,
> > +                 installed_md5, candidate_md5,
> > +                 installed_prio, candidate_prio,
> >                    state, is_auto_installed, origin, architecture):
> >           # pylint: disable=too-many-arguments
> > @@ -154,6 +156,8 @@ class PackageBase:
> >           self.candidate_version = candidate_version
> >           self.installed_md5 = installed_md5
> >           self.candidate_md5 = candidate_md5
> > +        self.installed_prio = installed_prio
> > +        self.candidate_prio = candidate_prio
> >           self.state = state
> >           self.is_auto_installed = is_auto_installed
> >           self.origin = origin
> > @@ -179,6 +183,8 @@ class APTPackage(PackageBase):
> >           cver = pkg.candidate and pkg.candidate.version
> >           imd5 = pkg.installed and apt_pkg_md5(pkg.installed)
> >           cmd5 = pkg.candidate and apt_pkg_md5(pkg.candidate)
> > +        iprio = pkg.installed and pkg.installed.priority
> > +        cprio = pkg.candidate and pkg.candidate.priority
> >           self.state = pkgstate(pkg)
> >           self.is_auto_installed = pkg.is_auto_installed
> > @@ -195,15 +201,19 @@ class APTPackage(PackageBase):
> >               arch = None
> >               self.installed_deb = None
> > -        PackageBase.__init__(self, pkg.name, iver,
> > -                             cver, imd5, cmd5,
> > +        PackageBase.__init__(self, pkg.name,
> > +                             iver, cver,
> > +                             imd5, cmd5,
> > +                             iprio, cprio,
> >                                pkgstate(pkg), pkg.is_auto_installed,
> >                                origin, arch)
> >   class XMLPackage(PackageBase):
> >       def __init__(self, node, arch):
> > -        PackageBase.__init__(self, node.et.text, node.et.get('version'),
> > -                             None, node.et.get('md5'), None,
> > +        PackageBase.__init__(self, node.et.text,
> > +                             node.et.get('version'), None,
> > +                             node.et.get('md5'), None,
> > +                             node.et.get('prio'), None,
> >                                INSTALLED, node.et.get('auto') == 'true',
> >                                None, arch)
> > diff --git a/elbepack/cdroms.py b/elbepack/cdroms.py
> > index 7bb046416..e0f8749bc 100644
> > --- a/elbepack/cdroms.py
> > +++ b/elbepack/cdroms.py
> > @@ -161,7 +161,7 @@ def mk_binary_cdrom(rfs, arch, codename, init_codename, xml, target):
> >                   deb = cache.download_binary(pkg.name,
> >                                               '/var/cache/elbe/binaries/main',
> >                                               pkg.installed_version)
> > -                target_repo.includedeb(deb, 'main')
> > +                target_repo.includedeb(deb, 'main', prio=pkg.installed_prio)
> >               except ValueError:
> >                   logging.error("No package '%s'", pkg_id)
> >               except FetchError:
> > @@ -177,7 +177,7 @@ def mk_binary_cdrom(rfs, arch, codename, init_codename, xml, target):
> >               deb = cache.download_binary(pkg.name,
> >                                           '/var/cache/elbe/binaries/added',
> >                                           pkg.installed_version)
> > -            target_repo.includedeb(deb, 'added', pkg.name, True)
> > +            target_repo.includedeb(deb, 'added', pkg.name, prio=pkg.installed_prio, force=True)
> >           except KeyError as ke:
> >               logging.error(str(ke))
> >           except ValueError:
> > diff --git a/elbepack/commands/fetch_initvm_pkgs.py b/elbepack/commands/fetch_initvm_pkgs.py
> > index 81dd6cd20..7524714eb 100644
> > --- a/elbepack/commands/fetch_initvm_pkgs.py
> > +++ b/elbepack/commands/fetch_initvm_pkgs.py
> > @@ -116,7 +116,7 @@ def run_command(argv):
> >                       deb = fetch_binary(pkgver,
> >                                          opt.archive,
> >                                          ElbeAcquireProgress(cb=None))
> > -                    repo.includedeb(deb, 'main')
> > +                    repo.includedeb(deb, 'main', prio=pkgver.priority)
> >                   except ValueError:
> >                       logging.exception('No package "%s"', pkg_id)
> >                   except FetchError:
> > diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
> > index fb488bb00..2a8799aff 100644
> > --- a/elbepack/elbexml.py
> > +++ b/elbepack/elbexml.py
> > @@ -380,9 +380,11 @@ class ElbeXML:
> >           if aptpkg.installed_version is not None:
> >               pak.et.set('version', aptpkg.installed_version)
> >               pak.et.set('md5', aptpkg.installed_md5)
> > +            pak.et.set('prio', aptpkg.installed_prio)
> >           else:
> >               pak.et.set('version', aptpkg.candidate_version)
> >               pak.et.set('md5', aptpkg.candidate_md5)
> > +            pak.et.set('prio', aptpkg.candidate_prio)
> >           if aptpkg.is_auto_installed:
> >               pak.et.set('auto', 'true')
> > diff --git a/elbepack/repomanager.py b/elbepack/repomanager.py
> > index 672ed1e6e..b58fb9c3d 100644
> > --- a/elbepack/repomanager.py
> > +++ b/elbepack/repomanager.py
> > @@ -178,7 +178,7 @@ class RepoBase:
> >                                                            att.codename)
> >               do(cmd, env_add={'GNUPGHOME': '/var/cache/elbe/gnupg'})
> > -    def _includedeb(self, path, codename, components=None):
> > +    def _includedeb(self, path, codename, components=None, prio=None):
> >           if self.maxsize:
> >               new_size = self.fs.disk_usage("") + os.path.getsize(path)
> >               if new_size > self.maxsize:
> > @@ -189,6 +189,9 @@ class RepoBase:
> >                         "--export=never",
> >                         '--basedir "%s"' % self.fs.path]
> > +        if prio is not None:
> > +            global_opt.append(f'--priority {prio}')
> > +
> >           if components is not None:
> >               # Compatibility with old callers
> >               if isinstance(components, str):
> > @@ -199,10 +202,12 @@ class RepoBase:
> >           do(cmd % (global_opt, codename, path))
> > -    def includedeb(self, path, components=None, pkgname=None, force=False):
> > +    def includedeb(self, path, components=None, pkgname=None, force=False, prio=None):
> >           # pkgname needs only to be specified if force is enabled
> >           try:
> > -            self._includedeb(path, self.repo_attr.codename, components)
> > +            self._includedeb(path, self.repo_attr.codename,
> > +                             components=components,
> > +                             prio=prio)
> >           except CommandError as ce:
> >               if force and pkgname is not None:
> >                   # Including deb did not work.
> > @@ -211,13 +216,12 @@ class RepoBase:
> >                   #
> >                   # Try remove, and add again.
> >                   self.removedeb(pkgname, components)
> > -                self._includedeb(path, self.repo_attr.codename, components)
> > +                self._includedeb(path, self.repo_attr.codename,
> > +                                 components=components,
> > +                                 prio=prio)
> >               else:
> >                   raise ce
> > -    def include_init_deb(self, path, components=None):
> > -        self._includedeb(path, self.init_attr.codename, components)
> > -
> >       def _include(self, path, codename, components=None):
> >           cmd        = 'reprepro %s include %s %s'
> > diff --git a/schema/dbsfed.xsd b/schema/dbsfed.xsd
> > index 95385dc90..2bdd92ef2 100644
> > --- a/schema/dbsfed.xsd
> > +++ b/schema/dbsfed.xsd
> > @@ -2581,6 +2581,13 @@
> >               </documentation>
> >             </annotation>
> >           </attribute>
> > +        <attribute name="prio" type="string" use="optional">
> > +          <annotation>
> > +            <documentation>
> > +              priority of the package in the original repository.
> > +            </documentation>
> > +          </annotation>
> > +        </attribute>
> >           <attribute name="on_src_cd" type="string" use="optional">
> >             <annotation>
> >               <documentation>
> > 
> _______________________________________________
> 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