diff options
author | Colin Walters <walters@verbum.org> | 2010-02-27 15:45:52 -0500 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-02-27 15:45:52 -0500 |
commit | c3e20536051ef4c7b32fe4c6820bbab1dcaca472 (patch) | |
tree | e8a060c6429855cdd1baa6954b8639ae6d1b4a96 /fedpkg-pull-build-chain | |
parent | 33ee3a56739d5afe98b9348706f152e95a8bcfd1 (diff) | |
download | fedpkg-make-pull-c3e20536051ef4c7b32fe4c6820bbab1dcaca472.tar.gz fedpkg-make-pull-c3e20536051ef4c7b32fe4c6820bbab1dcaca472.tar.xz fedpkg-make-pull-c3e20536051ef4c7b32fe4c6820bbab1dcaca472.zip |
[fedpkg-pull-build-chain] Add DBus status notifications
Diffstat (limited to 'fedpkg-pull-build-chain')
-rwxr-xr-x | fedpkg-pull-build-chain | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/fedpkg-pull-build-chain b/fedpkg-pull-build-chain index c0e5112..7a0339c 100755 --- a/fedpkg-pull-build-chain +++ b/fedpkg-pull-build-chain @@ -15,10 +15,29 @@ import sys import subprocess import shutil +import dbus, dbus.service, dbus.bus +import glib +import gobject +from dbus.mainloop.glib import DBusGMainLoop +DBusGMainLoop(set_as_default=True) + def check_call_verbose(*args, **kwargs): print "Running: %r" % (args[0], ) subprocess.check_call(*args, **kwargs) +STATE_STARTING = 'starting' +STATE_VCS = 'vcs' +STATE_BUILDING = 'building' + +class FedpkgPullBuildChainState(dbus.service.Object): + def __init__(self, path): + dbus.service.Object.__init__(self, dbus.SessionBus(), path) + + @dbus.service.signal(dbus_interface='org.fedoraproject.FedpkgPullBuildChain', + signature='sa{sv}') + def StateChanged(self, state, statedata): + pass + def main(): try: opts, args = getopt.getopt(sys.argv[1:], '', ['release=', 'arch=', 'resultdir=', 'force']) @@ -27,6 +46,20 @@ def main(): print "Usage: fedpkg-pull-build-chain --release=F-12 --resultdir=/path/to/repo rpm1 rpm2 ..." sys.exit(1) + if 'DBUS_SESSION_BUS_ADDRESS' in os.environ: + bus = dbus.SessionBus() + bus_name = dbus.service.BusName('org.fedoraproject.FedpkgPullBuildChain', bus=bus) + state_notifier = FedpkgPullBuildChainState('/org/fedoraproject/FedpkgPullBuildChain') + state_notifier.StateChanged + else: + state_notifier = None + + def notify_state(state, statedata): + if not state_notifier: + return + state_notifier.StateChanged(state, statedata) + dbus.SessionBus().flush() + force = False release = None resultdir = None @@ -82,6 +115,7 @@ def main(): for arg in args: if not os.path.isdir(arg): print "Checking out %r from fedora-cvs" % (arg, ) + notify_state('fedora-vcs', { 'module': arg }) check_call_verbose(['fedora-cvs', arg], stdout=sys.stdout, stderr=sys.stderr) release_dir = os.path.join(arg, release) for filename in os.listdir(release_dir): @@ -107,6 +141,7 @@ def main(): last_build_succeeded = False print "Running fedpkg-make-pull" + notify_state('upstream-vcs', { 'module': arg }) args = ['fedpkg-make-pull', '--status-file=' + os.path.abspath('pull-status')] if force or not last_build_succeeded: args.append('--force') @@ -138,6 +173,7 @@ def main(): current_failed = False for mockrelease in mockreleases: try: + notify_state('build', { 'module': arg, 'srpm': os.path.basename(srpm), 'target': mockrelease }) check_call_verbose(['mock', '--configdir=_build', '-r', mockrelease, '--resultdir=' + mock_resultdir, 'rebuild', srpm], stdout=sys.stdout, stderr=sys.stderr) except subprocess.CalledProcessError, e: print "Failed: " + unicode(e) @@ -163,6 +199,7 @@ def main(): if os.path.exists(linkname): continue os.link(src, linkname) + notify_state('createrepo', {}) check_call_verbose(['createrepo', '.'], cwd=resultdir) f = open(lastbuild_filepath, 'w') |