--- lib/python/koji_utils.py | 51 ++++++++++++++++++++------------------------- 1 files changed, 23 insertions(+), 28 deletions(-)
diff --git a/lib/python/koji_utils.py b/lib/python/koji_utils.py index f8ac077..87b32e9 100644 --- a/lib/python/koji_utils.py +++ b/lib/python/koji_utils.py @@ -23,6 +23,7 @@ import time import koji from repoinfo import repoinfo import rpmUtils.miscutils +import sys
# XXX fetch from /etc/koji.conf, section 'koji' kojiurl = 'http://koji.fedoraproject.org/kojihub' @@ -101,40 +102,34 @@ class SimpleKojiClientSession(koji.ClientSession): '''Get most recent releases of package in specified tag (inheritence enabled). Returns dictionary in the format {tag: NVR object}. Optional max_evr says that all returned release versions must be lesser then - it. If you enable unstable_tags, then also 'testing' and 'candidate' - tags are considered. + it. If you enable unstable_tags, then also '-testing' tags are considered. + max_evr = (epoch, version, release) ''' prev_rlss = {} # minor hack - assume -candidate parents = stable+updates+testing # TODO: provide this info in repoinfo instead + # since there's no repo for candidate builds, just look at -testing and below if tag.endswith('-updates-candidate'): - testtag = tag.replace('-candidate','-testing') - testrepo = repoinfo.getrepo_by_tag(testtag) - # -testing parents = stable+updates. add -testing and we're good. - parents = testrepo['parents'] + [testrepo['name']] - else: - parents = repoinfo.getrepo_by_tag(tag)['parents'] - if parents: - for p in parents: - ptag = repoinfo.get(p,'tag') - if ('-testing' in ptag or '-candidate' in ptag) and \ - not unstable_tags: - # skip unstable tags - continue - prev_rlss[ptag] = self.latest_by_tag(ptag, name, max_evr=max_evr) - else: - # NOTE: for tags with no parents (e.g. rawhide) we obviously can't - # check the parent repos' tags to get the previously released - # package NVRs. Instead we use koji's tagHistory command to find - # the previous version of this package that had this tag. - hist = self.tagHistory(tag=tag, package=name) - # remove untagged builds - hist = filter(lambda h: h['revoke_event'] is None, hist) - # ensure sorting by time - hist.sort(key=lambda h: h['create_ts']) - # hist[-2] = not the currently-tagged build, the one before that - prev_rlss[tag] = self.getBuild(hist[-2]['build_id']) + tag = tag.replace('-candidate','-testing') + + testrepo = repoinfo.getrepo_by_tag(tag) + if testrepo is None: + print >> sys.stderr, "Error: There's no repo definition for tag '%s'" % tag + return {} + parents = testrepo['parents'] + repos = parents + [testrepo['name']] + + if not unstable_tags: + for repo in repos[:]: + rtag = repoinfo.get(repo, 'tag') + if ('-testing' in rtag or '-candidate' in rtag): + # remove repo with unstable tag + repos.remove(repo) + + for repo in repos: + rtag = repoinfo.get(repo, 'tag') + prev_rlss[rtag] = self.latest_by_tag(rtag, name, max_evr=max_evr) return prev_rlss
def list_previous_release(self, name, tag, max_evr=None,
On Fri, 2010-08-20 at 17:42 +0200, Kamil Páral wrote:
lib/python/koji_utils.py | 51 ++++++++++++++++++++------------------------- 1 files changed, 23 insertions(+), 28 deletions(-)
diff --git a/lib/python/koji_utils.py b/lib/python/koji_utils.py index f8ac077..87b32e9 100644 --- a/lib/python/koji_utils.py +++ b/lib/python/koji_utils.py
<snip>
Thanks Kamil,
As we discussed in the Fedora QA meeting today. I have applied this patch to the running AutoQA instance and rescheduled several previously failed rpmguard jobs. I consider the results a PASS, but welcome any additional tests you'd like me to run.
First, a package that does *not* have previous builds ... gtk-nodoka-engine-0.7.5-1.fc15 * Without the patch, the job (#45485) failed (see http://fpaste.org/cOJh/). * With the patch, the job (#45506) runs to completion, but is not able to find a previous build to compare against in dist-f15. This is accurate, looking in 'koji' I cannot find another dist-f15 build to compare against (http://koji.fedoraproject.org/koji/packageinfo?packageID=4871).
N: There is no previous build of gtk-nodoka-engine-0.7.5-1.fc15 in parents of dist-f15 tag.
Next, a package that does have previous builds ... schroot-1.4.2-5.fc14 * Without patch - rpmguard result - https://fedorahosted.org/pipermail/autoqa-results/2010-July/028449.html * With patch - rpmguard result - https://fedorahosted.org/pipermail/autoqa-results/2010-August/030026.html
The results match, and the confirm what I'd expect to see based on koji builds (http://koji.fedoraproject.org/koji/packageinfo?packageID=8929).
Thanks, James
autoqa-devel@lists.fedorahosted.org