Skip to content

Commit

Permalink
Merge pull request #15 from fedora-infra/feature/only-rawhide-thank-you
Browse files Browse the repository at this point in the history
Only followup on rawhide builds.
  • Loading branch information
ralphbean committed Feb 21, 2015
2 parents 66e9f9b + cd3ce37 commit 232015f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions hotness/consumers.py
Expand Up @@ -219,12 +219,19 @@ def handle_buildsys_scratch(self, msg):
def handle_buildsys_real(self, msg):
idx = msg['msg']['build_id']
state = msg['msg']['new']
release = msg['msg']['release']
instance = msg['msg']['instance']

if instance != 'primary':
self.log.debug("Ignoring secondary arch build...")
return

rawhide = self.get_dist_tag()
if not release.endswith(rawhide):
self.log.debug("Koji build=%r, %r is not rawhide(%r). Drop it." % (
idx, release, rawhide))
return

if state != 1:
self.log.debug("Koji build_id=%r is not complete. Drop it." % idx)
return
Expand Down Expand Up @@ -314,3 +321,18 @@ def is_monitored(self, package):
except:
self.log.exception("Problem interacting with pkgdb.")
return False

@hotness.cache.cache.cache_on_arguments()
def get_dist_tag(self):
url = '{0}/collections/master/'.format(self.pkgdb_url)
self.log.debug("Getting dist tag from %r" % url)
r = requests.get(url)

if not r.status_code == 200:
raise IOError('URL %s returned code %s', r.url, r.status_code)

data = r.json()
collection = data['collections'][0]
tag = collection['dist_tag']
self.log.info("Got rawhide suffix %r" % tag)
return tag

0 comments on commit 232015f

Please sign in to comment.