From 799ebd989805e2dc4ba00ecdfbbc0c43eccababe Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Mon, 1 Feb 2010 16:33:38 -0800 Subject: Wire up the build task the rest of the way This also makes use of the new cert library which needs some work still, so this code is somewhat fragile if you don't have proper certs. --- src/fedpkg.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src/fedpkg.py') diff --git a/src/fedpkg.py b/src/fedpkg.py index 08739d5..d7222ec 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -231,15 +231,30 @@ Running Tasks: return rv def build(args): + if not args.user: + # Doing a try doesn't really work since the fedora_cert library just + # exits on error, but if that gets fixed this will work better. + try: + args.user = fedora_cert.read_user_cert() + except: + log.debug('Could not read Fedora cert, using login name') + args.user = os.getlogin() # Need to do something with BUILD_FLAGS or KOJI_FLAGS here for compat try: mymodule = fedpkg.PackageModule(args.path) kojiconfig = _get_secondary_config(mymodule) - return mymodule.build(args.skip_tag, args.scratch, args.nowait, - args.q, args.background, kojiconfig) + task_id = mymodule.build(args.user, args.skip_tag, args.scratch, + args.background, kojiconfig) except fedpkg.FedpkgError, e: log.error('Could not build: %s' % e) sys.exit(1) + # Now that we have the task ID we need to deal with it. + if args.nowait: + # Log out of the koji session + mymodule.kojisession.logout() + return + # pass info off to our koji task watcher + return _watch_koji_tasks(mymodule.kojisession, [task_id], quiet=args.q) def chainbuild(args): # not implimented -- cgit