| |
@@ -24,7 +24,13 @@
|
| |
# Mike Bonnet <mikeb@redhat.com>
|
| |
# Cristian Balint <cbalint@redhat.com>
|
| |
|
| |
+ from __future__ import absolute_import
|
| |
+ from __future__ import print_function
|
| |
import sys
|
| |
+ from six.moves import filter
|
| |
+ from six.moves import map
|
| |
+ from six.moves import range
|
| |
+ from six.moves import zip
|
| |
try:
|
| |
import krbV
|
| |
except ImportError: # pragma: no cover
|
| |
@@ -40,7 +46,7 @@
|
| |
import simplejson as json
|
| |
except ImportError:
|
| |
json = None
|
| |
- import ConfigParser
|
| |
+ from six.moves import configparser
|
| |
import base64
|
| |
import dateutil.parser
|
| |
import errno
|
| |
@@ -60,7 +66,7 @@
|
| |
import traceback
|
| |
import urlgrabber.grabber as grabber
|
| |
import urlgrabber.progress as progress
|
| |
- import xmlrpclib
|
| |
+ from six.moves import xmlrpc_client
|
| |
try:
|
| |
import libcomps
|
| |
except ImportError: # pragma: no cover
|
| |
@@ -142,7 +148,7 @@
|
| |
def get_epilog_str(progname=None):
|
| |
if progname is None:
|
| |
progname = os.path.basename(sys.argv[0]) or 'koji'
|
| |
- categories_ordered=', '.join(sorted(['all'] + categories.keys()))
|
| |
+ categories_ordered=', '.join(sorted(['all'] + list(categories.keys())))
|
| |
epilog_str = '''
|
| |
Try "%(progname)s --help" for help about global options
|
| |
Try "%(progname)s help" to get all available commands
|
| |
@@ -237,12 +243,12 @@
|
| |
# load local config
|
| |
try:
|
| |
result = koji.read_config(options.profile, user_config=options.configFile)
|
| |
- except koji.ConfigurationError, e:
|
| |
+ except koji.ConfigurationError as e:
|
| |
parser.error(e.args[0])
|
| |
assert False # pragma: no cover
|
| |
|
| |
# update options according to local config
|
| |
- for name, value in result.iteritems():
|
| |
+ for name, value in result.items():
|
| |
if getattr(options, name, None) is None:
|
| |
setattr(options, name, value)
|
| |
|
| |
@@ -275,7 +281,7 @@
|
| |
def ensure_connection(session):
|
| |
try:
|
| |
ret = session.getAPIVersion()
|
| |
- except xmlrpclib.ProtocolError:
|
| |
+ except xmlrpc_client.ProtocolError:
|
| |
error(_("Error: Unable to connect to server"))
|
| |
if ret != koji.API_VERSION:
|
| |
warn(_("WARNING: The server is at API version %d and the client is at %d" % (ret, koji.API_VERSION)))
|
| |
@@ -294,7 +300,7 @@
|
| |
else:
|
| |
indent = ''
|
| |
label = koji.taskLabel(task)
|
| |
- print(''.join([fmt % task, indent, label]))
|
| |
+ print((''.join([fmt % task, indent, label])))
|
| |
|
| |
def print_task_recurse(task,depth=0):
|
| |
"""Print a task and its children"""
|
| |
@@ -339,7 +345,7 @@
|
| |
error = None
|
| |
try:
|
| |
result = self.session.getTaskResult(self.id)
|
| |
- except (xmlrpclib.Fault,koji.GenericError),e:
|
| |
+ except (xmlrpc_client.Fault, koji.GenericError) as e:
|
| |
error = e
|
| |
if error is None:
|
| |
# print("%s: complete" % self.str())
|
| |
@@ -357,7 +363,7 @@
|
| |
self.info = self.session.getTaskInfo(self.id, request=True)
|
| |
if self.info is None:
|
| |
if not self.quiet:
|
| |
- print("No such task id: %i" % self.id)
|
| |
+ print(("No such task id: %i" % self.id))
|
| |
sys.exit(1)
|
| |
state = self.info['state']
|
| |
if last:
|
| |
@@ -365,13 +371,13 @@
|
| |
laststate = last['state']
|
| |
if laststate != state:
|
| |
if not self.quiet:
|
| |
- print("%s: %s -> %s" % (self.str(), self.display_state(last), self.display_state(self.info)))
|
| |
+ print(("%s: %s -> %s" % (self.str(), self.display_state(last), self.display_state(self.info))))
|
| |
return True
|
| |
return False
|
| |
else:
|
| |
# First time we're seeing this task, so just show the current state
|
| |
if not self.quiet:
|
| |
- print("%s: %s" % (self.str(), self.display_state(self.info)))
|
| |
+ print(("%s: %s" % (self.str(), self.display_state(self.info))))
|
| |
return False
|
| |
|
| |
def is_done(self):
|
| |
@@ -417,7 +423,7 @@
|
| |
open += 1
|
| |
elif status == koji.TASK_STATES['FREE']:
|
| |
free += 1
|
| |
- print(" %d free %d open %d done %d failed" % (free, open, done, failed))
|
| |
+ print((" %d free %d open %d done %d failed" % (free, open, done, failed)))
|
| |
|
| |
def display_task_results(tasks):
|
| |
for task in [task for task in tasks.values() if task.level == 0]:
|
| |
@@ -425,14 +431,14 @@
|
| |
task_label = task.str()
|
| |
|
| |
if state == koji.TASK_STATES['CLOSED']:
|
| |
- print('%s completed successfully' % task_label)
|
| |
+ print(('%s completed successfully' % task_label))
|
| |
elif state == koji.TASK_STATES['FAILED']:
|
| |
- print('%s failed' % task_label)
|
| |
+ print(('%s failed' % task_label))
|
| |
elif state == koji.TASK_STATES['CANCELED']:
|
| |
- print('%s was canceled' % task_label)
|
| |
+ print(('%s was canceled' % task_label))
|
| |
else:
|
| |
# shouldn't happen
|
| |
- print('%s has not completed' % task_label)
|
| |
+ print(('%s has not completed' % task_label))
|
| |
|
| |
def watch_tasks(session,tasklist,quiet=False):
|
| |
global options
|
| |
@@ -448,7 +454,7 @@
|
| |
tasks[task_id] = TaskWatcher(task_id,session,quiet=quiet)
|
| |
while True:
|
| |
all_done = True
|
| |
- for task_id,task in tasks.items():
|
| |
+ for task_id, task in list(tasks.items()):
|
| |
changed = task.update()
|
| |
if not task.is_done():
|
| |
all_done = False
|
| |
@@ -461,7 +467,7 @@
|
| |
rv = 1
|
| |
for child in session.getTaskChildren(task_id):
|
| |
child_id = child['id']
|
| |
- if not child_id in tasks.keys():
|
| |
+ if not child_id in list(tasks.keys()):
|
| |
tasks[child_id] = TaskWatcher(child_id, session, task.level + 1, quiet=quiet)
|
| |
tasks[child_id].update()
|
| |
# If we found new children, go through the list again,
|
| |
@@ -480,10 +486,10 @@
|
| |
progname = os.path.basename(sys.argv[0]) or 'koji'
|
| |
tlist = ['%s: %s' % (t.str(), t.display_state(t.info))
|
| |
for t in tasks.values() if not t.is_done()]
|
| |
- print( \
|
| |
+ print(( \
|
| |
"""Tasks still running. You can continue to watch with the '%s watch-task' command.
|
| |
Running Tasks:
|
| |
- %s""" % (progname, '\n'.join(tlist)))
|
| |
+ %s""" % (progname, '\n'.join(tlist))))
|
| |
rv = 1
|
| |
return rv
|
| |
|
| |
@@ -493,7 +499,7 @@
|
| |
def _isDone(session, taskId):
|
| |
info = session.getTaskInfo(taskId)
|
| |
if info is None:
|
| |
- print("No such task id: %i" % taskId)
|
| |
+ print(("No such task id: %i" % taskId))
|
| |
sys.exit(1)
|
| |
state = koji.TASK_STATES[info['state']]
|
| |
return (state in ['CLOSED','CANCELED','FAILED'])
|
| |
@@ -560,13 +566,13 @@
|
| |
|
| |
dsttag = session.getTag(tag)
|
| |
if not dsttag:
|
| |
- print("Unknown tag: %s" % tag)
|
| |
+ print(("Unknown tag: %s" % tag))
|
| |
return 1
|
| |
|
| |
groups = dict([(p['name'], p['group_id']) for p in session.getTagGroups(tag, inherit=False)])
|
| |
group_id = groups.get(group, None)
|
| |
if group_id is not None:
|
| |
- print("Group %s already exists for tag %s" % (group, tag))
|
| |
+ print(("Group %s already exists for tag %s" % (group, tag)))
|
| |
return 1
|
| |
|
| |
session.groupListAdd(tag, group)
|
| |
@@ -605,9 +611,9 @@
|
| |
|
| |
ret = session.assignTask(task_id, hostname, force)
|
| |
if ret:
|
| |
- print('assigned task %d to host %s' % (task_id, hostname))
|
| |
+ print(('assigned task %d to host %s' % (task_id, hostname)))
|
| |
else:
|
| |
- print('failed to assign task %d to host %s' % (task_id, hostname))
|
| |
+ print(('failed to assign task %d to host %s' % (task_id, hostname)))
|
| |
|
| |
|
| |
def handle_add_host(options, session, args):
|
| |
@@ -624,7 +630,7 @@
|
| |
activate_session(session)
|
| |
id = session.getHost(host)
|
| |
if id:
|
| |
- print("%s is already in the database" % host)
|
| |
+ print(("%s is already in the database" % host))
|
| |
return 1
|
| |
else:
|
| |
kwargs = {}
|
| |
@@ -632,7 +638,7 @@
|
| |
kwargs['krb_principal'] = options.krb_principal
|
| |
id = session.addHost(host, args[1:], **kwargs)
|
| |
if id:
|
| |
- print("%s added: id %d" % (host, id))
|
| |
+ print(("%s added: id %d" % (host, id)))
|
| |
|
| |
def handle_edit_host(options, session, args):
|
| |
"[admin] Edit a host"
|
| |
@@ -662,11 +668,11 @@
|
| |
error = False
|
| |
for host, [info] in zip(args, session.multiCall(strict=True)):
|
| |
if not info:
|
| |
- print(_("Host %s does not exist") % host)
|
| |
+ print((_("Host %s does not exist") % host))
|
| |
error = True
|
| |
|
| |
if error:
|
| |
- print(_("No changes made, please correct the command line"))
|
| |
+ print((_("No changes made, please correct the command line")))
|
| |
return 1
|
| |
|
| |
session.multicall = True
|
| |
@@ -674,9 +680,9 @@
|
| |
session.editHost(host, **vals)
|
| |
for host, [result] in zip(args, session.multiCall(strict=True)):
|
| |
if result:
|
| |
- print(_("Edited %s") % host)
|
| |
+ print((_("Edited %s") % host))
|
| |
else:
|
| |
- print(_("No changes made to %s") % host)
|
| |
+ print((_("No changes made to %s") % host))
|
| |
|
| |
def handle_add_host_to_channel(options, session, args):
|
| |
"[admin] Add a host to a channel"
|
| |
@@ -692,18 +698,18 @@
|
| |
activate_session(session)
|
| |
if options.list:
|
| |
for channel in session.listChannels():
|
| |
- print(channel['name'])
|
| |
+ print((channel['name']))
|
| |
return
|
| |
channel = args[1]
|
| |
if not options.new:
|
| |
channelinfo = session.getChannel(channel)
|
| |
if not channelinfo:
|
| |
- print("No such channel: %s" % channel)
|
| |
+ print(("No such channel: %s" % channel))
|
| |
return 1
|
| |
host = args[0]
|
| |
hostinfo = session.getHost(host)
|
| |
if not hostinfo:
|
| |
- print("No such host: %s" % host)
|
| |
+ print(("No such host: %s" % host))
|
| |
return 1
|
| |
kwargs = {}
|
| |
if options.new:
|
| |
@@ -723,13 +729,13 @@
|
| |
activate_session(session)
|
| |
hostinfo = session.getHost(host)
|
| |
if not hostinfo:
|
| |
- print("No such host: %s" % host)
|
| |
+ print(("No such host: %s" % host))
|
| |
return 1
|
| |
hostchannels = [c['name'] for c in session.listChannels(hostinfo['id'])]
|
| |
|
| |
channel = args[1]
|
| |
if channel not in hostchannels:
|
| |
- print("Host %s is not a member of channel %s" % (host, channel))
|
| |
+ print(("Host %s is not a member of channel %s" % (host, channel)))
|
| |
return 1
|
| |
|
| |
session.removeHostFromChannel(host, channel)
|
| |
@@ -747,7 +753,7 @@
|
| |
activate_session(session)
|
| |
cinfo = session.getChannel(args[0])
|
| |
if not cinfo:
|
| |
- print("No such channel: %s" % args[0])
|
| |
+ print(("No such channel: %s" % args[0]))
|
| |
return 1
|
| |
session.removeChannel(args[0], force=options.force)
|
| |
|
| |
@@ -763,7 +769,7 @@
|
| |
activate_session(session)
|
| |
cinfo = session.getChannel(args[0])
|
| |
if not cinfo:
|
| |
- print("No such channel: %s" % args[0])
|
| |
+ print(("No such channel: %s" % args[0]))
|
| |
return 1
|
| |
session.renameChannel(args[0], args[1])
|
| |
|
| |
@@ -783,7 +789,7 @@
|
| |
parser.error(_("Please specify an owner for the package(s)"))
|
| |
assert False # pragma: no cover
|
| |
if not session.getUser(options.owner):
|
| |
- print("User %s does not exist" % options.owner)
|
| |
+ print(("User %s does not exist" % options.owner))
|
| |
return 1
|
| |
activate_session(session)
|
| |
tag = args[0]
|
| |
@@ -793,21 +799,21 @@
|
| |
# check if list of packages exists for that tag already
|
| |
dsttag=session.getTag(tag)
|
| |
if dsttag is None:
|
| |
- print("No such tag: %s" % tag)
|
| |
+ print(("No such tag: %s" % tag))
|
| |
sys.exit(1)
|
| |
pkglist = dict([(p['package_name'], p['package_id']) for p in session.listPackages(tagID=dsttag['id'])])
|
| |
to_add = []
|
| |
for package in args[1:]:
|
| |
package_id = pkglist.get(package, None)
|
| |
if not package_id is None:
|
| |
- print("Package %s already exists in tag %s" % (package, tag))
|
| |
+ print(("Package %s already exists in tag %s" % (package, tag)))
|
| |
continue
|
| |
to_add.append(package)
|
| |
if options.extra_arches:
|
| |
opts['extra_arches'] = parse_arches(options.extra_arches)
|
| |
|
| |
# add the packages
|
| |
- print("Adding %i packages to tag %s" % (len(to_add), dsttag['name']))
|
| |
+ print(("Adding %i packages to tag %s" % (len(to_add), dsttag['name'])))
|
| |
session.multicall = True
|
| |
for package in to_add:
|
| |
session.packageListAdd(tag, package, options.owner, **opts)
|
| |
@@ -828,14 +834,14 @@
|
| |
# check if list of packages exists for that tag already
|
| |
dsttag=session.getTag(tag)
|
| |
if dsttag is None:
|
| |
- print("No such tag: %s" % tag)
|
| |
+ print(("No such tag: %s" % tag))
|
| |
return 1
|
| |
pkglist = dict([(p['package_name'], p['package_id']) for p in session.listPackages(tagID=dsttag['id'], inherited=True)])
|
| |
ret = 0
|
| |
for package in args[1:]:
|
| |
package_id = pkglist.get(package, None)
|
| |
if package_id is None:
|
| |
- print("Package %s doesn't exist in tag %s" % (package, tag))
|
| |
+ print(("Package %s doesn't exist in tag %s" % (package, tag)))
|
| |
ret = 1
|
| |
if ret:
|
| |
return ret
|
| |
@@ -861,14 +867,14 @@
|
| |
# check if list of packages exists for that tag already
|
| |
dsttag=session.getTag(tag)
|
| |
if dsttag is None:
|
| |
- print("No such tag: %s" % tag)
|
| |
+ print(("No such tag: %s" % tag))
|
| |
return 1
|
| |
pkglist = dict([(p['package_name'], p['package_id']) for p in session.listPackages(tagID=dsttag['id'])])
|
| |
ret = 0
|
| |
for package in args[1:]:
|
| |
package_id = pkglist.get(package, None)
|
| |
if package_id is None:
|
| |
- print("Package %s is not in tag %s" % (package, tag))
|
| |
+ print(("Package %s is not in tag %s" % (package, tag)))
|
| |
ret = 1
|
| |
if ret:
|
| |
return ret
|
| |
@@ -927,7 +933,7 @@
|
| |
def _running_in_bg():
|
| |
try:
|
| |
return (not os.isatty(0)) or (os.getpgrp() != os.tcgetpgrp(0))
|
| |
- except OSError, e:
|
| |
+ except OSError as e:
|
| |
return True
|
| |
|
| |
def handle_build(options, session, args):
|
| |
@@ -987,7 +993,7 @@
|
| |
if '://' not in source:
|
| |
#treat source as an srpm and upload it
|
| |
if not build_opts.quiet:
|
| |
- print("Uploading srpm: %s" % source)
|
| |
+ print(("Uploading srpm: %s" % source))
|
| |
serverdir = _unique_path('cli-build')
|
| |
if _running_in_bg() or build_opts.noprogress or build_opts.quiet:
|
| |
callback = None
|
| |
@@ -998,8 +1004,8 @@
|
| |
source = "%s/%s" % (serverdir, os.path.basename(source))
|
| |
task_id = session.build(source, target, opts, priority=priority)
|
| |
if not build_opts.quiet:
|
| |
- print("Created task: %d" % task_id)
|
| |
- print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
|
| |
+ print(("Created task: %d" % task_id))
|
| |
+ print(("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)))
|
| |
if build_opts.wait or (build_opts.wait is None and not _running_in_bg()):
|
| |
session.logout()
|
| |
return watch_tasks(session, [task_id], quiet=build_opts.quiet)
|
| |
@@ -1035,8 +1041,8 @@
|
| |
# otherwise there is no way that a chain-build can work
|
| |
ancestors = session.getFullInheritance(build_target['build_tag'])
|
| |
if dest_tag['id'] not in [build_target['build_tag']] + [ancestor['parent_id'] for ancestor in ancestors]:
|
| |
- print(_("Packages in destination tag %(dest_tag_name)s are not inherited by build tag %(build_tag_name)s" % build_target))
|
| |
- print(_("Target %s is not usable for a chain-build" % build_target['name']))
|
| |
+ print((_("Packages in destination tag %(dest_tag_name)s are not inherited by build tag %(build_tag_name)s" % build_target)))
|
| |
+ print((_("Target %s is not usable for a chain-build" % build_target['name'])))
|
| |
return 1
|
| |
|
| |
sources = args[1:]
|
| |
@@ -1058,7 +1064,7 @@
|
| |
# quick check that it looks like a N-V-R
|
| |
build_level.append(src)
|
| |
else:
|
| |
- print(_('"%s" is not a SCM URL or package N-V-R' % src))
|
| |
+ print((_('"%s" is not a SCM URL or package N-V-R' % src)))
|
| |
return 1
|
| |
if build_level:
|
| |
src_list.append(build_level)
|
| |
@@ -1073,8 +1079,8 @@
|
| |
|
| |
task_id = session.chainBuild(src_list, target, priority=priority)
|
| |
if not build_opts.quiet:
|
| |
- print("Created task: %d" % task_id)
|
| |
- print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
|
| |
+ print(("Created task: %d" % task_id))
|
| |
+ print(("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)))
|
| |
if _running_in_bg() or build_opts.nowait:
|
| |
return
|
| |
else:
|
| |
@@ -1150,11 +1156,11 @@
|
| |
try:
|
| |
params = koji.util.parse_maven_param(build_opts.inis, scratch=build_opts.scratch,
|
| |
section=build_opts.section)
|
| |
- except ValueError, e:
|
| |
+ except ValueError as e:
|
| |
parser.error(e.args[0])
|
| |
- opts = params.values()[0]
|
| |
+ opts = list(params.values())[0]
|
| |
if opts.pop('type', 'maven') != 'maven':
|
| |
- parser.error(_("Section %s does not contain a maven-build config") % params.keys()[0])
|
| |
+ parser.error(_("Section %s does not contain a maven-build config") % list(params.keys())[0])
|
| |
source = opts.pop('scmurl')
|
| |
else:
|
| |
source = args[1]
|
| |
@@ -1171,8 +1177,8 @@
|
| |
priority = 5
|
| |
task_id = session.mavenBuild(source, target, opts, priority=priority)
|
| |
if not build_opts.quiet:
|
| |
- print("Created task: %d" % task_id)
|
| |
- print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
|
| |
+ print(("Created task: %d" % task_id))
|
| |
+ print(("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)))
|
| |
if _running_in_bg() or build_opts.nowait:
|
| |
return
|
| |
else:
|
| |
@@ -1209,11 +1215,11 @@
|
| |
try:
|
| |
params = koji.util.parse_maven_param(build_opts.inis, scratch=build_opts.scratch,
|
| |
section=build_opts.section)
|
| |
- except ValueError, e:
|
| |
+ except ValueError as e:
|
| |
parser.error(e.args[0])
|
| |
- opts = params.values()[0]
|
| |
+ opts = list(params.values())[0]
|
| |
if opts.get('type') != 'wrapper':
|
| |
- parser.error(_("Section %s does not contain a wrapper-rpm config") % params.keys()[0])
|
| |
+ parser.error(_("Section %s does not contain a wrapper-rpm config") % list(params.keys())[0])
|
| |
url = opts['scmurl']
|
| |
package = opts['buildrequires'][0]
|
| |
target_info = session.getBuildTarget(target, strict=True)
|
| |
@@ -1237,8 +1243,8 @@
|
| |
if build_opts.scratch:
|
| |
opts['scratch'] = True
|
| |
task_id = session.wrapperRPM(build_id, url, target, priority, opts=opts)
|
| |
- print("Created task: %d" % task_id)
|
| |
- print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
|
| |
+ print(("Created task: %d" % task_id))
|
| |
+ print(("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)))
|
| |
if _running_in_bg() or build_opts.nowait:
|
| |
return
|
| |
else:
|
| |
@@ -1283,14 +1289,14 @@
|
| |
opts[key] = val
|
| |
try:
|
| |
builds = koji.util.parse_maven_chain(args[1:], scratch=opts.get('scratch'))
|
| |
- except ValueError, e:
|
| |
+ except ValueError as e:
|
| |
parser.error(e.args[0])
|
| |
priority = None
|
| |
if build_opts.background:
|
| |
priority = 5
|
| |
task_id = session.chainMaven(builds, target, opts, priority=priority)
|
| |
- print("Created task: %d" % task_id)
|
| |
- print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
|
| |
+ print(("Created task: %d" % task_id))
|
| |
+ print(("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)))
|
| |
if _running_in_bg() or build_opts.nowait:
|
| |
return
|
| |
else:
|
| |
@@ -1317,7 +1323,7 @@
|
| |
_printTaskInfo(session, taskID, 0, False, True)
|
| |
newID = session.resubmitTask(taskID)
|
| |
if not options.quiet:
|
| |
- print("Resubmitted task %s as new task %s" % (taskID, newID))
|
| |
+ print(("Resubmitted task %s as new task %s" % (taskID, newID)))
|
| |
if _running_in_bg() or options.nowait:
|
| |
return
|
| |
else:
|
| |
@@ -1410,10 +1416,10 @@
|
| |
parser.error(_("Task id must be an integer"))
|
| |
broots = session.listBuildroots(taskID=task_id)
|
| |
if not broots:
|
| |
- print(_("No buildroots for task %s (or no such task)") % options.task)
|
| |
+ print((_("No buildroots for task %s (or no such task)") % options.task))
|
| |
return 1
|
| |
if len(broots) > 1:
|
| |
- print(_("Multiple buildroots found: %s" % [br['id'] for br in broots]))
|
| |
+ print((_("Multiple buildroots found: %s" % [br['id'] for br in broots])))
|
| |
brootinfo = broots[-1]
|
| |
if options.latest:
|
| |
opts['repoid'] = 'latest'
|
| |
@@ -1424,7 +1430,7 @@
|
| |
def_name = "%s-task_%i" % (opts['tag_name'], task_id)
|
| |
elif options.tag:
|
| |
if not options.arch:
|
| |
- print(_("Please specify an arch"))
|
| |
+ print((_("Please specify an arch")))
|
| |
return 1
|
| |
tag = session.getTag(options.tag)
|
| |
if not tag:
|
| |
@@ -1432,7 +1438,7 @@
|
| |
arch = options.arch
|
| |
config = session.getBuildConfig(tag['id'])
|
| |
if not config:
|
| |
- print(_("Could not get config info for tag: %(name)s") % tag)
|
| |
+ print((_("Could not get config info for tag: %(name)s") % tag))
|
| |
return 1
|
| |
opts['tag_name'] = tag['name']
|
| |
if options.latest:
|
| |
@@ -1440,13 +1446,13 @@
|
| |
else:
|
| |
repo = session.getRepo(config['id'])
|
| |
if not repo:
|
| |
- print(_("Could not get a repo for tag: %(name)s") % tag)
|
| |
+ print((_("Could not get a repo for tag: %(name)s") % tag))
|
| |
return 1
|
| |
opts['repoid'] = repo['id']
|
| |
def_name = "%(tag_name)s-repo_%(repoid)s" % opts
|
| |
elif options.target:
|
| |
if not options.arch:
|
| |
- print(_("Please specify an arch"))
|
| |
+ print((_("Please specify an arch")))
|
| |
return 1
|
| |
arch = options.arch
|
| |
target = session.getBuildTarget(options.target)
|
| |
@@ -1458,7 +1464,7 @@
|
| |
else:
|
| |
repo = session.getRepo(target['build_tag'])
|
| |
if not repo:
|
| |
- print(_("Could not get a repo for tag: %(name)s") % opts['tag_name'])
|
| |
+ print((_("Could not get a repo for tag: %(name)s") % opts['tag_name']))
|
| |
return 1
|
| |
opts['repoid'] = repo['id']
|
| |
else:
|
| |
@@ -1470,7 +1476,7 @@
|
| |
name = "%(tag_name)s-repo_%(repoid)s" % opts
|
| |
output = koji.genMockConfig(name, arch, **opts)
|
| |
if options.ofile:
|
| |
- fo = file(options.ofile, 'w')
|
| |
+ fo = open(options.ofile, 'w')
|
| |
fo.write(output)
|
| |
fo.close()
|
| |
else:
|
| |
@@ -1491,7 +1497,7 @@
|
| |
error = False
|
| |
for host, [id] in zip(args, session.multiCall(strict=True)):
|
| |
if not id:
|
| |
- print("Host %s does not exist" % host)
|
| |
+ print(("Host %s does not exist" % host))
|
| |
error = True
|
| |
if error:
|
| |
print("No changes made. Please correct the command line.")
|
| |
@@ -1518,7 +1524,7 @@
|
| |
error = False
|
| |
for host, [id] in zip(args, session.multiCall(strict=True)):
|
| |
if not id:
|
| |
- print("Host %s does not exist" % host)
|
| |
+ print(("Host %s does not exist" % host))
|
| |
error = True
|
| |
if error:
|
| |
print("No changes made. Please correct the command line.")
|
| |
@@ -1555,7 +1561,7 @@
|
| |
|
| |
def linked_upload(localfile, path, name=None):
|
| |
"""Link a file into the (locally writable) workdir, bypassing upload"""
|
| |
- old_umask = os.umask(002)
|
| |
+ old_umask = os.umask(0o002)
|
| |
try:
|
| |
if name is None:
|
| |
name = os.path.basename(localfile)
|
| |
@@ -1565,7 +1571,7 @@
|
| |
# fix uid/gid to keep httpd happy
|
| |
st = os.stat(koji.pathinfo.work())
|
| |
os.chown(dest_dir, st.st_uid, st.st_gid)
|
| |
- print("Linking rpm to: %s" % dst)
|
| |
+ print(("Linking rpm to: %s" % dst))
|
| |
os.link(localfile, dst)
|
| |
finally:
|
| |
os.umask(old_umask)
|
| |
@@ -1604,7 +1610,7 @@
|
| |
nvr = "%(name)s-%(version)s-%(release)s" % koji.parse_NVRA(data['sourcerpm'])
|
| |
to_import.setdefault(nvr,[]).append((path,data))
|
| |
builds_missing = False
|
| |
- nvrs = to_import.keys()
|
| |
+ nvrs = list(to_import.keys())
|
| |
nvrs.sort()
|
| |
for nvr in nvrs:
|
| |
to_import[nvr].sort()
|
| |
@@ -1615,10 +1621,10 @@
|
| |
#no srpm included, check for build
|
| |
binfo = session.getBuild(nvr)
|
| |
if not binfo:
|
| |
- print(_("Missing build or srpm: %s") % nvr)
|
| |
+ print((_("Missing build or srpm: %s") % nvr))
|
| |
builds_missing = True
|
| |
if builds_missing and not options.create_build:
|
| |
- print(_("Aborting import"))
|
| |
+ print((_("Aborting import")))
|
| |
return
|
| |
|
| |
#local function to help us out below
|
| |
@@ -1627,13 +1633,13 @@
|
| |
prev = session.getRPM(rinfo)
|
| |
if prev and not prev.get('external_repo_id', 0):
|
| |
if prev['payloadhash'] == koji.hex_string(data['sigmd5']):
|
| |
- print(_("RPM already imported: %s") % path)
|
| |
+ print((_("RPM already imported: %s") % path))
|
| |
else:
|
| |
- print(_("WARNING: md5sum mismatch for %s") % path)
|
| |
- print(_("Skipping import"))
|
| |
+ print((_("WARNING: md5sum mismatch for %s") % path))
|
| |
+ print((_("Skipping import")))
|
| |
return
|
| |
if options.test:
|
| |
- print(_("Test mode -- skipping import for %s") % path)
|
| |
+ print((_("Test mode -- skipping import for %s") % path))
|
| |
return
|
| |
serverdir = _unique_path('cli-import')
|
| |
if options.link:
|
| |
@@ -1642,17 +1648,17 @@
|
| |
sys.stdout.write(_("uploading %s... ") % path)
|
| |
sys.stdout.flush()
|
| |
session.uploadWrapper(path, serverdir)
|
| |
- print(_("done"))
|
| |
+ print((_("done")))
|
| |
sys.stdout.flush()
|
| |
sys.stdout.write(_("importing %s... ") % path)
|
| |
sys.stdout.flush()
|
| |
try:
|
| |
session.importRPM(serverdir, os.path.basename(path))
|
| |
- except koji.GenericError, e:
|
| |
- print(_("\nError importing: %s" % str(e).splitlines()[-1]))
|
| |
+ except koji.GenericError as e:
|
| |
+ print((_("\nError importing: %s" % str(e).splitlines()[-1])))
|
| |
sys.stdout.flush()
|
| |
else:
|
| |
- print(_("done"))
|
| |
+ print((_("done")))
|
| |
sys.stdout.flush()
|
| |
|
| |
for nvr in nvrs:
|
| |
@@ -1665,10 +1671,10 @@
|
| |
need_build = False
|
| |
elif b_state in ['FAILED', 'CANCELED']:
|
| |
if not options.create_build:
|
| |
- print(_("Build %s state is %s. Skipping import") % (nvr, b_state))
|
| |
+ print((_("Build %s state is %s. Skipping import") % (nvr, b_state)))
|
| |
continue
|
| |
else:
|
| |
- print(_("Build %s exists with state=%s. Skipping import") % (nvr, b_state))
|
| |
+ print((_("Build %s exists with state=%s. Skipping import") % (nvr, b_state)))
|
| |
continue
|
| |
|
| |
# import srpms first, if any
|
| |
@@ -1676,7 +1682,7 @@
|
| |
if data['sourcepackage']:
|
| |
if binfo and b_state != 'COMPLETE':
|
| |
# need to fix the state
|
| |
- print(_("Creating empty build: %s") % nvr)
|
| |
+ print((_("Creating empty build: %s") % nvr))
|
| |
b_data = koji.util.dslice(binfo, ['name', 'version', 'release'])
|
| |
b_data['epoch'] = data['epoch']
|
| |
session.createEmptyBuild(**b_data)
|
| |
@@ -1690,11 +1696,11 @@
|
| |
if binfo:
|
| |
# should have caught this earlier, but just in case...
|
| |
b_state = koji.BUILD_STATES[binfo['state']]
|
| |
- print(_("Build %s state is %s. Skipping import") % (nvr, b_state))
|
| |
+ print((_("Build %s state is %s. Skipping import") % (nvr, b_state)))
|
| |
continue
|
| |
else:
|
| |
- print(_("No such build: %s (include matching srpm or use "
|
| |
- "--create-build option to add it)") % nvr)
|
| |
+ print((_("No such build: %s (include matching srpm or use "
|
| |
+ "--create-build option to add it)") % nvr))
|
| |
continue
|
| |
else:
|
| |
# let's make a new build
|
| |
@@ -1706,9 +1712,9 @@
|
| |
data = to_import[nvr][0][1]
|
| |
b_data['epoch'] = data['epoch']
|
| |
if options.test:
|
| |
- print(_("Test mode -- would have created empty build: %s") % nvr)
|
| |
+ print((_("Test mode -- would have created empty build: %s") % nvr))
|
| |
else:
|
| |
- print(_("Creating empty build: %s") % nvr)
|
| |
+ print((_("Creating empty build: %s") % nvr))
|
| |
session.createEmptyBuild(**b_data)
|
| |
binfo = session.getBuild(nvr)
|
| |
|
| |
@@ -1735,9 +1741,9 @@
|
| |
parser.error(_("Unable to find json module"))
|
| |
assert False # pragma: no cover
|
| |
activate_session(session)
|
| |
- metadata = json.load(file(args[0], 'r'))
|
| |
+ metadata = json.load(open(args[0], 'r'))
|
| |
if 'output' not in metadata:
|
| |
- print(_("Metadata contains no output"))
|
| |
+ print((_("Metadata contains no output")))
|
| |
sys.exit(1)
|
| |
localdir = args[1]
|
| |
|
| |
@@ -1766,7 +1772,7 @@
|
| |
if options.link:
|
| |
linked_upload(localpath, relpath)
|
| |
else:
|
| |
- print("Uploading %s" % localpath)
|
| |
+ print(("Uploading %s" % localpath))
|
| |
session.uploadWrapper(localpath, relpath, callback=callback)
|
| |
if callback:
|
| |
print('')
|
| |
@@ -1788,7 +1794,7 @@
|
| |
# check if the tag exists
|
| |
dsttag = session.getTag(args[1])
|
| |
if dsttag is None:
|
| |
- print("No such tag: %s" % args[1])
|
| |
+ print(("No such tag: %s" % args[1]))
|
| |
return 1
|
| |
if libcomps is not None:
|
| |
_import_comps(session, args[0], args[1], local_options)
|
| |
@@ -1812,7 +1818,7 @@
|
| |
libcomps.PACKAGE_TYPE_UNKNOWN : 'unknown',
|
| |
}
|
| |
for group in comps.groups:
|
| |
- print("Group: %s (%s)" % (group.id, group.name))
|
| |
+ print(("Group: %s (%s)" % (group.id, group.name)))
|
| |
session.groupListAdd(
|
| |
tag, group.id, force=force, display_name=group.name,
|
| |
is_default=bool(group.default),
|
| |
@@ -1826,7 +1832,7 @@
|
| |
}
|
| |
if pkg.type == libcomps.PACKAGE_TYPE_CONDITIONAL:
|
| |
pkgopts['requires'] = pkg.requires
|
| |
- print(" Package: %s: %r" % (pkg.name, pkgopts))
|
| |
+ print((" Package: %s: %r" % (pkg.name, pkgopts)))
|
| |
session.groupPackageListAdd(tag, group.id, pkg.name, force=force, **pkgopts)
|
| |
# libcomps does not support group dependencies
|
| |
# libcomps does not support metapkgs
|
| |
@@ -1839,7 +1845,7 @@
|
| |
comps.add(filename)
|
| |
force = options.force
|
| |
for group in comps.groups:
|
| |
- print("Group: %(groupid)s (%(name)s)" % vars(group))
|
| |
+ print(("Group: %(groupid)s (%(name)s)" % vars(group)))
|
| |
session.groupListAdd(tag, group.groupid, force=force, display_name=group.name,
|
| |
is_default=bool(group.default),
|
| |
uservisible=bool(group.user_visible),
|
| |
@@ -1855,7 +1861,7 @@
|
| |
if ptype == 'conditional':
|
| |
pkgopts['requires'] = pdata[pkg]
|
| |
#yum.comps does not support basearchonly
|
| |
- print(" Package: %s: %r" % (pkg, pkgopts))
|
| |
+ print((" Package: %s: %r" % (pkg, pkgopts)))
|
| |
session.groupPackageListAdd(tag, group.groupid, pkg, force=force, **pkgopts)
|
| |
#yum.comps does not support group dependencies
|
| |
#yum.comps does not support metapkgs
|
| |
@@ -1888,7 +1894,7 @@
|
| |
if not sigkey:
|
| |
sigkey = ""
|
| |
if not options.with_unsigned:
|
| |
- print(_("Skipping unsigned package: %s" % path))
|
| |
+ print((_("Skipping unsigned package: %s" % path)))
|
| |
continue
|
| |
else:
|
| |
sigkey = koji.get_sigpacket_key_id(sigkey)
|
| |
@@ -1896,10 +1902,10 @@
|
| |
del data['sigpgp']
|
| |
rinfo = session.getRPM(data)
|
| |
if not rinfo:
|
| |
- print("No such rpm in system: %(name)s-%(version)s-%(release)s.%(arch)s" % data)
|
| |
+ print(("No such rpm in system: %(name)s-%(version)s-%(release)s.%(arch)s" % data))
|
| |
continue
|
| |
if rinfo.get('external_repo_id'):
|
| |
- print("Skipping external rpm: %(name)s-%(version)s-%(release)s.%(arch)s@%(external_repo_name)s" % rinfo)
|
| |
+ print(("Skipping external rpm: %(name)s-%(version)s-%(release)s.%(arch)s@%(external_repo_name)s" % rinfo))
|
| |
continue
|
| |
sighdr = koji.rip_rpm_sighdr(path)
|
| |
previous = session.queryRPMSigs(rpm_id=rinfo['id'], sigkey=sigkey)
|
| |
@@ -1907,12 +1913,12 @@
|
| |
if previous:
|
| |
sighash = md5_constructor(sighdr).hexdigest()
|
| |
if previous[0]['sighash'] == sighash:
|
| |
- print(_("Signature already imported: %s") % path)
|
| |
+ print((_("Signature already imported: %s") % path))
|
| |
continue
|
| |
else:
|
| |
- print(_("Warning: signature mismatch: %s") % path)
|
| |
+ print((_("Warning: signature mismatch: %s") % path))
|
| |
continue
|
| |
- print(_("Importing signature [key %s] from %s...") % (sigkey, path))
|
| |
+ print((_("Importing signature [key %s] from %s...") % (sigkey, path)))
|
| |
if not options.test:
|
| |
session.addRPMSig(rinfo['id'], base64.encodestring(sighdr))
|
| |
|
| |
@@ -1936,7 +1942,7 @@
|
| |
rpms = session.queryRPMSigs(sigkey=key)
|
| |
count = 1
|
| |
for rpm in rpms:
|
| |
- print("%d/%d" % (count, len(rpms)))
|
| |
+ print(("%d/%d" % (count, len(rpms))))
|
| |
count += 1
|
| |
session.writeSignedRPM(rpm['rpm_id'], key)
|
| |
elif options.buildid:
|
| |
@@ -1982,18 +1988,18 @@
|
| |
#(with the modification that we check to see if the build was latest within
|
| |
#the last N days)
|
| |
if options.ignore_tag_file:
|
| |
- fo = file(options.ignore_tag_file)
|
| |
+ fo = open(options.ignore_tag_file)
|
| |
options.ignore_tag.extend([line.strip() for line in fo.readlines()])
|
| |
fo.close()
|
| |
if options.protect_tag_file:
|
| |
- fo = file(options.protect_tag_file)
|
| |
+ fo = open(options.protect_tag_file)
|
| |
options.protect_tag.extend([line.strip() for line in fo.readlines()])
|
| |
fo.close()
|
| |
if options.debug:
|
| |
options.verbose = True
|
| |
cutoff_ts = time.time() - options.days * 24 * 3600
|
| |
if options.debug:
|
| |
- print("Cutoff date: %s" % time.asctime(time.localtime(cutoff_ts)))
|
| |
+ print(("Cutoff date: %s" % time.asctime(time.localtime(cutoff_ts))))
|
| |
if not options.build:
|
| |
if options.verbose:
|
| |
print("Getting builds...")
|
| |
@@ -2003,7 +2009,7 @@
|
| |
qopts['packageID'] = pkginfo['id']
|
| |
builds = [(b['nvr'], b) for b in session.listBuilds(**qopts)]
|
| |
if options.verbose:
|
| |
- print("...got %i builds" % len(builds))
|
| |
+ print(("...got %i builds" % len(builds)))
|
| |
builds.sort()
|
| |
else:
|
| |
#single build
|
| |
@@ -2034,7 +2040,7 @@
|
| |
if 'name' not in binfo:
|
| |
binfo['name'] = binfo['package_name']
|
| |
if options.debug:
|
| |
- print("DEBUG: %s" % nvr)
|
| |
+ print(("DEBUG: %s" % nvr))
|
| |
#see how recently this build was latest for a tag
|
| |
is_latest = False
|
| |
is_protected = False
|
| |
@@ -2045,17 +2051,17 @@
|
| |
#that the build was recently untagged from
|
| |
tags.setdefault(entry['tag_name'], 1)
|
| |
if options.debug:
|
| |
- print("Tags: %s" % tags.keys())
|
| |
+ print(("Tags: %s" % list(tags.keys())))
|
| |
for tag_name in tags:
|
| |
if tag_name == options.trashcan_tag:
|
| |
if options.debug:
|
| |
- print("Ignoring trashcan tag for build %s" % nvr)
|
| |
+ print(("Ignoring trashcan tag for build %s" % nvr))
|
| |
continue
|
| |
ignore_tag = False
|
| |
for pattern in options.ignore_tag:
|
| |
if fnmatch.fnmatch(tag_name, pattern):
|
| |
if options.debug:
|
| |
- print("Ignoring tag %s for build %s" % (tag_name, nvr))
|
| |
+ print(("Ignoring tag %s for build %s" % (tag_name, nvr)))
|
| |
ignore_tag = True
|
| |
break
|
| |
if ignore_tag:
|
| |
@@ -2077,7 +2083,7 @@
|
| |
timeline.sort()
|
| |
#find most recent creation entry for our build and crop there
|
| |
latest_ts = None
|
| |
- for i in xrange(len(timeline)-1, -1, -1):
|
| |
+ for i in range(len(timeline)-1, -1, -1):
|
| |
#searching in reverse cronological order
|
| |
event_id, is_create, entry = timeline[i]
|
| |
if entry['build_id'] == binfo['id'] and is_create:
|
| |
@@ -2088,13 +2094,13 @@
|
| |
raise koji.GenericError("No creation event found for %s in %s" % (nvr, tag_name))
|
| |
our_entry = entry
|
| |
if options.debug:
|
| |
- print(_histline(event_id, our_entry))
|
| |
+ print((_histline(event_id, our_entry)))
|
| |
#now go through the events since most recent creation entry
|
| |
timeline = timeline[i+1:]
|
| |
if not timeline:
|
| |
is_latest = True
|
| |
if options.debug:
|
| |
- print("%s is latest in tag %s" % (nvr, tag_name))
|
| |
+ print(("%s is latest in tag %s" % (nvr, tag_name)))
|
| |
break
|
| |
#before we go any further, is this a protected tag?
|
| |
protect_tag = False
|
| |
@@ -2109,14 +2115,14 @@
|
| |
if our_entry['revoke_event'] is None:
|
| |
#we're still tagged with a protected tag
|
| |
if options.debug:
|
| |
- print("Build %s has protected tag %s" % (nvr, tag_name))
|
| |
+ print(("Build %s has protected tag %s" % (nvr, tag_name)))
|
| |
is_protected = True
|
| |
break
|
| |
elif our_entry['revoke_ts'] > cutoff_ts:
|
| |
#we were still tagged here sometime before the cutoff
|
| |
if options.debug:
|
| |
- print("Build %s had protected tag %s until %s" \
|
| |
- % (nvr, tag_name, time.asctime(time.localtime(our_entry['revoke_ts']))))
|
| |
+ print(("Build %s had protected tag %s until %s" \
|
| |
+ % (nvr, tag_name, time.asctime(time.localtime(our_entry['revoke_ts'])))))
|
| |
is_protected = True
|
| |
break
|
| |
replaced_ts = None
|
| |
@@ -2129,7 +2135,7 @@
|
| |
#Note however that if the superceding entry is itself revoked, then
|
| |
#our build could become latest again
|
| |
if options.debug:
|
| |
- print(_histline(event_id, entry))
|
| |
+ print((_histline(event_id, entry)))
|
| |
if entry['build_id'] == binfo['id']:
|
| |
if is_create:
|
| |
#shouldn't happen
|
| |
@@ -2168,31 +2174,31 @@
|
| |
#turns out we are still latest
|
| |
is_latest = True
|
| |
if options.debug:
|
| |
- print("%s is latest (again) in tag %s" % (nvr, tag_name))
|
| |
+ print(("%s is latest (again) in tag %s" % (nvr, tag_name)))
|
| |
break
|
| |
else:
|
| |
#replaced (but not revoked)
|
| |
timestamps.append(replaced_ts)
|
| |
if options.debug:
|
| |
- print("tag %s: %s not latest (replaced %s)" \
|
| |
- % (tag_name, nvr, time.asctime(time.localtime(replaced_ts))))
|
| |
+ print(("tag %s: %s not latest (replaced %s)" \
|
| |
+ % (tag_name, nvr, time.asctime(time.localtime(replaced_ts)))))
|
| |
elif replaced_ts is None:
|
| |
#revoked but not replaced
|
| |
timestamps.append(revoke_ts)
|
| |
if options.debug:
|
| |
- print("tag %s: %s not latest (revoked %s)" \
|
| |
- % (tag_name, nvr, time.asctime(time.localtime(revoke_ts))))
|
| |
+ print(("tag %s: %s not latest (revoked %s)" \
|
| |
+ % (tag_name, nvr, time.asctime(time.localtime(revoke_ts)))))
|
| |
else:
|
| |
#revoked AND replaced
|
| |
timestamps.append(min(revoke_ts, replaced_ts))
|
| |
if options.debug:
|
| |
- print("tag %s: %s not latest (revoked %s, replaced %s)" \
|
| |
+ print(("tag %s: %s not latest (revoked %s, replaced %s)" \
|
| |
% (tag_name, nvr, time.asctime(time.localtime(revoke_ts)),
|
| |
- time.asctime(time.localtime(replaced_ts))))
|
| |
+ time.asctime(time.localtime(replaced_ts)))))
|
| |
last_latest = max(timestamps)
|
| |
if last_latest > cutoff_ts:
|
| |
if options.debug:
|
| |
- print("%s was latest past the cutoff" % nvr)
|
| |
+ print(("%s was latest past the cutoff" % nvr))
|
| |
is_latest = True
|
| |
break
|
| |
if is_latest:
|
| |
@@ -2215,7 +2221,7 @@
|
| |
build_space = 0
|
| |
if not by_sig and options.debug:
|
| |
print("(build has no signatures)")
|
| |
- for sigkey, rpms in by_sig.iteritems():
|
| |
+ for sigkey, rpms in by_sig.items():
|
| |
mycount = 0
|
| |
archdirs = {}
|
| |
sigdirs = {}
|
| |
@@ -2227,21 +2233,21 @@
|
| |
continue
|
| |
if not stat.S_ISREG(st.st_mode):
|
| |
#warn about this
|
| |
- print("Skipping %s. Not a regular file" % signedpath)
|
| |
+ print(("Skipping %s. Not a regular file" % signedpath))
|
| |
continue
|
| |
if st.st_mtime > cutoff_ts:
|
| |
- print("Skipping %s. File newer than cutoff" % signedpath)
|
| |
+ print(("Skipping %s. File newer than cutoff" % signedpath))
|
| |
continue
|
| |
if options.test:
|
| |
- print("Would have unlinked: %s" % signedpath)
|
| |
+ print(("Would have unlinked: %s" % signedpath))
|
| |
else:
|
| |
if options.verbose:
|
| |
- print("Unlinking: %s" % signedpath)
|
| |
+ print(("Unlinking: %s" % signedpath))
|
| |
try:
|
| |
os.unlink(signedpath)
|
| |
- except OSError, e:
|
| |
- print("Error removing %s: %s" % (signedpath, e))
|
| |
- print("This script needs write access to %s" % koji.BASEDIR)
|
| |
+ except OSError as e:
|
| |
+ print(("Error removing %s: %s" % (signedpath, e)))
|
| |
+ print(("This script needs write access to %s" % koji.BASEDIR))
|
| |
continue
|
| |
mycount +=1
|
| |
build_files += 1
|
| |
@@ -2253,38 +2259,38 @@
|
| |
sigdirs[os.path.dirname(mydir)] = 1
|
| |
for dir in archdirs:
|
| |
if options.test:
|
| |
- print("Would have removed dir: %s" % dir)
|
| |
+ print(("Would have removed dir: %s" % dir))
|
| |
else:
|
| |
if options.verbose:
|
| |
- print("Removing dir: %s" % dir)
|
| |
+ print(("Removing dir: %s" % dir))
|
| |
try:
|
| |
os.rmdir(dir)
|
| |
- except OSError, e:
|
| |
- print("Error removing %s: %s" % (signedpath, e))
|
| |
+ except OSError as e:
|
| |
+ print(("Error removing %s: %s" % (signedpath, e)))
|
| |
if len(sigdirs) == 1:
|
| |
- dir = sigdirs.keys()[0]
|
| |
+ dir = list(sigdirs.keys())[0]
|
| |
if options.test:
|
| |
- print("Would have removed dir: %s" % dir)
|
| |
+ print(("Would have removed dir: %s" % dir))
|
| |
else:
|
| |
if options.verbose:
|
| |
- print("Removing dir: %s" % dir)
|
| |
+ print(("Removing dir: %s" % dir))
|
| |
try:
|
| |
os.rmdir(dir)
|
| |
- except OSError, e:
|
| |
- print("Error removing %s: %s" % (signedpath, e))
|
| |
+ except OSError as e:
|
| |
+ print(("Error removing %s: %s" % (signedpath, e)))
|
| |
elif len(sigdirs) > 1:
|
| |
- print("Warning: more than one signature dir for %s: %r" % (sigkey, sigdirs))
|
| |
+ print(("Warning: more than one signature dir for %s: %r" % (sigkey, sigdirs)))
|
| |
if build_files:
|
| |
total_files += build_files
|
| |
total_space += build_space
|
| |
if options.verbose:
|
| |
- print("Build: %s, Removed %i signed copies (%i bytes). Total: %i/%i" \
|
| |
- % (nvr, build_files, build_space, total_files, total_space))
|
| |
+ print(("Build: %s, Removed %i signed copies (%i bytes). Total: %i/%i" \
|
| |
+ % (nvr, build_files, build_space, total_files, total_space)))
|
| |
elif options.debug and by_sig:
|
| |
print("(build has no signed copies)")
|
| |
print("--- Grand Totals ---")
|
| |
- print("Files: %i" % total_files)
|
| |
- print("Bytes: %i" % total_space)
|
| |
+ print(("Files: %i" % total_files))
|
| |
+ print(("Bytes: %i" % total_space))
|
| |
|
| |
def handle_set_build_volume(options, session, args):
|
| |
"[admin] Move a build to a different volume"
|
| |
@@ -2295,16 +2301,16 @@
|
| |
(options, args) = parser.parse_args(args)
|
| |
volinfo = session.getVolume(args[0])
|
| |
if not volinfo:
|
| |
- print("No such volume: %s" % args[0])
|
| |
+ print(("No such volume: %s" % args[0]))
|
| |
return 1
|
| |
activate_session(session)
|
| |
builds = []
|
| |
for nvr in args[1:]:
|
| |
binfo = session.getBuild(nvr)
|
| |
if not binfo:
|
| |
- print("No such build: %s" % nvr)
|
| |
+ print(("No such build: %s" % nvr))
|
| |
elif binfo['volume_id'] == volinfo['id']:
|
| |
- print("Build %s already on volume %s" %(nvr, volinfo['name']))
|
| |
+ print(("Build %s already on volume %s" %(nvr, volinfo['name'])))
|
| |
else:
|
| |
builds.append(binfo)
|
| |
if not builds:
|
| |
@@ -2313,7 +2319,7 @@
|
| |
for binfo in builds:
|
| |
session.changeBuildVolume(binfo['id'], volinfo['id'])
|
| |
if options.verbose:
|
| |
- print("%s: %s -> %s" % (binfo['nvr'], binfo['volume_name'], volinfo['name']))
|
| |
+ print(("%s: %s -> %s" % (binfo['nvr'], binfo['volume_name'], volinfo['name'])))
|
| |
|
| |
def handle_add_volume(options, session, args):
|
| |
"[admin] Add a new storage volume"
|
| |
@@ -2326,11 +2332,11 @@
|
| |
name = args[0]
|
| |
volinfo = session.getVolume(name)
|
| |
if volinfo:
|
| |
- print("Volume %s already exists" % name)
|
| |
+ print(("Volume %s already exists" % name))
|
| |
return 1
|
| |
activate_session(session)
|
| |
volinfo = session.addVolume(name)
|
| |
- print("Added volume %(name)s with id %(id)i" % volinfo)
|
| |
+ print(("Added volume %(name)s with id %(id)i" % volinfo))
|
| |
|
| |
def handle_list_volumes(options, session, args):
|
| |
"[info] List storage volumes"
|
| |
@@ -2339,7 +2345,7 @@
|
| |
parser = OptionParser(usage=usage)
|
| |
(options, args) = parser.parse_args(args)
|
| |
for volinfo in session.listVolumes():
|
| |
- print(volinfo['name'])
|
| |
+ print((volinfo['name']))
|
| |
|
| |
def handle_list_permissions(options, session, args):
|
| |
"[info] List user permissions"
|
| |
@@ -2356,7 +2362,7 @@
|
| |
if options.user:
|
| |
user = session.getUser(options.user)
|
| |
if not user:
|
| |
- print("User %s does not exist" % options.user)
|
| |
+ print(("User %s does not exist" % options.user))
|
| |
return 1
|
| |
perms = session.getUserPerms(user['id'])
|
| |
elif options.mine:
|
| |
@@ -2385,7 +2391,7 @@
|
| |
status = koji.USER_STATUS['NORMAL']
|
| |
activate_session(session)
|
| |
user_id = session.createUser(username, status=status, krb_principal=options.principal)
|
| |
- print("Added user %s (%i)" % (username, user_id))
|
| |
+ print(("Added user %s (%i)" % (username, user_id)))
|
| |
|
| |
def handle_enable_user(options, session, args):
|
| |
"[admin] Enable logins by a user"
|
| |
@@ -2438,7 +2444,7 @@
|
| |
if rinfo is None:
|
| |
parser.error(_("No such RPM: %s") % options.rpm)
|
| |
if rinfo.get('external_repo_id'):
|
| |
- print("External rpm: %(name)s-%(version)s-%(release)s.%(arch)s@%(external_repo_name)s" % rinfo)
|
| |
+ print(("External rpm: %(name)s-%(version)s-%(release)s.%(arch)s@%(external_repo_name)s" % rinfo))
|
| |
return 1
|
| |
qopts['rpm_id'] = rinfo['id']
|
| |
if options.build:
|
| |
@@ -2483,7 +2489,7 @@
|
| |
signedpath = "%s/%s" % (builddir, koji.pathinfo.signed(rinfo, sigkey))
|
| |
if not os.path.exists(signedpath):
|
| |
if options.debug:
|
| |
- print("No copy: %s" % signedpath)
|
| |
+ print(("No copy: %s" % signedpath))
|
| |
continue
|
| |
print(signedpath)
|
| |
|
| |
@@ -2502,11 +2508,11 @@
|
| |
sys.stdout.write(_("importing %s... ") % nvr)
|
| |
try:
|
| |
session.importBuildInPlace(data)
|
| |
- except koji.GenericError, e:
|
| |
- print(_("\nError importing: %s" % str(e).splitlines()[-1]))
|
| |
+ except koji.GenericError as e:
|
| |
+ print((_("\nError importing: %s" % str(e).splitlines()[-1])))
|
| |
sys.stdout.flush()
|
| |
else:
|
| |
- print(_("done"))
|
| |
+ print((_("done")))
|
| |
sys.stdout.flush()
|
| |
|
| |
def handle_import_archive(options, session, args):
|
| |
@@ -2598,7 +2604,7 @@
|
| |
|
| |
for filepath in args[1:]:
|
| |
filename = os.path.basename(filepath)
|
| |
- print("Uploading archive: %s" % filename)
|
| |
+ print(("Uploading archive: %s" % filename))
|
| |
serverdir = _unique_path('cli-import')
|
| |
if _running_in_bg() or suboptions.noprogress:
|
| |
callback = None
|
| |
@@ -2611,7 +2617,7 @@
|
| |
print('')
|
| |
serverpath = "%s/%s" % (serverdir, filename)
|
| |
session.importArchive(serverpath, buildinfo, suboptions.type, suboptions.type_info)
|
| |
- print("Imported: %s" % filename)
|
| |
+ print(("Imported: %s" % filename))
|
| |
|
| |
def handle_grant_permission(options, session, args):
|
| |
"[admin] Grant a permission to a user"
|
| |
@@ -2765,11 +2771,11 @@
|
| |
fmt = "%(nvr)-40s %(tag_name)-20s %(owner_name)s"
|
| |
if not options.quiet:
|
| |
if options.type == 'maven':
|
| |
- print("%-40s %-20s %-20s %-20s %s" % ("Build", "Tag", "Group Id", "Artifact Id", "Built by"))
|
| |
- print("%s %s %s %s %s" % ("-"*40, "-"*20, "-"*20, "-"*20, "-"*16))
|
| |
+ print(("%-40s %-20s %-20s %-20s %s" % ("Build", "Tag", "Group Id", "Artifact Id", "Built by")))
|
| |
+ print(("%s %s %s %s %s" % ("-"*40, "-"*20, "-"*20, "-"*20, "-"*16)))
|
| |
else:
|
| |
- print("%-40s %-20s %s" % ("Build","Tag","Built by"))
|
| |
- print("%s %s %s" % ("-"*40, "-"*20, "-"*16))
|
| |
+ print(("%-40s %-20s %s" % ("Build","Tag","Built by")))
|
| |
+ print(("%s %s %s" % ("-"*40, "-"*20, "-"*16)))
|
| |
options.quiet = True
|
| |
|
| |
output = [ fmt % x for x in data]
|
| |
@@ -2805,9 +2811,9 @@
|
| |
args = "(%s)" % ", ".join(expanded)
|
| |
else:
|
| |
args = "()"
|
| |
- print('%s%s' % (x['name'], args))
|
| |
+ print(('%s%s' % (x['name'], args)))
|
| |
if x['doc']:
|
| |
- print(" description: %s" % x['doc'])
|
| |
+ print((" description: %s" % x['doc']))
|
| |
|
| |
def anon_handle_list_tagged(options, session, args):
|
| |
"[info] List the builds or rpms in a tag"
|
| |
@@ -2858,7 +2864,7 @@
|
| |
if event:
|
| |
opts['event'] = event['id']
|
| |
event['timestr'] = time.asctime(time.localtime(event['ts']))
|
| |
- print("Querying at event %(id)i (%(timestr)s)" % event)
|
| |
+ print(("Querying at event %(id)i (%(timestr)s)" % event))
|
| |
|
| |
if options.rpms:
|
| |
rpms, builds = session.listTaggedRPMS(tag, **opts)
|
| |
@@ -2899,11 +2905,11 @@
|
| |
fmt = "%(nvr)-40s %(tag_name)-20s %(owner_name)s"
|
| |
if not options.quiet:
|
| |
if options.type == 'maven':
|
| |
- print("%-40s %-20s %-20s %-20s %s" % ("Build", "Tag", "Group Id", "Artifact Id", "Built by"))
|
| |
- print("%s %s %s %s %s" % ("-"*40, "-"*20, "-"*20, "-"*20, "-"*16))
|
| |
+ print(("%-40s %-20s %-20s %-20s %s" % ("Build", "Tag", "Group Id", "Artifact Id", "Built by")))
|
| |
+ print(("%s %s %s %s %s" % ("-"*40, "-"*20, "-"*20, "-"*20, "-"*16)))
|
| |
else:
|
| |
- print("%-40s %-20s %s" % ("Build","Tag","Built by"))
|
| |
- print("%s %s %s" % ("-"*40, "-"*20, "-"*16))
|
| |
+ print(("%-40s %-20s %s" % ("Build","Tag","Built by")))
|
| |
+ print(("%s %s %s" % ("-"*40, "-"*20, "-"*16)))
|
| |
|
| |
output = [ fmt % x for x in data]
|
| |
output.sort()
|
| |
@@ -2936,7 +2942,7 @@
|
| |
order.sort()
|
| |
for nvra, rinfo in order:
|
| |
if options.verbose and rinfo.get('is_update'):
|
| |
- print(nvra, "[update]")
|
| |
+ print((nvra, "[update]"))
|
| |
else:
|
| |
print(nvra)
|
| |
|
| |
@@ -2991,10 +2997,10 @@
|
| |
print(line)
|
| |
|
| |
def print_group_list_req_group(group):
|
| |
- print(" @%(name)s [%(tag_name)s]" % group)
|
| |
+ print((" @%(name)s [%(tag_name)s]" % group))
|
| |
|
| |
def print_group_list_req_package(pkg):
|
| |
- print(" %(package)s: %(basearchonly)s, %(type)s [%(tag_name)s]" % pkg)
|
| |
+ print((" %(package)s: %(basearchonly)s, %(type)s [%(tag_name)s]" % pkg))
|
| |
|
| |
def anon_handle_list_groups(options, session, args):
|
| |
"[info] Print the group listings"
|
| |
@@ -3014,7 +3020,7 @@
|
| |
if event:
|
| |
opts['event'] = event['id']
|
| |
event['timestr'] = time.asctime(time.localtime(event['ts']))
|
| |
- print("Querying at event %(id)i (%(timestr)s)" % event)
|
| |
+ print(("Querying at event %(id)i (%(timestr)s)" % event))
|
| |
tags = dict([(x['id'], x['name']) for x in session.listTags()])
|
| |
tmp_list = [(x['name'], x) for x in session.getTagGroups(args[0], **opts)]
|
| |
tmp_list.sort()
|
| |
@@ -3022,7 +3028,7 @@
|
| |
for group in groups:
|
| |
if len(args) > 1 and group['name'] != args[1]:
|
| |
continue
|
| |
- print("%s [%s]" % (group['name'], tags.get(group['tag_id'], group['tag_id'])))
|
| |
+ print(("%s [%s]" % (group['name'], tags.get(group['tag_id'], group['tag_id']))))
|
| |
groups = [(x['name'], x) for x in group['grouplist']]
|
| |
groups.sort()
|
| |
for x in [x[1] for x in groups]:
|
| |
@@ -3177,7 +3183,7 @@
|
| |
if not options.quiet:
|
| |
print("Hostname Enb Rdy Load/Cap Arches Last Update")
|
| |
for host in hosts:
|
| |
- print("%(name)-28s %(enabled)-3s %(ready)-3s %(task_load)4.1f/%(capacity)-3.1f %(arches)-16s %(update)s" % host)
|
| |
+ print(("%(name)-28s %(enabled)-3s %(ready)-3s %(task_load)4.1f/%(capacity)-3.1f %(arches)-16s %(update)s" % host))
|
| |
|
| |
def anon_handle_list_pkgs(options, session, args):
|
| |
"[info] Print the package listing for tag or for owner"
|
| |
@@ -3228,7 +3234,7 @@
|
| |
if event:
|
| |
opts['event'] = event['id']
|
| |
event['timestr'] = time.asctime(time.localtime(event['ts']))
|
| |
- print("Querying at event %(id)i (%(timestr)s)" % event)
|
| |
+ print(("Querying at event %(id)i (%(timestr)s)" % event))
|
| |
data = session.listPackages(**opts)
|
| |
if not data:
|
| |
print("(no matching packages)")
|
| |
@@ -3236,13 +3242,13 @@
|
| |
if not options.quiet:
|
| |
if allpkgs:
|
| |
print("Package")
|
| |
- print('-'*23)
|
| |
+ print(('-'*23))
|
| |
else:
|
| |
- print("%-23s %-23s %-16s %-15s" % ('Package','Tag','Extra Arches','Owner'))
|
| |
- print("%s %s %s %s" % ('-'*23,'-'*23,'-'*16,'-'*15))
|
| |
+ print(("%-23s %-23s %-16s %-15s" % ('Package','Tag','Extra Arches','Owner')))
|
| |
+ print(("%s %s %s %s" % ('-'*23,'-'*23,'-'*16,'-'*15)))
|
| |
for pkg in data:
|
| |
if allpkgs:
|
| |
- print(pkg['package_name'])
|
| |
+ print((pkg['package_name']))
|
| |
else:
|
| |
if not options.show_blocked and pkg.get('blocked',False):
|
| |
continue
|
| |
@@ -3254,7 +3260,7 @@
|
| |
fmt += " [BLOCKED]"
|
| |
else:
|
| |
fmt = "%(package_name)s"
|
| |
- print(fmt % pkg)
|
| |
+ print((fmt % pkg))
|
| |
|
| |
def anon_handle_rpminfo(options, session, args):
|
| |
"[info] Print basic information about an RPM"
|
| |
@@ -3270,7 +3276,7 @@
|
| |
for rpm in args:
|
| |
info = session.getRPM(rpm)
|
| |
if info is None:
|
| |
- print("No such rpm: %s\n" % rpm)
|
| |
+ print(("No such rpm: %s\n" % rpm))
|
| |
continue
|
| |
if info['epoch'] is None:
|
| |
info['epoch'] = ""
|
| |
@@ -3284,42 +3290,42 @@
|
| |
buildinfo['epoch'] = ""
|
| |
else:
|
| |
buildinfo['epoch'] = str(buildinfo['epoch']) + ":"
|
| |
- print("RPM: %(epoch)s%(name)s-%(version)s-%(release)s.%(arch)s [%(id)d]" % info)
|
| |
+ print(("RPM: %(epoch)s%(name)s-%(version)s-%(release)s.%(arch)s [%(id)d]" % info))
|
| |
if info.get('external_repo_id'):
|
| |
repo = session.getExternalRepo(info['external_repo_id'])
|
| |
- print("External Repository: %(name)s [%(id)i]" % repo)
|
| |
- print("External Repository url: %(url)s" % repo)
|
| |
+ print(("External Repository: %(name)s [%(id)i]" % repo))
|
| |
+ print(("External Repository url: %(url)s" % repo))
|
| |
else:
|
| |
- print("RPM Path: %s" % os.path.join(koji.pathinfo.build(buildinfo), koji.pathinfo.rpm(info)))
|
| |
- print("SRPM: %(epoch)s%(name)s-%(version)s-%(release)s [%(id)d]" % buildinfo)
|
| |
- print("SRPM Path: %s" % os.path.join(koji.pathinfo.build(buildinfo), koji.pathinfo.rpm(buildinfo)))
|
| |
- print("Built: %s" % time.strftime('%a, %d %b %Y %H:%M:%S %Z', time.localtime(info['buildtime'])))
|
| |
- print("SIGMD5: %(payloadhash)s" % info)
|
| |
- print("Size: %(size)s" % info)
|
| |
+ print(("RPM Path: %s" % os.path.join(koji.pathinfo.build(buildinfo), koji.pathinfo.rpm(info))))
|
| |
+ print(("SRPM: %(epoch)s%(name)s-%(version)s-%(release)s [%(id)d]" % buildinfo))
|
| |
+ print(("SRPM Path: %s" % os.path.join(koji.pathinfo.build(buildinfo), koji.pathinfo.rpm(buildinfo))))
|
| |
+ print(("Built: %s" % time.strftime('%a, %d %b %Y %H:%M:%S %Z', time.localtime(info['buildtime']))))
|
| |
+ print(("SIGMD5: %(payloadhash)s" % info))
|
| |
+ print(("Size: %(size)s" % info))
|
| |
if not info.get('external_repo_id', 0):
|
| |
- print("Build ID: %(build_id)s" % info)
|
| |
+ print(("Build ID: %(build_id)s" % info))
|
| |
if info['buildroot_id'] is None:
|
| |
print("No buildroot data available")
|
| |
else:
|
| |
br_info = session.getBuildroot(info['buildroot_id'])
|
| |
if br_info['br_type'] == koji.BR_TYPES['STANDARD']:
|
| |
- print("Buildroot: %(id)i (tag %(tag_name)s, arch %(arch)s, repo %(repo_id)i)" % br_info)
|
| |
- print("Build Host: %(host_name)s" % br_info)
|
| |
- print("Build Task: %(task_id)i" % br_info)
|
| |
+ print(("Buildroot: %(id)i (tag %(tag_name)s, arch %(arch)s, repo %(repo_id)i)" % br_info))
|
| |
+ print(("Build Host: %(host_name)s" % br_info))
|
| |
+ print(("Build Task: %(task_id)i" % br_info))
|
| |
else:
|
| |
- print("Content generator: %(cg_name)s" % br_info)
|
| |
- print("Buildroot: %(id)i" % br_info)
|
| |
- print("Build Host OS: %(host_os)s (%(host_arch)s)" % br_info)
|
| |
+ print(("Content generator: %(cg_name)s" % br_info))
|
| |
+ print(("Buildroot: %(id)i" % br_info))
|
| |
+ print(("Build Host OS: %(host_os)s (%(host_arch)s)" % br_info))
|
| |
if info.get('extra'):
|
| |
- print("Extra: %(extra)r" % info)
|
| |
+ print(("Extra: %(extra)r" % info))
|
| |
if options.buildroots:
|
| |
br_list = session.listBuildroots(rpmID=info['id'], queryOpts={'order':'buildroot.id'})
|
| |
- print("Used in %i buildroots:" % len(br_list))
|
| |
+ print(("Used in %i buildroots:" % len(br_list)))
|
| |
if len(br_list):
|
| |
- print(" %8s %-28s %-8s %-29s" % ('id','build tag','arch','build host'))
|
| |
- print(" %s %s %s %s" % ('-'*8, '-'*28, '-'*8, '-'*29))
|
| |
+ print((" %8s %-28s %-8s %-29s" % ('id','build tag','arch','build host')))
|
| |
+ print((" %s %s %s %s" % ('-'*8, '-'*28, '-'*8, '-'*29)))
|
| |
for br_info in br_list:
|
| |
- print(" %(id)8i %(tag_name)-28s %(arch)-8s %(host_name)-29s" % br_info)
|
| |
+ print((" %(id)8i %(tag_name)-28s %(arch)-8s %(host_name)-29s" % br_info))
|
| |
|
| |
|
| |
def anon_handle_buildinfo(options, session, args):
|
| |
@@ -3338,7 +3344,7 @@
|
| |
build = int(build)
|
| |
info = session.getBuild(build)
|
| |
if info is None:
|
| |
- print("No such build: %s\n" % build)
|
| |
+ print(("No such build: %s\n" % build))
|
| |
continue
|
| |
task = None
|
| |
if info['task_id']:
|
| |
@@ -3348,43 +3354,43 @@
|
| |
taglist.append(tag['name'])
|
| |
info['arch'] = 'src'
|
| |
info['state'] = koji.BUILD_STATES[info['state']]
|
| |
- print("BUILD: %(name)s-%(version)s-%(release)s [%(id)d]" % info)
|
| |
- print("State: %(state)s" % info)
|
| |
- print("Built by: %(owner_name)s" % info)
|
| |
+ print(("BUILD: %(name)s-%(version)s-%(release)s [%(id)d]" % info))
|
| |
+ print(("State: %(state)s" % info))
|
| |
+ print(("Built by: %(owner_name)s" % info))
|
| |
source = info.get('source')
|
| |
if source is not None:
|
| |
- print("Source: %s" % source)
|
| |
+ print(("Source: %s" % source))
|
| |
if 'volume_name' in info:
|
| |
- print("Volume: %(volume_name)s" % info)
|
| |
+ print(("Volume: %(volume_name)s" % info))
|
| |
if task:
|
| |
- print("Task: %s %s" % (task['id'], koji.taskLabel(task)))
|
| |
+ print(("Task: %s %s" % (task['id'], koji.taskLabel(task))))
|
| |
else:
|
| |
print("Task: none")
|
| |
- print("Finished: %s" % koji.formatTimeLong(info['completion_time']))
|
| |
+ print(("Finished: %s" % koji.formatTimeLong(info['completion_time'])))
|
| |
maven_info = session.getMavenBuild(info['id'])
|
| |
if maven_info:
|
| |
- print("Maven groupId: %s" % maven_info['group_id'])
|
| |
- print("Maven artifactId: %s" % maven_info['artifact_id'])
|
| |
- print("Maven version: %s" % maven_info['version'])
|
| |
+ print(("Maven groupId: %s" % maven_info['group_id']))
|
| |
+ print(("Maven artifactId: %s" % maven_info['artifact_id']))
|
| |
+ print(("Maven version: %s" % maven_info['version']))
|
| |
win_info = session.getWinBuild(info['id'])
|
| |
if win_info:
|
| |
- print("Windows build platform: %s" % win_info['platform'])
|
| |
- print("Tags: %s" % ' '.join(taglist))
|
| |
+ print(("Windows build platform: %s" % win_info['platform']))
|
| |
+ print(("Tags: %s" % ' '.join(taglist)))
|
| |
if info.get('extra'):
|
| |
- print("Extra: %(extra)r" % info)
|
| |
+ print(("Extra: %(extra)r" % info))
|
| |
archives_seen = {}
|
| |
maven_archives = session.listArchives(buildID=info['id'], type='maven')
|
| |
if maven_archives:
|
| |
print("Maven archives:")
|
| |
for archive in maven_archives:
|
| |
archives_seen.setdefault(archive['id'], 1)
|
| |
- print(os.path.join(koji.pathinfo.mavenbuild(info), koji.pathinfo.mavenfile(archive)))
|
| |
+ print((os.path.join(koji.pathinfo.mavenbuild(info), koji.pathinfo.mavenfile(archive))))
|
| |
win_archives = session.listArchives(buildID=info['id'], type='win')
|
| |
if win_archives:
|
| |
print("Windows archives:")
|
| |
for archive in win_archives:
|
| |
archives_seen.setdefault(archive['id'], 1)
|
| |
- print(os.path.join(koji.pathinfo.winbuild(info), koji.pathinfo.winfile(archive)))
|
| |
+ print((os.path.join(koji.pathinfo.winbuild(info), koji.pathinfo.winfile(archive))))
|
| |
rpms = session.listRPMs(buildID=info['id'])
|
| |
image_info = session.getImageBuild(info['id'])
|
| |
img_archives = session.listArchives(buildID=info['id'], type='image')
|
| |
@@ -3392,7 +3398,7 @@
|
| |
print('Image archives:')
|
| |
for archive in img_archives:
|
| |
archives_seen.setdefault(archive['id'], 1)
|
| |
- print(os.path.join(koji.pathinfo.imagebuild(info), archive['filename']))
|
| |
+ print((os.path.join(koji.pathinfo.imagebuild(info), archive['filename'])))
|
| |
archive_idx = {}
|
| |
for archive in session.listArchives(buildID=info['id']):
|
| |
if archive['id'] in archives_seen:
|
| |
@@ -3400,18 +3406,18 @@
|
| |
archive_idx.setdefault(archive['btype'], []).append(archive)
|
| |
for btype in archive_idx:
|
| |
archives = archive_idx[btype]
|
| |
- print('%s Archives:' % btype.capitalize())
|
| |
+ print(('%s Archives:' % btype.capitalize()))
|
| |
for archive in archives:
|
| |
- print(os.path.join(koji.pathinfo.typedir(info, btype), archive['filename']))
|
| |
+ print((os.path.join(koji.pathinfo.typedir(info, btype), archive['filename'])))
|
| |
if rpms:
|
| |
print("RPMs:")
|
| |
for rpm in rpms:
|
| |
- print(os.path.join(koji.pathinfo.build(info), koji.pathinfo.rpm(rpm)))
|
| |
+ print((os.path.join(koji.pathinfo.build(info), koji.pathinfo.rpm(rpm))))
|
| |
if options.changelog:
|
| |
changelog = session.getChangelogEntries(info['id'])
|
| |
if changelog:
|
| |
print("Changelog:")
|
| |
- print(koji.util.formatChangelog(changelog))
|
| |
+ print((koji.util.formatChangelog(changelog)))
|
| |
|
| |
def handle_clone_tag(options, session, args):
|
| |
"[admin] Duplicate the contents of one tag onto another tag"
|
| |
@@ -3452,7 +3458,7 @@
|
| |
activate_session(session)
|
| |
|
| |
if not session.hasPerm('admin') and not options.test:
|
| |
- print(_("This action requires admin privileges"))
|
| |
+ print((_("This action requires admin privileges")))
|
| |
return
|
| |
|
| |
if args[0] == args[1]:
|
| |
@@ -3465,7 +3471,7 @@
|
| |
event = koji.util.eventFromOpts(session, options) or {}
|
| |
if event:
|
| |
event['timestr'] = time.asctime(time.localtime(event['ts']))
|
| |
- print(_("Cloning at event %(id)i (%(timestr)s)") % event)
|
| |
+ print((_("Cloning at event %(id)i (%(timestr)s)") % event))
|
| |
|
| |
# store tags.
|
| |
srctag = session.getTag(args[0])
|
| |
@@ -3474,8 +3480,8 @@
|
| |
sys.stdout.write("Unknown src-tag: %s\n" % args[0])
|
| |
return
|
| |
if (srctag['locked'] and not options.force) or (dsttag and dsttag['locked'] and not options.force):
|
| |
- print(_("Error: You are attempting to clone from or to a tag which is locked."))
|
| |
- print(_("Please use --force if this is what you really want to do."))
|
| |
+ print((_("Error: You are attempting to clone from or to a tag which is locked.")))
|
| |
+ print((_("Please use --force if this is what you really want to do.")))
|
| |
return
|
| |
|
| |
# init debug lists.
|
| |
@@ -3485,7 +3491,7 @@
|
| |
# case of brand new dst-tag.
|
| |
if not dsttag:
|
| |
if not options.config:
|
| |
- print(_('Cannot create tag without specifying --config'))
|
| |
+ print((_('Cannot create tag without specifying --config')))
|
| |
return
|
| |
# create a new tag, copy srctag header.
|
| |
if not options.test:
|
| |
@@ -3573,35 +3579,35 @@
|
| |
dstgroups[group['name']] = group
|
| |
#construct to-do lists.
|
| |
paddlist = [] # list containing new packages to be added from src tag
|
| |
- for (package_name, pkg) in srcpkgs.iteritems():
|
| |
+ for (package_name, pkg) in srcpkgs.items():
|
| |
if package_name not in dstpkgs:
|
| |
paddlist.append(pkg)
|
| |
paddlist.sort(key = lambda x: x['package_name'])
|
| |
pdellist = [] # list containing packages no more present in dst tag
|
| |
- for (package_name, pkg) in dstpkgs.iteritems():
|
| |
+ for (package_name, pkg) in dstpkgs.items():
|
| |
if package_name not in srcpkgs:
|
| |
pdellist.append(pkg)
|
| |
pdellist.sort(key = lambda x: x['package_name'])
|
| |
baddlist = [] # list containing new builds to be added from src tag
|
| |
- for (nvr, lbld) in srclblds.iteritems():
|
| |
+ for (nvr, lbld) in srclblds.items():
|
| |
if nvr not in dstlblds:
|
| |
baddlist.append(lbld)
|
| |
baddlist.sort(key = lambda x: x['package_name'])
|
| |
bdellist = [] # list containing new builds to be removed from src tag
|
| |
- for (nvr, lbld) in dstlblds.iteritems():
|
| |
+ for (nvr, lbld) in dstlblds.items():
|
| |
if nvr not in srclblds:
|
| |
bdellist.append(lbld)
|
| |
bdellist.sort(key = lambda x: x['package_name'])
|
| |
gaddlist = [] # list containing new groups to be added from src tag
|
| |
- for (grpname, group) in srcgroups.iteritems():
|
| |
+ for (grpname, group) in srcgroups.items():
|
| |
if grpname not in dstgroups:
|
| |
gaddlist.append(group)
|
| |
gdellist = [] # list containing groups to be removed from src tag
|
| |
- for (grpname, group) in dstgroups.iteritems():
|
| |
+ for (grpname, group) in dstgroups.items():
|
| |
if grpname not in srcgroups:
|
| |
gdellist.append(group)
|
| |
grpchanges = {} # dict of changes to make in shared groups
|
| |
- for (grpname, group) in srcgroups.iteritems():
|
| |
+ for (grpname, group) in srcgroups.items():
|
| |
if grpname in dstgroups:
|
| |
grpchanges[grpname] = {'adds':[], 'dels':[]}
|
| |
# Store whether group is inherited or not
|
| |
@@ -3797,13 +3803,13 @@
|
| |
chkbuildtag = session.getTag(build_tag)
|
| |
chkdesttag = session.getTag(dest_tag)
|
| |
if not chkbuildtag:
|
| |
- print("Build tag does not exist: %s" % build_tag)
|
| |
+ print(("Build tag does not exist: %s" % build_tag))
|
| |
return 1
|
| |
if not chkbuildtag.get("arches", None):
|
| |
- print("Build tag has no arches: %s" % build_tag)
|
| |
+ print(("Build tag has no arches: %s" % build_tag))
|
| |
return 1
|
| |
if not chkdesttag:
|
| |
- print("Destination tag does not exist: %s" % dest_tag)
|
| |
+ print(("Destination tag does not exist: %s" % dest_tag))
|
| |
return 1
|
| |
|
| |
session.createBuildTarget(name, build_tag, dest_tag)
|
| |
@@ -3840,15 +3846,15 @@
|
| |
targetInfo['build_tag_name'] = options.build_tag
|
| |
chkbuildtag = session.getTag(options.build_tag)
|
| |
if not chkbuildtag:
|
| |
- print("Build tag does not exist: %s" % options.build_tag)
|
| |
+ print(("Build tag does not exist: %s" % options.build_tag))
|
| |
return 1
|
| |
if not chkbuildtag.get("arches", None):
|
| |
- print("Build tag has no arches: %s" % options.build_tag)
|
| |
+ print(("Build tag has no arches: %s" % options.build_tag))
|
| |
return 1
|
| |
if options.dest_tag:
|
| |
chkdesttag = session.getTag(options.dest_tag)
|
| |
if not chkdesttag:
|
| |
- print("Destination tag does not exist: %s" % options.dest_tag)
|
| |
+ print(("Destination tag does not exist: %s" % options.dest_tag))
|
| |
return 1
|
| |
targetInfo['dest_tag_name'] = options.dest_tag
|
| |
|
| |
@@ -3873,7 +3879,7 @@
|
| |
target = args[0]
|
| |
target_info = session.getBuildTarget(target)
|
| |
if not target_info:
|
| |
- print("Build target %s does not exist" % target)
|
| |
+ print(("Build target %s does not exist" % target))
|
| |
return 1
|
| |
|
| |
session.deleteBuildTarget(target_info['id'])
|
| |
@@ -3897,7 +3903,7 @@
|
| |
tag = args[0]
|
| |
tag_info = session.getTag(tag)
|
| |
if not tag_info:
|
| |
- print("Tag %s does not exist" % tag)
|
| |
+ print(("Tag %s does not exist" % tag))
|
| |
return 1
|
| |
|
| |
session.deleteTag(tag_info['id'])
|
| |
@@ -3917,13 +3923,13 @@
|
| |
|
| |
fmt = "%(name)-30s %(build_tag_name)-30s %(dest_tag_name)-30s"
|
| |
if not options.quiet:
|
| |
- print("%-30s %-30s %-30s" % ('Name','Buildroot','Destination'))
|
| |
- print("-" * 93)
|
| |
+ print(("%-30s %-30s %-30s" % ('Name','Buildroot','Destination')))
|
| |
+ print(("-" * 93))
|
| |
tmp_list = [(x['name'], x) for x in session.getBuildTargets(options.name)]
|
| |
tmp_list.sort()
|
| |
targets = [x[1] for x in tmp_list]
|
| |
for target in targets:
|
| |
- print(fmt % target)
|
| |
+ print((fmt % target))
|
| |
#pprint.pprint(session.getBuildTargets())
|
| |
|
| |
def _printInheritance(tags, sibdepths=None, reverse=False):
|
| |
@@ -3985,7 +3991,7 @@
|
| |
event = koji.util.eventFromOpts(session, options)
|
| |
if event:
|
| |
event['timestr'] = time.asctime(time.localtime(event['ts']))
|
| |
- print("Querying at event %(id)i (%(timestr)s)" % event)
|
| |
+ print(("Querying at event %(id)i (%(timestr)s)" % event))
|
| |
if event:
|
| |
tag = session.getTag(args[0], event=event['id'])
|
| |
else:
|
| |
@@ -4068,7 +4074,7 @@
|
| |
if tag['locked'] or tag['perm']:
|
| |
continue
|
| |
if not options.verbose:
|
| |
- print(fmt % tag)
|
| |
+ print((fmt % tag))
|
| |
else:
|
| |
sys.stdout.write(fmt % tag)
|
| |
if tag['locked']:
|
| |
@@ -4135,8 +4141,8 @@
|
| |
return "%s: %s" % (time_str, fmt % x)
|
| |
for event_id, x in timeline:
|
| |
if options.debug:
|
| |
- print("%r" % x)
|
| |
- print(_histline(event_id, x))
|
| |
+ print(("%r" % x))
|
| |
+ print((_histline(event_id, x)))
|
| |
|
| |
def _print_histline(entry, **kwargs):
|
| |
options = kwargs['options']
|
| |
@@ -4155,7 +4161,7 @@
|
| |
if event_id != other[0]:
|
| |
bad_edit = "non-matching"
|
| |
if bad_edit:
|
| |
- print("Warning: unusual edit at event %i in table %s (%s)" % (event_id, table, bad_edit))
|
| |
+ print(("Warning: unusual edit at event %i in table %s (%s)" % (event_id, table, bad_edit)))
|
| |
#we'll simply treat them as separate events
|
| |
pprint.pprint(entry)
|
| |
pprint.pprint(edit)
|
| |
@@ -4284,7 +4290,7 @@
|
| |
parts.append(who % x)
|
| |
if create and x['active']:
|
| |
parts.append("[still active]")
|
| |
- print(' '.join(parts))
|
| |
+ print((' '.join(parts)))
|
| |
hidden_fields = ['active', 'create_event', 'revoke_event', 'creator_id', 'revoker_id',
|
| |
'creator_name', 'revoker_name', 'create_ts', 'revoke_ts']
|
| |
def get_nkey(key):
|
| |
@@ -4295,7 +4301,7 @@
|
| |
else:
|
| |
return '%s.name' % key
|
| |
if edit:
|
| |
- keys = x.keys()
|
| |
+ keys = list(x.keys())
|
| |
keys.sort()
|
| |
y = other[-1]
|
| |
for key in keys:
|
| |
@@ -4308,9 +4314,9 @@
|
| |
nkey = get_nkey(key)
|
| |
if nkey in x and nkey in y:
|
| |
continue
|
| |
- print(" %s: %s -> %s" % (key, x[key], y[key]))
|
| |
+ print((" %s: %s -> %s" % (key, x[key], y[key])))
|
| |
elif create and options.verbose and table != 'tag_listing':
|
| |
- keys = x.keys()
|
| |
+ keys = list(x.keys())
|
| |
keys.sort()
|
| |
# the table keys have already been represented in the base format string
|
| |
also_hidden = list(_table_keys[table])
|
| |
@@ -4329,7 +4335,7 @@
|
| |
dkey = key[:-5]
|
| |
else:
|
| |
dkey = key
|
| |
- print(" %s: %s" % (dkey, x[key]))
|
| |
+ print((" %s: %s" % (dkey, x[key])))
|
| |
|
| |
_table_keys = {
|
| |
'user_perms' : ['user_id', 'perm_id'],
|
| |
@@ -4468,7 +4474,7 @@
|
| |
new_timeline.append(entry)
|
| |
for entry in new_timeline:
|
| |
if options.debug:
|
| |
- print("%r" % list(entry))
|
| |
+ print(("%r" % list(entry)))
|
| |
_print_histline(entry, options=options)
|
| |
if not options.watch:
|
| |
break
|
| |
@@ -4673,35 +4679,35 @@
|
| |
|
| |
owner = session.getUser(info['owner'])['name']
|
| |
|
| |
- print("%sTask: %d" % (indent, task_id))
|
| |
- print("%sType: %s" % (indent, info['method']))
|
| |
+ print(("%sTask: %d" % (indent, task_id)))
|
| |
+ print(("%sType: %s" % (indent, info['method'])))
|
| |
if verbose:
|
| |
- print("%sRequest Parameters:" % indent)
|
| |
+ print(("%sRequest Parameters:" % indent))
|
| |
for line in _parseTaskParams(session, info['method'], task_id):
|
| |
- print("%s %s" % (indent, line))
|
| |
- print("%sOwner: %s" % (indent, owner))
|
| |
- print("%sState: %s" % (indent, koji.TASK_STATES[info['state']].lower()))
|
| |
- print("%sCreated: %s" % (indent, time.asctime(time.localtime(info['create_ts']))))
|
| |
+ print(("%s %s" % (indent, line)))
|
| |
+ print(("%sOwner: %s" % (indent, owner)))
|
| |
+ print(("%sState: %s" % (indent, koji.TASK_STATES[info['state']].lower())))
|
| |
+ print(("%sCreated: %s" % (indent, time.asctime(time.localtime(info['create_ts'])))))
|
| |
if info.get('start_ts'):
|
| |
- print("%sStarted: %s" % (indent, time.asctime(time.localtime(info['start_ts']))))
|
| |
+ print(("%sStarted: %s" % (indent, time.asctime(time.localtime(info['start_ts'])))))
|
| |
if info.get('completion_ts'):
|
| |
- print("%sFinished: %s" % (indent, time.asctime(time.localtime(info['completion_ts']))))
|
| |
+ print(("%sFinished: %s" % (indent, time.asctime(time.localtime(info['completion_ts'])))))
|
| |
if host_info:
|
| |
- print("%sHost: %s" % (indent, host_info['name']))
|
| |
+ print(("%sHost: %s" % (indent, host_info['name'])))
|
| |
if build_info:
|
| |
- print("%sBuild: %s (%d)" % (indent, build_info[0]['nvr'], build_info[0]['build_id']))
|
| |
+ print(("%sBuild: %s (%d)" % (indent, build_info[0]['nvr'], build_info[0]['build_id'])))
|
| |
if buildroot_infos:
|
| |
- print("%sBuildroots:" % indent)
|
| |
+ print(("%sBuildroots:" % indent))
|
| |
for root in buildroot_infos:
|
| |
- print("%s %s/%s-%d-%d/" % (indent, BUILDDIR, root['tag_name'], root['id'], root['repo_id']))
|
| |
+ print(("%s %s/%s-%d-%d/" % (indent, BUILDDIR, root['tag_name'], root['id'], root['repo_id'])))
|
| |
if logs:
|
| |
- print("%sLog Files:" % indent)
|
| |
+ print(("%sLog Files:" % indent))
|
| |
for log in logs:
|
| |
- print("%s %s/%s" % (indent, files_dir, log))
|
| |
+ print(("%s %s/%s" % (indent, files_dir, log)))
|
| |
if output:
|
| |
- print("%sOutput:" % indent)
|
| |
+ print(("%sOutput:" % indent))
|
| |
for filename in output:
|
| |
- print("%s %s/%s" % (indent, files_dir, filename))
|
| |
+ print(("%s %s/%s" % (indent, files_dir, filename)))
|
| |
|
| |
# white space
|
| |
print('')
|
| |
@@ -4748,7 +4754,7 @@
|
| |
event_opts = {}
|
| |
if event:
|
| |
event['timestr'] = time.asctime(time.localtime(event['ts']))
|
| |
- print("Querying at event %(id)i (%(timestr)s)" % event)
|
| |
+ print(("Querying at event %(id)i (%(timestr)s)" % event))
|
| |
event_opts['event'] = event['id']
|
| |
perms = dict([(p['id'], p['name']) for p in session.getAllPerms()])
|
| |
|
| |
@@ -4756,32 +4762,31 @@
|
| |
for tag in args:
|
| |
info = session.getTag(tag, **event_opts)
|
| |
if info is None:
|
| |
- print("No such tag: %s" % tag)
|
| |
+ print(("No such tag: %s" % tag))
|
| |
sys.exit(1)
|
| |
tags.append(info)
|
| |
|
| |
for n, info in enumerate(tags):
|
| |
if n > 0:
|
| |
print('')
|
| |
- print("Tag: %(name)s [%(id)d]" %info)
|
| |
- print("Arches: %(arches)s" %info)
|
| |
+ print(("Tag: %(name)s [%(id)d]" %info))
|
| |
+ print(("Arches: %(arches)s" %info))
|
| |
group_list = [x['name'] for x in session.getTagGroups(info['id'], **event_opts)]
|
| |
group_list.sort()
|
| |
- print("Groups: " + ', '.join(group_list))
|
| |
+ print(("Groups: " + ', '.join(group_list)))
|
| |
if info.get('locked'):
|
| |
print('LOCKED')
|
| |
if info.get('perm_id') is not None:
|
| |
perm_id = info['perm_id']
|
| |
- print("Required permission: %r" % perms.get(perm_id, perm_id))
|
| |
+ print(("Required permission: %r" % perms.get(perm_id, perm_id)))
|
| |
if session.mavenEnabled():
|
| |
- print("Maven support?: %s" % (info['maven_support'] and 'yes' or 'no'))
|
| |
- print("Include all Maven archives?: %s" % (info['maven_include_all'] and 'yes' or 'no'))
|
| |
+ print(("Maven support?: %s" % (info['maven_support'] and 'yes' or 'no')))
|
| |
+ print(("Include all Maven archives?: %s" % (info['maven_include_all'] and 'yes' or 'no')))
|
| |
if 'extra' in info:
|
| |
print("Tag options:")
|
| |
- keys = info['extra'].keys()
|
| |
- keys.sort()
|
| |
+ keys = sorted(info['extra'].keys())
|
| |
for key in keys:
|
| |
- print(" %s : %s" % (key, pprint.pformat(info['extra'][key])))
|
| |
+ print((" %s : %s" % (key, pprint.pformat(info['extra'][key]))))
|
| |
dest_targets = session.getBuildTargets(destTagID=info['id'], **event_opts)
|
| |
build_targets = session.getBuildTargets(buildTagID=info['id'], **event_opts)
|
| |
repos = {}
|
| |
@@ -4797,21 +4802,21 @@
|
| |
print("Targets that build into this tag:")
|
| |
for target in dest_targets:
|
| |
if event:
|
| |
- print(" %s (%s)" % (target['name'], target['build_tag_name']))
|
| |
+ print((" %s (%s)" % (target['name'], target['build_tag_name'])))
|
| |
else:
|
| |
- print(" %s (%s, %s)" % (target['name'], target['build_tag_name'], repos[target['build_tag']]))
|
| |
+ print((" %s (%s, %s)" % (target['name'], target['build_tag_name'], repos[target['build_tag']])))
|
| |
if build_targets:
|
| |
print("This tag is a buildroot for one or more targets")
|
| |
if not event:
|
| |
- print("Current repo: %s" % repos[info['id']])
|
| |
+ print(("Current repo: %s" % repos[info['id']]))
|
| |
print("Targets that build from this tag:")
|
| |
for target in build_targets:
|
| |
- print(" %s" % target['name'])
|
| |
+ print((" %s" % target['name']))
|
| |
external_repos = session.getTagExternalRepos(tag_info=info['id'], **event_opts)
|
| |
if external_repos:
|
| |
print("External repos:")
|
| |
for rinfo in external_repos:
|
| |
- print(" %(priority)3i %(external_repo_name)s (%(url)s)" % rinfo)
|
| |
+ print((" %(priority)3i %(external_repo_name)s (%(url)s)" % rinfo))
|
| |
print("Inheritance:")
|
| |
for parent in session.getInheritanceData(tag, **event_opts):
|
| |
flags = ''
|
| |
@@ -4825,11 +4830,11 @@
|
| |
else:
|
| |
flags += '.'
|
| |
parent['flags'] = flags
|
| |
- print(" %(priority)-4d %(flags)s %(name)s [%(parent_id)s]" % parent)
|
| |
+ print((" %(priority)-4d %(flags)s %(name)s [%(parent_id)s]" % parent))
|
| |
if parent['maxdepth'] is not None:
|
| |
- print(" maxdepth: %(maxdepth)s" % parent)
|
| |
+ print((" maxdepth: %(maxdepth)s" % parent))
|
| |
if parent['pkg_filter']:
|
| |
- print(" package filter: %(pkg_filter)s" % parent)
|
| |
+ print((" package filter: %(pkg_filter)s" % parent))
|
| |
|
| |
|
| |
def handle_add_tag(options, session, args):
|
| |
@@ -4955,25 +4960,25 @@
|
| |
selected.append(tag)
|
| |
break
|
| |
if not selected:
|
| |
- print(_("No tags matched"))
|
| |
+ print((_("No tags matched")))
|
| |
else:
|
| |
selected = [session.getTag(name) for name in args]
|
| |
for tag in selected:
|
| |
if options.master:
|
| |
#set the master lock
|
| |
if tag['locked']:
|
| |
- print(_("Tag %s: master lock already set") % tag['name'])
|
| |
+ print((_("Tag %s: master lock already set") % tag['name']))
|
| |
continue
|
| |
elif options.test:
|
| |
- print(_("Would have set master lock for: %s") % tag['name'])
|
| |
+ print((_("Would have set master lock for: %s") % tag['name']))
|
| |
continue
|
| |
session.editTag2(tag['id'], locked=True)
|
| |
else:
|
| |
if tag['perm_id'] == perm_id:
|
| |
- print(_("Tag %s: %s permission already required") % (tag['name'], perm))
|
| |
+ print((_("Tag %s: %s permission already required") % (tag['name'], perm)))
|
| |
continue
|
| |
elif options.test:
|
| |
- print(_("Would have set permission requirement %s for tag %s") % (perm, tag['name']))
|
| |
+ print((_("Would have set permission requirement %s for tag %s") % (perm, tag['name'])))
|
| |
continue
|
| |
session.editTag2(tag['id'], perm=perm_id)
|
| |
|
| |
@@ -4997,7 +5002,7 @@
|
| |
selected.append(tag)
|
| |
break
|
| |
if not selected:
|
| |
- print(_("No tags matched"))
|
| |
+ print((_("No tags matched")))
|
| |
else:
|
| |
selected = []
|
| |
for name in args:
|
| |
@@ -5014,10 +5019,10 @@
|
| |
if tag['perm_id']:
|
| |
opts['perm'] = None
|
| |
if not opts:
|
| |
- print("Tag %(name)s: not locked" % tag)
|
| |
+ print(("Tag %(name)s: not locked" % tag))
|
| |
continue
|
| |
if options.test:
|
| |
- print("Tag %s: skipping changes: %r" % (tag['name'], opts))
|
| |
+ print(("Tag %s: skipping changes: %r" % (tag['name'], opts)))
|
| |
else:
|
| |
session.editTag2(tag['id'], locked=False, perm_id=None)
|
| |
|
| |
@@ -5054,12 +5059,12 @@
|
| |
samePriority = [datum for datum in inheritanceData if datum['priority'] == priority]
|
| |
|
| |
if sameParents and not options.force:
|
| |
- print(_("Error: You are attempting to add %s as %s's parent even though it already is %s's parent.")
|
| |
- % (parent['name'], tag['name'], tag['name']))
|
| |
- print(_("Please use --force if this is what you really want to do."))
|
| |
+ print((_("Error: You are attempting to add %s as %s's parent even though it already is %s's parent.")
|
| |
+ % (parent['name'], tag['name'], tag['name'])))
|
| |
+ print((_("Please use --force if this is what you really want to do.")))
|
| |
return
|
| |
if samePriority:
|
| |
- print(_("Error: There is already an active inheritance with that priority on %s, please specify a different priority with --priority." % tag['name']))
|
| |
+ print((_("Error: There is already an active inheritance with that priority on %s, please specify a different priority with --priority." % tag['name'])))
|
| |
return
|
| |
|
| |
new_data = {}
|
| |
@@ -5119,17 +5124,17 @@
|
| |
data = [datum for datum in data if datum['priority'] == priority]
|
| |
|
| |
if len(data) == 0:
|
| |
- print(_("No inheritance link found to remove. Please check your arguments"))
|
| |
+ print((_("No inheritance link found to remove. Please check your arguments")))
|
| |
return 1
|
| |
elif len(data) > 1:
|
| |
- print(_("Multiple matches for tag."))
|
| |
+ print((_("Multiple matches for tag.")))
|
| |
if not parent:
|
| |
- print(_("Please specify a parent on the command line."))
|
| |
+ print((_("Please specify a parent on the command line.")))
|
| |
return 1
|
| |
if not priority:
|
| |
- print(_("Please specify a priority on the command line."))
|
| |
+ print((_("Please specify a priority on the command line.")))
|
| |
return 1
|
| |
- print(_("Error: Key constraints may be broken. Exiting."))
|
| |
+ print((_("Error: Key constraints may be broken. Exiting.")))
|
| |
return 1
|
| |
|
| |
# len(data) == 1
|
| |
@@ -5138,7 +5143,7 @@
|
| |
inheritanceData = session.getInheritanceData(tag['id'])
|
| |
samePriority = [datum for datum in inheritanceData if datum['priority'] == options.priority]
|
| |
if samePriority:
|
| |
- print(_("Error: There is already an active inheritance with that priority on %s, please specify a different priority with --priority.") % tag['name'])
|
| |
+ print((_("Error: There is already an active inheritance with that priority on %s, please specify a different priority with --priority.") % tag['name']))
|
| |
return 1
|
| |
|
| |
new_data = data.copy()
|
| |
@@ -5150,7 +5155,7 @@
|
| |
elif options.maxdepth.lower() == "none":
|
| |
new_data['maxdepth'] = None
|
| |
else:
|
| |
- print(_("Invalid maxdepth: %s") % options.maxdepth)
|
| |
+ print((_("Invalid maxdepth: %s") % options.maxdepth))
|
| |
return 1
|
| |
if options.intransitive:
|
| |
new_data['intransitive'] = options.intransitive
|
| |
@@ -5201,17 +5206,17 @@
|
| |
data = [datum for datum in data if datum['priority'] == priority]
|
| |
|
| |
if len(data) == 0:
|
| |
- print(_("No inheritance link found to remove. Please check your arguments"))
|
| |
+ print((_("No inheritance link found to remove. Please check your arguments")))
|
| |
return
|
| |
elif len(data) > 1:
|
| |
- print(_("Multiple matches for tag."))
|
| |
+ print((_("Multiple matches for tag.")))
|
| |
if not parent:
|
| |
- print(_("Please specify a parent on the command line."))
|
| |
+ print((_("Please specify a parent on the command line.")))
|
| |
return
|
| |
if not priority:
|
| |
- print(_("Please specify a priority on the command line."))
|
| |
+ print((_("Please specify a priority on the command line.")))
|
| |
return
|
| |
- print(_("Error: Key constrainsts may be broken. Exiting."))
|
| |
+ print((_("Error: Key constrainsts may be broken. Exiting.")))
|
| |
return
|
| |
|
| |
# len(data) == 1
|
| |
@@ -5244,9 +5249,9 @@
|
| |
tag = args[0]
|
| |
groups = session.getTagGroups(tag)
|
| |
if options.comps:
|
| |
- print(koji.generate_comps(groups, expand_groups=options.expand))
|
| |
+ print((koji.generate_comps(groups, expand_groups=options.expand)))
|
| |
elif options.spec:
|
| |
- print(koji.make_groups_spec(groups,name='buildgroups',buildgroup='build'))
|
| |
+ print((koji.make_groups_spec(groups,name='buildgroups',buildgroup='build')))
|
| |
else:
|
| |
pprint.pprint(groups)
|
| |
|
| |
@@ -5277,7 +5282,7 @@
|
| |
if event:
|
| |
opts['event'] = event['id']
|
| |
event['timestr'] = time.asctime(time.localtime(event['ts']))
|
| |
- print("Querying at event %(id)i (%(timestr)s)" % event)
|
| |
+ print(("Querying at event %(id)i (%(timestr)s)" % event))
|
| |
if options.tag:
|
| |
format = "tag"
|
| |
opts['tag_info'] = options.tag
|
| |
@@ -5322,7 +5327,7 @@
|
| |
print(header1)
|
| |
print(header2)
|
| |
for rinfo in data:
|
| |
- print(format % rinfo)
|
| |
+ print((format % rinfo))
|
| |
|
| |
def _pick_external_repo_priority(session, tag):
|
| |
"""pick priority after current ones, leaving space for later insertions"""
|
| |
@@ -5368,7 +5373,7 @@
|
| |
elif len(args) == 2:
|
| |
name, url = args
|
| |
rinfo = session.createExternalRepo(name, url)
|
| |
- print("Created external repo %(id)i" % rinfo)
|
| |
+ print(("Created external repo %(id)i" % rinfo))
|
| |
else:
|
| |
parser.error(_("Incorrect number of arguments"))
|
| |
assert False # pragma: no cover
|
| |
@@ -5381,8 +5386,8 @@
|
| |
else:
|
| |
priority = _pick_external_repo_priority(session, tag)
|
| |
session.addExternalRepoToTag(tag, rinfo['name'], priority)
|
| |
- print("Added external repo %s to tag %s (priority %i)" \
|
| |
- % (rinfo['name'], tag, priority))
|
| |
+ print(("Added external repo %s to tag %s (priority %i)" \
|
| |
+ % (rinfo['name'], tag, priority)))
|
| |
|
| |
def handle_edit_external_repo(options, session, args):
|
| |
"[admin] Edit data for an external repo"
|
| |
@@ -5429,20 +5434,20 @@
|
| |
parser.error(_("Do not specify tags when using --alltags"))
|
| |
assert False # pragma: no cover
|
| |
if not current_tags:
|
| |
- print(_("External repo %s not associated with any tags") % repo)
|
| |
+ print((_("External repo %s not associated with any tags") % repo))
|
| |
return 0
|
| |
tags = current_tags
|
| |
if delete:
|
| |
#removing entirely
|
| |
if current_tags and not options.force:
|
| |
- print(_("Error: external repo %s used by tag(s): %s") % (repo, ', '.join(current_tags)))
|
| |
- print(_("Use --force to remove anyway"))
|
| |
+ print((_("Error: external repo %s used by tag(s): %s") % (repo, ', '.join(current_tags))))
|
| |
+ print((_("Use --force to remove anyway")))
|
| |
return 1
|
| |
session.deleteExternalRepo(args[0])
|
| |
else:
|
| |
for tag in tags:
|
| |
if not tag in current_tags:
|
| |
- print(_("External repo %s not associated with tag %s") % (repo, tag))
|
| |
+ print((_("External repo %s not associated with tag %s") % (repo, tag)))
|
| |
continue
|
| |
session.removeExternalRepoFromTag(tag, repo)
|
| |
|
| |
@@ -5671,7 +5676,7 @@
|
| |
missing.append(opt)
|
| |
|
| |
if len(missing) > 0:
|
| |
- print("Missing the following required options: %s" % ' '.join(['--%s' % o.replace('_','-') for o in missing]))
|
| |
+ print(("Missing the following required options: %s" % ' '.join(['--%s' % o.replace('_','-') for o in missing])))
|
| |
raise koji.GenericError(_("Missing required options specified above"))
|
| |
|
| |
activate_session(session)
|
| |
@@ -5728,8 +5733,8 @@
|
| |
priority=priority)
|
| |
|
| |
if not options.quiet:
|
| |
- print("Created task: %d" % task_id)
|
| |
- print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
|
| |
+ print(("Created task: %d" % task_id))
|
| |
+ print(("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)))
|
| |
#if task_opts.wait or (task_opts.wait is None and not _running_in_bg()):
|
| |
# session.logout()
|
| |
# return watch_tasks(session, [task_id], quiet=options.quiet)
|
| |
@@ -5808,7 +5813,7 @@
|
| |
if not os.path.exists(task_options.config):
|
| |
parser.error(_("%s not found!" % task_options.config))
|
| |
section = 'image-build'
|
| |
- config = ConfigParser.ConfigParser()
|
| |
+ config = configparser.ConfigParser()
|
| |
conf_fd = open(task_options.config)
|
| |
config.readfp(conf_fd)
|
| |
conf_fd.close()
|
| |
@@ -5928,8 +5933,8 @@
|
| |
img_type, opts=hub_opts, priority=priority)
|
| |
|
| |
if not options.quiet:
|
| |
- print("Created task: %d" % task_id)
|
| |
- print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
|
| |
+ print(("Created task: %d" % task_id))
|
| |
+ print(("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)))
|
| |
if task_opts.wait or (task_opts.wait is None and not _running_in_bg()):
|
| |
session.logout()
|
| |
return watch_tasks(session, [task_id], quiet=options.quiet)
|
| |
@@ -5997,8 +6002,8 @@
|
| |
opts=hub_opts, priority=priority)
|
| |
|
| |
if not options.quiet:
|
| |
- print("Created task: %d" % task_id)
|
| |
- print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
|
| |
+ print(("Created task: %d" % task_id))
|
| |
+ print(("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)))
|
| |
if task_opts.wait or (task_opts.wait is None and not _running_in_bg()):
|
| |
session.logout()
|
| |
return watch_tasks(session, [task_id], quiet=options.quiet)
|
| |
@@ -6074,8 +6079,8 @@
|
| |
priority = 5
|
| |
task_id = session.winBuild(vm_name, scmurl, target, opts, priority=priority)
|
| |
if not build_opts.quiet:
|
| |
- print("Created task: %d" % task_id)
|
| |
- print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
|
| |
+ print(("Created task: %d" % task_id))
|
| |
+ print(("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)))
|
| |
if build_opts.wait or (build_opts.wait is None and not _running_in_bg()):
|
| |
session.logout()
|
| |
return watch_tasks(session, [task_id], quiet=build_opts.quiet)
|
| |
@@ -6180,7 +6185,7 @@
|
| |
if options.user:
|
| |
user = session.getUser(options.user)
|
| |
if not user:
|
| |
- print("No such user: %s" % options.user)
|
| |
+ print(("No such user: %s" % options.user))
|
| |
sys.exit(1)
|
| |
callopts['owner'] = user['id']
|
| |
if options.arch:
|
| |
@@ -6190,13 +6195,13 @@
|
| |
if options.channel:
|
| |
chan = session.getChannel(options.channel)
|
| |
if not chan:
|
| |
- print("No such channel: %s" % options.channel)
|
| |
+ print(("No such channel: %s" % options.channel))
|
| |
sys.exit(1)
|
| |
callopts['channel_id'] = chan['id']
|
| |
if options.host:
|
| |
host = session.getHost(options.host)
|
| |
if not host:
|
| |
- print("No such host: %s" % options.host)
|
| |
+ print(("No such host: %s" % options.host))
|
| |
sys.exit(1)
|
| |
callopts['host_id'] = host['id']
|
| |
|
| |
@@ -6301,42 +6306,42 @@
|
| |
packages = args[1:]
|
| |
user = session.getUser(owner)
|
| |
if not user:
|
| |
- print("No such user: %s" % owner)
|
| |
+ print(("No such user: %s" % owner))
|
| |
return 1
|
| |
opts = {'with_dups' : True}
|
| |
old_user = None
|
| |
if options.old_user:
|
| |
old_user = session.getUser(options.old_user)
|
| |
if not old_user:
|
| |
- print("No such user: %s" % options.old_user)
|
| |
+ print(("No such user: %s" % options.old_user))
|
| |
return 1
|
| |
opts['userID'] = old_user['id']
|
| |
to_change = []
|
| |
for package in packages:
|
| |
entries = session.listPackages(pkgID=package, **opts)
|
| |
if not entries:
|
| |
- print("No data for package %s" % package)
|
| |
+ print(("No data for package %s" % package))
|
| |
continue
|
| |
to_change.extend(entries)
|
| |
if not packages and options.old_user:
|
| |
entries = session.listPackages(**opts)
|
| |
if not entries:
|
| |
- print("No data for user %s" % old_user['name'])
|
| |
+ print(("No data for user %s" % old_user['name']))
|
| |
return 1
|
| |
to_change.extend(entries)
|
| |
for entry in to_change:
|
| |
if user['id'] == entry['owner_id']:
|
| |
if options.verbose:
|
| |
- print("Preserving owner=%s for package %s in tag %s" \
|
| |
- % (user['name'], package, entry['tag_name']))
|
| |
+ print(("Preserving owner=%s for package %s in tag %s" \
|
| |
+ % (user['name'], package, entry['tag_name'])))
|
| |
else:
|
| |
if options.test:
|
| |
- print("Would have changed owner for %s in tag %s: %s -> %s" \
|
| |
- % (entry['package_name'], entry['tag_name'], entry['owner_name'], user['name']))
|
| |
+ print(("Would have changed owner for %s in tag %s: %s -> %s" \
|
| |
+ % (entry['package_name'], entry['tag_name'], entry['owner_name'], user['name'])))
|
| |
continue
|
| |
if options.verbose:
|
| |
- print("Changing owner for %s in tag %s: %s -> %s" \
|
| |
- % (entry['package_name'], entry['tag_name'], entry['owner_name'], user['name']))
|
| |
+ print(("Changing owner for %s in tag %s: %s -> %s" \
|
| |
+ % (entry['package_name'], entry['tag_name'], entry['owner_name'], user['name'])))
|
| |
session.packageListSetOwner(entry['tag_id'], entry['package_name'], user['id'])
|
| |
|
| |
def anon_handle_watch_task(options, session, args):
|
| |
@@ -6418,9 +6423,9 @@
|
| |
if value is not None:
|
| |
taskopts[key] = value
|
| |
task_id = session.makeTask(method=args[0],
|
| |
- arglist=map(arg_filter,args[1:]),
|
| |
+ arglist=list(map(arg_filter,args[1:])),
|
| |
**taskopts)
|
| |
- print("Created task id %d" % task_id)
|
| |
+ print(("Created task id %d" % task_id))
|
| |
if _running_in_bg() or not options.watch:
|
| |
return
|
| |
else:
|
| |
@@ -6444,7 +6449,7 @@
|
| |
task_id = session.tagBuild(args[0], pkg, force=options.force)
|
| |
#XXX - wait on task
|
| |
tasks.append(task_id)
|
| |
- print("Created task %d" % task_id)
|
| |
+ print(("Created task %d" % task_id))
|
| |
if _running_in_bg() or options.nowait:
|
| |
return
|
| |
else:
|
| |
@@ -6474,7 +6479,7 @@
|
| |
for arg in args[2:]:
|
| |
pkg = session.getPackage(arg)
|
| |
if not pkg:
|
| |
- print(_("Invalid package name %s, skipping." % arg))
|
| |
+ print((_("Invalid package name %s, skipping." % arg)))
|
| |
continue
|
| |
tasklist = session.moveAllBuilds(args[0], args[1], arg, options.force)
|
| |
tasks.extend(tasklist)
|
| |
@@ -6482,7 +6487,7 @@
|
| |
for arg in args[2:]:
|
| |
build = session.getBuild(arg)
|
| |
if not build:
|
| |
- print(_("Invalid build %s, skipping." % arg))
|
| |
+ print((_("Invalid build %s, skipping." % arg)))
|
| |
continue
|
| |
if not build in builds:
|
| |
builds.append(build)
|
| |
@@ -6490,7 +6495,7 @@
|
| |
for build in builds:
|
| |
task_id = session.moveBuild(args[0], args[1], build['id'], options.force)
|
| |
tasks.append(task_id)
|
| |
- print("Created task %d, moving %s" % (task_id, koji.buildLabel(build)))
|
| |
+ print(("Created task %d, moving %s" % (task_id, koji.buildLabel(build))))
|
| |
if _running_in_bg() or options.nowait:
|
| |
return
|
| |
else:
|
| |
@@ -6537,7 +6542,7 @@
|
| |
if binfo['name'] not in seen_pkg:
|
| |
#latest for this package
|
| |
if options.verbose:
|
| |
- print(_("Leaving latest build for package %(name)s: %(nvr)s") % binfo)
|
| |
+ print((_("Leaving latest build for package %(name)s: %(nvr)s") % binfo))
|
| |
else:
|
| |
builds.append(binfo)
|
| |
seen_pkg[binfo['name']] = 1
|
| |
@@ -6553,18 +6558,18 @@
|
| |
# not in tag, see if it even exists
|
| |
binfo = session.getBuild(nvr)
|
| |
if not binfo:
|
| |
- print(_("No such build: %s") % nvr)
|
| |
+ print((_("No such build: %s") % nvr))
|
| |
else:
|
| |
- print(_("Build %s not in tag %s") % (nvr, tag['name']))
|
| |
+ print((_("Build %s not in tag %s") % (nvr, tag['name'])))
|
| |
if not options.force:
|
| |
return 1
|
| |
builds.reverse()
|
| |
for binfo in builds:
|
| |
if options.test:
|
| |
- print(_("would have untagged %(nvr)s") % binfo)
|
| |
+ print((_("would have untagged %(nvr)s") % binfo))
|
| |
else:
|
| |
if options.verbose:
|
| |
- print(_("untagging %(nvr)s") % binfo)
|
| |
+ print((_("untagging %(nvr)s") % binfo))
|
| |
session.untagBuild(tag['name'], binfo['nvr'], force=options.force)
|
| |
|
| |
def handle_unblock_pkg(options, session, args):
|
| |
@@ -6618,7 +6623,7 @@
|
| |
if suboptions.task_id:
|
| |
builds = session.listBuilds(taskID=build)
|
| |
if not builds:
|
| |
- print("No associated builds for task %s" % build)
|
| |
+ print(("No associated builds for task %s" % build))
|
| |
return 1
|
| |
build = builds[0]['build_id']
|
| |
|
| |
@@ -6626,17 +6631,17 @@
|
| |
# We want the latest build, not a specific build
|
| |
try:
|
| |
builds = session.listTagged(suboptions.latestfrom, latest=True, package=build, type=suboptions.type)
|
| |
- except koji.GenericError, data:
|
| |
- print("Error finding latest build: %s" % data)
|
| |
+ except koji.GenericError as data:
|
| |
+ print(("Error finding latest build: %s" % data))
|
| |
return 1
|
| |
if not builds:
|
| |
- print("%s has no builds of %s" % (suboptions.latestfrom, build))
|
| |
+ print(("%s has no builds of %s" % (suboptions.latestfrom, build)))
|
| |
return 1
|
| |
info = builds[0]
|
| |
elif suboptions.rpm:
|
| |
rpminfo = session.getRPM(build)
|
| |
if rpminfo is None:
|
| |
- print("No such rpm: %s" % build)
|
| |
+ print(("No such rpm: %s" % build))
|
| |
return 1
|
| |
info = session.getBuild(rpminfo['build_id'])
|
| |
else:
|
| |
@@ -6650,7 +6655,7 @@
|
| |
info = session.getBuild(build)
|
| |
|
| |
if info is None:
|
| |
- print("No such build: %s" % build)
|
| |
+ print(("No such build: %s" % build))
|
| |
return 1
|
| |
|
| |
if not suboptions.topurl:
|
| |
@@ -6662,7 +6667,7 @@
|
| |
if suboptions.type:
|
| |
archives = session.listArchives(buildID=info['id'], type=suboptions.type)
|
| |
if not archives:
|
| |
- print("No %s archives available for %s" % (suboptions.type, koji.buildLabel(info)))
|
| |
+ print(("No %s archives available for %s" % (suboptions.type, koji.buildLabel(info))))
|
| |
return 1
|
| |
if suboptions.type == 'maven':
|
| |
for archive in archives:
|
| |
@@ -6693,9 +6698,9 @@
|
| |
rpms = session.listRPMs(buildID=info['id'], arches=arches)
|
| |
if not rpms:
|
| |
if arches:
|
| |
- print("No %s packages available for %s" % (" or ".join(arches), koji.buildLabel(info)))
|
| |
+ print(("No %s packages available for %s" % (" or ".join(arches), koji.buildLabel(info))))
|
| |
else:
|
| |
- print("No packages available for %s" % koji.buildLabel(info))
|
| |
+ print(("No packages available for %s" % koji.buildLabel(info)))
|
| |
return 1
|
| |
for rpm in rpms:
|
| |
if not suboptions.debuginfo and koji.is_debuginfo(rpm['name']):
|
| |
@@ -6755,7 +6760,7 @@
|
| |
full_filename = os.path.normpath(os.path.join(task_log_dir, FAIL_LOG))
|
| |
koji.ensuredir(os.path.dirname(full_filename))
|
| |
sys.stdout.write("Writing: %s\n" % full_filename)
|
| |
- file(full_filename, 'w').write(content)
|
| |
+ open(full_filename, 'w').write(content)
|
| |
|
| |
def download_log(task_log_dir, task_id, filename, blocksize=102400):
|
| |
#Create directories only if there is any log file to write to
|
| |
@@ -6764,11 +6769,11 @@
|
| |
contents = 'IGNORE ME!'
|
| |
if suboptions.cont and os.path.exists(full_filename):
|
| |
sys.stdout.write("Continuing: %s\n" % full_filename)
|
| |
- fd = file(full_filename, 'ab')
|
| |
+ fd = open(full_filename, 'ab')
|
| |
offset = fd.tell()
|
| |
else:
|
| |
sys.stdout.write("Downloading: %s\n" % full_filename)
|
| |
- fd = file(full_filename, 'wb')
|
| |
+ fd = open(full_filename, 'wb')
|
| |
offset = 0
|
| |
try:
|
| |
while contents:
|
| |
@@ -6865,7 +6870,7 @@
|
| |
downloadable_tasks.append(base_task)
|
| |
else:
|
| |
subtasks = session.getTaskChildren(base_task_id)
|
| |
- downloadable_tasks.extend(filter(check_downloadable, subtasks))
|
| |
+ downloadable_tasks.extend(list(filter(check_downloadable, subtasks)))
|
| |
|
| |
# get files for download
|
| |
|
| |
@@ -6906,7 +6911,7 @@
|
| |
number = 0
|
| |
for (task, filename, new_filename) in downloads:
|
| |
number += 1
|
| |
- print(_("Downloading [%d/%d]: %s") % (number, len(downloads), new_filename))
|
| |
+ print((_("Downloading [%d/%d]: %s") % (number, len(downloads), new_filename)))
|
| |
output_file = open(new_filename, "wb")
|
| |
output_file.write(session.downloadTaskOutput(task["id"], filename))
|
| |
output_file.close()
|
| |
@@ -6945,13 +6950,13 @@
|
| |
parser.error("Invalid tag: %s" % tag)
|
| |
targets = session.getBuildTargets(buildTagID=tag_info['id'])
|
| |
if not targets:
|
| |
- print("%(name)s is not a build tag for any target" % tag_info)
|
| |
+ print(("%(name)s is not a build tag for any target" % tag_info))
|
| |
targets = session.getBuildTargets(destTagID=tag_info['id'])
|
| |
if targets:
|
| |
maybe = {}.fromkeys([t['build_tag_name'] for t in targets])
|
| |
- maybe = maybe.keys()
|
| |
+ maybe = list(maybe.keys())
|
| |
maybe.sort()
|
| |
- print("Suggested tags: %s" % ', '.join(maybe))
|
| |
+ print(("Suggested tags: %s" % ', '.join(maybe)))
|
| |
return 1
|
| |
tag_id = tag_info['id']
|
| |
|
| |
@@ -6959,11 +6964,11 @@
|
| |
for nvr in builds:
|
| |
data = session.getLatestBuilds(tag_id, package=nvr["name"])
|
| |
if len(data) == 0:
|
| |
- print("Warning: package %s is not in tag %s" % (nvr["name"], tag))
|
| |
+ print(("Warning: package %s is not in tag %s" % (nvr["name"], tag)))
|
| |
else:
|
| |
present_nvr = [x["nvr"] for x in data][0]
|
| |
if present_nvr != "%s-%s-%s" % (nvr["name"], nvr["version"], nvr["release"]):
|
| |
- print("Warning: nvr %s-%s-%s is not current in tag %s\n latest build in %s is %s" % (nvr["name"], nvr["version"], nvr["release"], tag, tag, present_nvr))
|
| |
+ print(("Warning: nvr %s-%s-%s is not current in tag %s\n latest build in %s is %s" % (nvr["name"], nvr["version"], nvr["release"], tag, tag, present_nvr)))
|
| |
|
| |
last_repo = None
|
| |
repo = session.getRepo(tag_id)
|
| |
@@ -6972,15 +6977,15 @@
|
| |
if builds and repo and repo != last_repo:
|
| |
if koji.util.checkForBuilds(session, tag_id, builds, repo['create_event'], latest=True):
|
| |
if not suboptions.quiet:
|
| |
- print("Successfully waited %s for %s to appear in the %s repo" % (koji.util.duration(start), koji.util.printList(suboptions.builds), tag))
|
| |
+ print(("Successfully waited %s for %s to appear in the %s repo" % (koji.util.duration(start), koji.util.printList(suboptions.builds), tag)))
|
| |
return
|
| |
|
| |
if (time.time() - start) >= (suboptions.timeout * 60.0):
|
| |
if not suboptions.quiet:
|
| |
if builds:
|
| |
- print("Unsuccessfully waited %s for %s to appear in the %s repo" % (koji.util.duration(start), koji.util.printList(suboptions.builds), tag))
|
| |
+ print(("Unsuccessfully waited %s for %s to appear in the %s repo" % (koji.util.duration(start), koji.util.printList(suboptions.builds), tag)))
|
| |
else:
|
| |
- print("Unsuccessfully waited %s for a new %s repo" % (koji.util.duration(start), tag))
|
| |
+ print(("Unsuccessfully waited %s for a new %s repo" % (koji.util.duration(start), tag)))
|
| |
return 1
|
| |
|
| |
time.sleep(60)
|
| |
@@ -6990,7 +6995,7 @@
|
| |
if not builds:
|
| |
if repo != last_repo:
|
| |
if not suboptions.quiet:
|
| |
- print("Successfully waited %s for a new %s repo" % (koji.util.duration(start), tag))
|
| |
+ print(("Successfully waited %s for a new %s repo" % (koji.util.duration(start), tag)))
|
| |
return
|
| |
|
| |
_search_types = ('package', 'build', 'tag', 'target', 'user', 'host', 'rpm', 'maven', 'win')
|
| |
@@ -7032,17 +7037,17 @@
|
| |
tag = info['name']
|
| |
targets = session.getBuildTargets(buildTagID=info['id'])
|
| |
if not targets:
|
| |
- print("Warning: %s is not a build tag" % tag)
|
| |
+ print(("Warning: %s is not a build tag" % tag))
|
| |
if not info['arches']:
|
| |
- print("Warning: tag %s has an empty arch list" % info['name'])
|
| |
+ print(("Warning: tag %s has an empty arch list" % info['name']))
|
| |
if suboptions.debuginfo:
|
| |
repo_opts['debuginfo'] = True
|
| |
if suboptions.source:
|
| |
repo_opts['src'] = True
|
| |
task_id = session.newRepo(tag, **repo_opts)
|
| |
- print("Regenerating repo for tag: %s" % tag)
|
| |
- print("Created task: %d" % task_id)
|
| |
- print("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id))
|
| |
+ print(("Regenerating repo for tag: %s" % tag))
|
| |
+ print(("Created task: %d" % task_id))
|
| |
+ print(("Task info: %s/taskinfo?taskID=%s" % (options.weburl, task_id)))
|
| |
if _running_in_bg() or suboptions.nowait:
|
| |
return
|
| |
else:
|
| |
@@ -7072,7 +7077,7 @@
|
| |
matchType = 'exact'
|
| |
data = session.search(pattern, type, matchType)
|
| |
for row in data:
|
| |
- print(row['name'])
|
| |
+ print((row['name']))
|
| |
|
| |
def handle_moshimoshi(options, session, args):
|
| |
"[misc] Introduce yourself"
|
| |
@@ -7087,18 +7092,18 @@
|
| |
if not u:
|
| |
print("Not authenticated")
|
| |
u = {'name' : 'anonymous user'}
|
| |
- print("%s, %s!" % (random.choice(greetings).encode('utf-8'), u["name"]))
|
| |
+ print(("%s, %s!" % (random.choice(greetings).encode('utf-8'), u["name"])))
|
| |
print("")
|
| |
- print("You are using the hub at %s" % session.baseurl)
|
| |
+ print(("You are using the hub at %s" % session.baseurl))
|
| |
authtype = u.get('authtype', getattr(session, 'authtype', None))
|
| |
if authtype == koji.AUTHTYPE_NORMAL:
|
| |
print("Authenticated via password")
|
| |
elif authtype == koji.AUTHTYPE_GSSAPI:
|
| |
print("Authenticated via GSSAPI")
|
| |
elif authtype == koji.AUTHTYPE_KERB:
|
| |
- print("Authenticated via Kerberos principal %s" % u["krb_principal"])
|
| |
+ print(("Authenticated via Kerberos principal %s" % u["krb_principal"]))
|
| |
elif authtype == koji.AUTHTYPE_SSL:
|
| |
- print("Authenticated via client certificate %s" % options.cert)
|
| |
+ print(("Authenticated via client certificate %s" % options.cert))
|
| |
|
| |
def handle_runroot(options, session, args):
|
| |
"[admin] Run a command in a buildroot"
|
| |
@@ -7145,7 +7150,7 @@
|
| |
kwargs['new_chroot'] = True
|
| |
|
| |
task_id = session.runroot(tag, arch, command, **kwargs)
|
| |
- except koji.GenericError, e:
|
| |
+ except koji.GenericError as e:
|
| |
if 'Invalid method' in str(e):
|
| |
print("* The runroot plugin appears to not be installed on the"
|
| |
" koji hub. Please contact the administrator.")
|
| |
@@ -7191,10 +7196,10 @@
|
| |
chosen = set(args)
|
| |
if options.admin:
|
| |
chosen.add('admin')
|
| |
- avail = set(categories.keys() + ['all'])
|
| |
+ avail = set(list(categories.keys()) + ['all'])
|
| |
unavail = chosen - avail
|
| |
for arg in unavail:
|
| |
- print("No such help category: %s" % arg)
|
| |
+ print(("No such help category: %s" % arg))
|
| |
|
| |
if not chosen:
|
| |
list_commands()
|
| |
@@ -7204,7 +7209,7 @@
|
| |
|
| |
def list_commands(categories_chosen=None):
|
| |
if categories_chosen is None or "all" in categories_chosen:
|
| |
- categories_chosen = categories.keys()
|
| |
+ categories_chosen = list(categories.keys())
|
| |
else:
|
| |
# copy list since we're about to modify it
|
| |
categories_chosen = list(categories_chosen)
|
| |
@@ -7220,18 +7225,18 @@
|
| |
alias = alias.replace('_','-')
|
| |
handlers.append((alias,value))
|
| |
handlers.sort()
|
| |
- print(_("Available commands:"))
|
| |
+ print((_("Available commands:")))
|
| |
for category in categories_chosen:
|
| |
- print(_("\n%s:" % categories[category]))
|
| |
+ print((_("\n%s:" % categories[category])))
|
| |
for alias,handler in handlers:
|
| |
desc = handler.__doc__
|
| |
if desc.startswith('[%s] ' % category):
|
| |
desc = desc[len('[%s] ' % category):]
|
| |
elif category != 'misc' or desc.startswith('['):
|
| |
continue
|
| |
- print(" %-25s %s" % (alias, desc))
|
| |
+ print((" %-25s %s" % (alias, desc)))
|
| |
|
| |
- print("%s" % get_epilog_str().rstrip("\n"))
|
| |
+ print(("%s" % get_epilog_str().rstrip("\n")))
|
| |
|
| |
def error(msg=None, code=1):
|
| |
if msg:
|
| |
@@ -7272,9 +7277,9 @@
|
| |
session.krb_login(principal=options.principal, keytab=options.keytab, proxyuser=options.runas)
|
| |
else:
|
| |
session.krb_login(proxyuser=options.runas)
|
| |
- except socket.error, e:
|
| |
+ except socket.error as e:
|
| |
warn(_("Could not connect to Kerberos authentication service: %s") % e.args[1])
|
| |
- except Exception, e:
|
| |
+ except Exception as e:
|
| |
if krbV is not None and isinstance(e, krbV.Krb5Error):
|
| |
error(_("Kerberos authentication failed: %s (%s)") % (e.args[1], e.args[0]))
|
| |
else:
|
| |
@@ -7318,7 +7323,7 @@
|
| |
else:
|
| |
exctype, value = sys.exc_info()[:2]
|
| |
rv = 1
|
| |
- print("%s: %s" % (exctype.__name__, value))
|
| |
+ print(("%s: %s" % (exctype.__name__, value)))
|
| |
try:
|
| |
session.logout()
|
| |
except:
|
| |
Fix a number of Python 3.x issues. With this patch and the respective
patches in other packages I can successfully run at least some
koji
commands using both Python 2.x and Python 3.x.
Related: https://pagure.io/koji/issue/151
Signed-off-by: Pavel Šimerda pavlix@pavlix.net