[elbe-devel] [PATCH 1/3] commands buildrepo: add options to skip bin and sources
Manuel Traut
manut at linutronix.de
Fri Oct 19 16:02:21 CEST 2018
On Fri, Oct 12, 2018 at 11:32:38AM +0200, Torben Hohn wrote:
> just skip downloading of packages, but still create the repositories
>
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
Reviewed-by: Manuel Traut <manut at linutronix.de>
> ---
> elbepack/commands/buildrepo.py | 119 ++++++++++++++++++++++-------------------
> 1 file changed, 65 insertions(+), 54 deletions(-)
>
> diff --git a/elbepack/commands/buildrepo.py b/elbepack/commands/buildrepo.py
> index 84c0ef33..ff0565db 100644
> --- a/elbepack/commands/buildrepo.py
> +++ b/elbepack/commands/buildrepo.py
> @@ -59,6 +59,14 @@ def run_command(argv):
> default="/var/cache/elbe/sources",
> help="path where src packages are downloaded to.")
>
> + oparser.add_option("--skip-build-sources", action="store_false",
> + dest="build_sources", default=True,
> + help="Skip downloading Source Packages")
> +
> + oparser.add_option("--skip-build-bin", action="store_false",
> + dest="build_bin", default=True,
> + help="Skip downloading binary packages")
> +
> (opt, args) = oparser.parse_args(argv)
>
> if len(args) != 1:
> @@ -100,32 +108,33 @@ def run_command(argv):
>
> hostfs.mkdir_p(opt.archive)
>
> - pkglist = get_initvm_pkglist()
> - cache = Cache()
> - cache.open()
> - for pkg in pkglist:
> - try:
> - p = cache[pkg.name]
> - pkgver = p.installed
> - deb = pkgver.fetch_binary(opt.archive,
> - ElbeAcquireProgress(cb=None))
> - repo.includedeb(deb, 'main')
> - except ValueError:
> - log.printo("No Package " + pkg.name +
> - "-" + str(pkg.installed_version))
> - except FetchError:
> - log.printo(
> - "Package " +
> - pkg.name +
> - "-" +
> - pkgver.version +
> - " could not be downloaded")
> - except TypeError:
> - log.printo("Package " +
> - pkg.name +
> - "-" +
> - str(pkg.installed_version) +
> - " missing name or version")
> + if opt.build_bin:
> + pkglist = get_initvm_pkglist()
> + cache = Cache()
> + cache.open()
> + for pkg in pkglist:
> + try:
> + p = cache[pkg.name]
> + pkgver = p.installed
> + deb = pkgver.fetch_binary(opt.archive,
> + ElbeAcquireProgress(cb=None))
> + repo.includedeb(deb, 'main')
> + except ValueError:
> + log.printo("No Package " + pkg.name +
> + "-" + str(pkg.installed_version))
> + except FetchError:
> + log.printo(
> + "Package " +
> + pkg.name +
> + "-" +
> + pkgver.version +
> + " could not be downloaded")
> + except TypeError:
> + log.printo("Package " +
> + pkg.name +
> + "-" +
> + str(pkg.installed_version) +
> + " missing name or version")
>
> repo.finalize()
>
> @@ -139,33 +148,35 @@ def run_command(argv):
> #
> # FIXME: we need a way to add source cdroms later on
> if opt.cdrom_path:
> - if opt.cdrom_device:
> - log.do('umount "%s"' % opt.cdrom_device)
> - sys.exit(0)
> -
> - for pkg in pkglist:
> - try:
> - p = cache[pkg.name]
> - pkgver = p.installed
> - dsc = pkgver.fetch_source(opt.srcarchive,
> - ElbeAcquireProgress(cb=None),
> - unpack=False)
> - repo.include_init_dsc(dsc, 'initvm')
> - except ValueError:
> - log.printo("No Package " + pkg.name +
> - "-" + str(pkg.installed_version))
> - except FetchError:
> - log.printo(
> - "Package " +
> - pkg.name +
> - "-" +
> - pkgver.version +
> - " could not be downloaded")
> - except TypeError:
> - log.printo("Package " +
> - pkg.name +
> - "-" +
> - str(pkg.installed_version) +
> - " missing name or version")
> + opt.build_sources = False
> +
> + if opt.build_sources:
> + for pkg in pkglist:
> + try:
> + p = cache[pkg.name]
> + pkgver = p.installed
> + dsc = pkgver.fetch_source(opt.srcarchive,
> + ElbeAcquireProgress(cb=None),
> + unpack=False)
> + repo.include_init_dsc(dsc, 'initvm')
> + except ValueError:
> + log.printo("No Package " + pkg.name +
> + "-" + str(pkg.installed_version))
> + except FetchError:
> + log.printo(
> + "Package " +
> + pkg.name +
> + "-" +
> + pkgver.version +
> + " could not be downloaded")
> + except TypeError:
> + log.printo("Package " +
> + pkg.name +
> + "-" +
> + str(pkg.installed_version) +
> + " missing name or version")
>
> repo.finalize()
> +
> + if opt.cdrom_device:
> + log.do('umount "%s"' % opt.cdrom_device)
> --
> 2.11.0
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
More information about the elbe-devel
mailing list