From 2a729bdb7897d9bd4e61249cfe865f2ae066fcb6 Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 8 Jul 2015 11:55:22 +0200 Subject: [PATCH] contrib/rh-bkr: only consider last packages in repositories They're hopefully the most recent ones. COPR leaves the old versions in place and Beaker dislikes long packagelists... --- contrib/rh-bkr/bkr.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/contrib/rh-bkr/bkr.py b/contrib/rh-bkr/bkr.py index 3a4b1f085a..a7318df7b5 100755 --- a/contrib/rh-bkr/bkr.py +++ b/contrib/rh-bkr/bkr.py @@ -489,10 +489,12 @@ class UploadFileRepo(UploadFile_ParseWebsite): raise Exception("Could not find primary.xml in %s" % self._baseurl + 'repodata/repomd.xml') def parse_urls(self, page): - for a in re.finditer('href=[\'"]([^\'"]*\.rpm)[\'"]', page): + latest = {} + for a in re.finditer('href=[\'"]([^\'"]*?([^\'"/]+)-[^\'"-]+-[^\'"-]+\.rpm)[\'"]', page): url = self._baseurl + a.group(1) if self.is_matching_url(url): - yield url + latest[a.group(2)] = self._baseurl + a.group(1) + return latest.values() def raise_no_urls(self): raise Exception("Could not detect any URLs in '%s' repository" % self.uri)