From 134e56b2f6227ceab160767b7cdb96ab18516ce3 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Oct 20 2015 17:11:15 +0000 Subject: Let the "latest" config option be either an int or a bool This leverages a new koji feature that lets us retrieve the latest N rpms for a package in a tag, instead of just the single latest one. That koji feature has been reviewed, merged, released, and deployed to koji.fedoraproject.org. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1082830 Signed-off-by: Ralph Bean --- diff --git a/mash/__init__.py b/mash/__init__.py index 3c17a6a..85eb792 100644 --- a/mash/__init__.py +++ b/mash/__init__.py @@ -29,6 +29,7 @@ import arch as masharch import multilib import metadata import yum +import yum.config import rpmUtils.arch @@ -326,11 +327,25 @@ class Mash: if self.config.cachedir and not os.path.exists(self.config.cachedir): os.makedirs(self.config.cachedir, 0755) + # Get package list. This is an expensive operation. self.logger.info("Getting package lists for %s..." % (self.config.tag)) - (pkglist, buildlist) = self.session.listTaggedRPMS(self.config.tag, - inherit=self.config.inherit, latest=self.config.latest, rpmsigs=True) + # Latest may be an int or a bool. + # https://bugzilla.redhat.com/showdependencytree.cgi?id=1082830 + latest = self.config.latest + try: + latest = int(latest) + except ValueError: + latest = yum.config.BoolOption().parse(latest) + + (pkglist, buildlist) = self.session.listTaggedRPMS( + self.config.tag, + inherit=self.config.inherit, + latest=latest, + rpmsigs=True, + ) + # filter by key biglist = PackageList(self.config) for pkg in pkglist: diff --git a/mash/config.py b/mash/config.py index 26dbebc..3c70e16 100644 --- a/mash/config.py +++ b/mash/config.py @@ -114,7 +114,7 @@ class MashConfig(config.BaseConfig): max_delta_rpm_size = config.IntOption(300000000) max_delta_rpm_age = config.IntOption() make_ancient = config.BoolOption(False) - latest = config.BoolOption(True) + latest = config.Option(True) distro_tags = config.Option() content_tags = config.ListOption() prefer_ppc64 = config.BoolOption(False)