[elbe-devel] [PATCH 3/4] cdroms: Use SrcManager to download packages
Torben Hohn
torben.hohn at linutronix.de
Thu Apr 2 15:19:33 CEST 2020
On Mon, Mar 23, 2020 at 02:53:55PM -0400, Olivier Dion wrote:
> Signed-off-by: Olivier Dion <dion at linutronix.de>
> ---
> elbepack/cdroms.py | 40 ++++++++++++++++++++++++----------------
> 1 file changed, 24 insertions(+), 16 deletions(-)
>
> diff --git a/elbepack/cdroms.py b/elbepack/cdroms.py
> index 827ddf88..75f15e00 100644
> --- a/elbepack/cdroms.py
> +++ b/elbepack/cdroms.py
> @@ -49,7 +49,7 @@ class SrcManager(object):
> self.pkgs[name] = {version: [component]}
>
> def mk_source_cdrom(rfs, arch, codename, init_codename, target,
> - cdrom_size=CDROM_SIZE, xml=None):
> + cdrom_size=CDROM_SIZE, xml=None, others={}):
>
> # pylint: disable=too-many-arguments
> # pylint: disable=too-many-locals
> @@ -70,30 +70,38 @@ def mk_source_cdrom(rfs, arch, codename, init_codename, target,
>
> cache = get_rpcaptcache(rfs, arch)
> cache.update()
> - pkglist = cache.get_installed_pkgs()
>
> - forbiddenPackages = []
> + man = SrcManager()
> +
> + purge_main = set()
> if xml is not None and xml.has('target/pkg-list'):
> for i in xml.node('target/pkg-list'):
> try:
> if i.tag == 'pkg' and i.et.attrib['on_src_cd'] == 'False':
> - forbiddenPackages.append(i.text('.').strip())
> -
please dont rename this.
This is for the customer application. These package should not show up
on the source cdrom under any condition.
> + purge_main.add(i.text('.').strip())
> except KeyError:
> pass
>
> - for pkg in pkglist:
> - # Do not include forbidden packages in src cdrom
> - if pkg.name in forbiddenPackages:
> - continue
> - pkg_id = "%s-%s" % (pkg.name, pkg.installed_version)
> + # Do main component
> + for pkg in cache.get_installed_pkgs():
> + if pkg.name not in purge_main:
> + man.add_pkg(pkg.name, pkg.installed_version, "main")
> +
> + # Do other components
> + for component in others:
> + for name, version in others[component]:
> + man.add_pkg(name, version, component)
> +
> + for pkg, version, component in man:
> + logging.info('Downloading "%s-%s" for %s', pkg, version, component)
> try:
> - dsc = cache.download_source(pkg.name, '/var/cache/elbe/sources')
> - repo.includedsc(dsc, force=True)
> - except ValueError:
> - logging.error("No sources for package '%s'", pkg_id)
> - except FetchError:
> - logging.error("Source for package '%s' could not be downloaded", pkg_id)
> + dsc = cache.download_source(pkg,
> + '/var/cache/elbe/sources',
> + version=version)
> + except Exception as E:
> + logging.exception(E)
> + else:
> + repo.includedsc(dsc, component=component, force=True)
>
> # elbe fetch_initvm_pkgs has downloaded all sources to
> # /var/cache/elbe/sources
> --
> 2.25.1
>
>
> _______________________________________________
> 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