Skip to content

Instantly share code, notes, and snippets.

@lmacken
Created June 8, 2015 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmacken/c347fb739f279f6fba55 to your computer and use it in GitHub Desktop.
Save lmacken/c347fb739f279f6fba55 to your computer and use it in GitHub Desktop.
A script that prints out the packages that are ready to be signed
#!/usr/bin/python
"""
Print out a list of builds that need signing.
"""
__requires__ = 'bodhi'
import pkg_resources
import os
import sys
import pickle
from fedora.client import BodhiClient
bodhi = BodhiClient(base_url='http://localhost/updates/')
def signable_builds(release):
locked = set()
# Load the bodhi masher state
lock = '/mnt/koji/mash/updates/MASHING-%s' % release.id_prefix
if os.path.exists(lock):
state = pickle.load(file(lock))
for update in state['updates']:
for build in update.split(','):
locked.add(build)
for req in ('stable', 'testing'):
updates = bodhi.query(request=req, release=release['name'])
for update in updates['updates']:
for build in update['builds']:
if build['nvr'] not in locked:
yield build['nvr']
if __name__ == '__main__':
for release in bodhi.get_releases()['releases']:
for build in signable_builds(release):
print(build)
# vim: ts=4 sw=4 ai expandtab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment