flake8: apply all rest E7 rules
This commit is contained in:
parent
6ed30954b2
commit
f1ba6cefd7
24 changed files with 112 additions and 127 deletions
4
.flake8
4
.flake8
|
|
@ -1,6 +1,6 @@
|
||||||
[flake8]
|
[flake8]
|
||||||
select = I,C,F,E1,E2,E3,E4,E502,E70,E71
|
select = I,C,F,E1,E2,E3,E4,E502,E7
|
||||||
ignore = E266
|
ignore = E266,E731
|
||||||
exclude =
|
exclude =
|
||||||
.git,
|
.git,
|
||||||
__pycache__,
|
__pycache__,
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ def main(options, session):
|
||||||
tm.restart_pending = True
|
tm.restart_pending = True
|
||||||
signal.signal(signal.SIGTERM, shutdown)
|
signal.signal(signal.SIGTERM, shutdown)
|
||||||
signal.signal(signal.SIGUSR1, restart)
|
signal.signal(signal.SIGUSR1, restart)
|
||||||
while 1:
|
while True:
|
||||||
try:
|
try:
|
||||||
taken = False
|
taken = False
|
||||||
tm.updateBuildroots()
|
tm.updateBuildroots()
|
||||||
|
|
@ -167,7 +167,7 @@ def main(options, session):
|
||||||
break
|
break
|
||||||
except koji.RetryError:
|
except koji.RetryError:
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
# XXX - this is a little extreme
|
# XXX - this is a little extreme
|
||||||
# log the exception and continue
|
# log the exception and continue
|
||||||
logger.error(''.join(traceback.format_exception(*sys.exc_info())))
|
logger.error(''.join(traceback.format_exception(*sys.exc_info())))
|
||||||
|
|
@ -485,7 +485,7 @@ class BuildRoot(object):
|
||||||
fd.close()
|
fd.close()
|
||||||
fd = open(fpath, 'rb')
|
fd = open(fpath, 'rb')
|
||||||
logs[fname] = (fd, stat_info.st_ino, stat_info.st_size or size, fpath)
|
logs[fname] = (fd, stat_info.st_ino, stat_info.st_size or size, fpath)
|
||||||
except:
|
except BaseException:
|
||||||
self.logger.error("Error reading mock log: %s", fpath)
|
self.logger.error("Error reading mock log: %s", fpath)
|
||||||
self.logger.error(''.join(traceback.format_exception(*sys.exc_info())))
|
self.logger.error(''.join(traceback.format_exception(*sys.exc_info())))
|
||||||
continue
|
continue
|
||||||
|
|
@ -530,7 +530,7 @@ class BuildRoot(object):
|
||||||
os.setregid(gid, gid)
|
os.setregid(gid, gid)
|
||||||
os.setreuid(uid, uid)
|
os.setreuid(uid, uid)
|
||||||
os.execvp(cmd[0], cmd)
|
os.execvp(cmd[0], cmd)
|
||||||
except:
|
except BaseException:
|
||||||
# diediedie
|
# diediedie
|
||||||
print("Failed to exec mock")
|
print("Failed to exec mock")
|
||||||
print(''.join(traceback.format_exception(*sys.exc_info())))
|
print(''.join(traceback.format_exception(*sys.exc_info())))
|
||||||
|
|
@ -792,7 +792,7 @@ class BuildRoot(object):
|
||||||
with koji.openRemoteFile(repomdpath, **opts) as fo:
|
with koji.openRemoteFile(repomdpath, **opts) as fo:
|
||||||
try:
|
try:
|
||||||
repodata = repoMDObject.RepoMD('ourrepo', fo)
|
repodata = repoMDObject.RepoMD('ourrepo', fo)
|
||||||
except:
|
except BaseException:
|
||||||
raise koji.BuildError("Unable to parse repomd.xml file for %s" % os.path.join(repodir, self.br_arch))
|
raise koji.BuildError("Unable to parse repomd.xml file for %s" % os.path.join(repodir, self.br_arch))
|
||||||
data = repodata.getData('origin')
|
data = repodata.getData('origin')
|
||||||
pkgorigins = data.location[1]
|
pkgorigins = data.location[1]
|
||||||
|
|
@ -1050,7 +1050,7 @@ class BuildTask(BaseTaskHandler):
|
||||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||||
# we do not trap these
|
# we do not trap these
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
if not self.opts.get('scratch'):
|
if not self.opts.get('scratch'):
|
||||||
# scratch builds do not get imported
|
# scratch builds do not get imported
|
||||||
self.session.host.failBuild(self.id, build_id)
|
self.session.host.failBuild(self.id, build_id)
|
||||||
|
|
@ -1528,7 +1528,7 @@ class MavenTask(MultiPlatformTask):
|
||||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||||
# we do not trap these
|
# we do not trap these
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
if not self.opts.get('scratch'):
|
if not self.opts.get('scratch'):
|
||||||
# scratch builds do not get imported
|
# scratch builds do not get imported
|
||||||
self.session.host.failBuild(self.id, self.build_id)
|
self.session.host.failBuild(self.id, self.build_id)
|
||||||
|
|
@ -2030,7 +2030,7 @@ class WrapperRPMTask(BaseBuildTask):
|
||||||
buildroot.build(srpm)
|
buildroot.build(srpm)
|
||||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
if self.new_build_id:
|
if self.new_build_id:
|
||||||
self.session.host.failBuild(self.id, self.new_build_id)
|
self.session.host.failBuild(self.id, self.new_build_id)
|
||||||
raise
|
raise
|
||||||
|
|
@ -2074,7 +2074,7 @@ class WrapperRPMTask(BaseBuildTask):
|
||||||
self.uploadFile(os.path.join(resultdir, rpm_fn))
|
self.uploadFile(os.path.join(resultdir, rpm_fn))
|
||||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
if self.new_build_id:
|
if self.new_build_id:
|
||||||
self.session.host.failBuild(self.id, self.new_build_id)
|
self.session.host.failBuild(self.id, self.new_build_id)
|
||||||
raise
|
raise
|
||||||
|
|
@ -2101,7 +2101,7 @@ class WrapperRPMTask(BaseBuildTask):
|
||||||
relsrpm, relrpms, brmap, {'noarch': rellogs})
|
relsrpm, relrpms, brmap, {'noarch': rellogs})
|
||||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
self.session.host.failBuild(self.id, self.new_build_id)
|
self.session.host.failBuild(self.id, self.new_build_id)
|
||||||
raise
|
raise
|
||||||
if not opts.get('skip_tag'):
|
if not opts.get('skip_tag'):
|
||||||
|
|
@ -2272,7 +2272,7 @@ class ChainMavenTask(MultiPlatformTask):
|
||||||
for key in akeys:
|
for key in akeys:
|
||||||
aval = a.get(key)
|
aval = a.get(key)
|
||||||
bval = b.get(key)
|
bval = b.get(key)
|
||||||
if type(aval) != type(bval):
|
if not isinstance(aval, type(bval)):
|
||||||
return False
|
return False
|
||||||
if isinstance(aval, dict):
|
if isinstance(aval, dict):
|
||||||
if not self.dicts_equal(aval, bval):
|
if not self.dicts_equal(aval, bval):
|
||||||
|
|
@ -2487,7 +2487,7 @@ class BuildBaseImageTask(BuildImageTask):
|
||||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||||
# we do not trap these
|
# we do not trap these
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
if not opts.get('scratch'):
|
if not opts.get('scratch'):
|
||||||
# scratch builds do not get imported
|
# scratch builds do not get imported
|
||||||
if bld_info:
|
if bld_info:
|
||||||
|
|
@ -2572,7 +2572,7 @@ class BuildApplianceTask(BuildImageTask):
|
||||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||||
# we do not trap these
|
# we do not trap these
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
if not opts.get('scratch'):
|
if not opts.get('scratch'):
|
||||||
# scratch builds do not get imported
|
# scratch builds do not get imported
|
||||||
if bld_info:
|
if bld_info:
|
||||||
|
|
@ -2657,7 +2657,7 @@ class BuildLiveCDTask(BuildImageTask):
|
||||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||||
# we do not trap these
|
# we do not trap these
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
if not opts.get('scratch'):
|
if not opts.get('scratch'):
|
||||||
# scratch builds do not get imported
|
# scratch builds do not get imported
|
||||||
if bld_info:
|
if bld_info:
|
||||||
|
|
@ -2794,7 +2794,7 @@ class BuildLiveMediaTask(BuildImageTask):
|
||||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||||
# we do not trap these
|
# we do not trap these
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
if not opts.get('scratch'):
|
if not opts.get('scratch'):
|
||||||
# scratch builds do not get imported
|
# scratch builds do not get imported
|
||||||
if bld_info:
|
if bld_info:
|
||||||
|
|
@ -4555,7 +4555,7 @@ class BuildIndirectionImageTask(OzImageTask):
|
||||||
return self._do_indirection(opts, base_factory_image, utility_factory_image,
|
return self._do_indirection(opts, base_factory_image, utility_factory_image,
|
||||||
indirection_template, tlog, ozlog, fhandler,
|
indirection_template, tlog, ozlog, fhandler,
|
||||||
bld_info, target_info, bd)
|
bld_info, target_info, bd)
|
||||||
except:
|
except BaseException:
|
||||||
if not opts.get('scratch'):
|
if not opts.get('scratch'):
|
||||||
# scratch builds do not get imported
|
# scratch builds do not get imported
|
||||||
if bld_info:
|
if bld_info:
|
||||||
|
|
@ -5013,7 +5013,7 @@ Build Info: %(weburl)s/buildinfo?buildID=%(build_id)i\r
|
||||||
result = None
|
result = None
|
||||||
try:
|
try:
|
||||||
result = self.session.getTaskResult(task_id)
|
result = self.session.getTaskResult(task_id)
|
||||||
except:
|
except BaseException:
|
||||||
excClass, result = sys.exc_info()[:2]
|
excClass, result = sys.exc_info()[:2]
|
||||||
if hasattr(result, 'faultString'):
|
if hasattr(result, 'faultString'):
|
||||||
result = result.faultString
|
result = result.faultString
|
||||||
|
|
@ -5114,8 +5114,7 @@ Build Info: %(weburl)s/buildinfo?buildID=%(build_id)i\r
|
||||||
for taskinfo in task_data.values():
|
for taskinfo in task_data.values():
|
||||||
for srpmfile in taskinfo['srpms']:
|
for srpmfile in taskinfo['srpms']:
|
||||||
srpms.append(srpmfile)
|
srpms.append(srpmfile)
|
||||||
srpms = self.uniq(srpms)
|
srpms = sorted(self.uniq(srpms))
|
||||||
srpms.sort()
|
|
||||||
|
|
||||||
if srpms:
|
if srpms:
|
||||||
output = "SRPMS:\r\n"
|
output = "SRPMS:\r\n"
|
||||||
|
|
@ -5182,9 +5181,8 @@ Build Info: %(weburl)s/buildinfo?buildID=%(build_id)i\r
|
||||||
def uniq(self, items):
|
def uniq(self, items):
|
||||||
"""Remove duplicates from the list of items, and sort the list."""
|
"""Remove duplicates from the list of items, and sort the list."""
|
||||||
m = dict(zip(items, [1] * len(items)))
|
m = dict(zip(items, [1] * len(items)))
|
||||||
l = to_list(m.keys())
|
s = sorted(to_list(m.keys()))
|
||||||
l.sort()
|
return s
|
||||||
return l
|
|
||||||
|
|
||||||
|
|
||||||
class NewRepoTask(BaseTaskHandler):
|
class NewRepoTask(BaseTaskHandler):
|
||||||
|
|
|
||||||
4
cli/koji
4
cli/koji
|
|
@ -335,7 +335,7 @@ if __name__ == "__main__":
|
||||||
rv = 0
|
rv = 0
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
rv = 1
|
rv = 1
|
||||||
except:
|
except BaseException:
|
||||||
if options.debug:
|
if options.debug:
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
|
|
@ -344,6 +344,6 @@ if __name__ == "__main__":
|
||||||
logger.error("%s: %s" % (exctype.__name__, value))
|
logger.error("%s: %s" % (exctype.__name__, value))
|
||||||
try:
|
try:
|
||||||
session.logout()
|
session.logout()
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
sys.exit(rv)
|
sys.exit(rv)
|
||||||
|
|
|
||||||
|
|
@ -1162,8 +1162,7 @@ def handle_import(goptions, session, args):
|
||||||
nvr = "%(name)s-%(version)s-%(release)s" % koji.parse_NVRA(data['sourcerpm'])
|
nvr = "%(name)s-%(version)s-%(release)s" % koji.parse_NVRA(data['sourcerpm'])
|
||||||
to_import.setdefault(nvr, []).append((path, data))
|
to_import.setdefault(nvr, []).append((path, data))
|
||||||
builds_missing = False
|
builds_missing = False
|
||||||
nvrs = to_list(to_import.keys())
|
nvrs = sorted(to_list(to_import.keys()))
|
||||||
nvrs.sort()
|
|
||||||
for nvr in nvrs:
|
for nvr in nvrs:
|
||||||
to_import[nvr].sort()
|
to_import[nvr].sort()
|
||||||
for path, data in to_import[nvr]:
|
for path, data in to_import[nvr]:
|
||||||
|
|
@ -2358,8 +2357,7 @@ def anon_handle_latest_build(goptions, session, args):
|
||||||
print("%s %s %s" % ("-" * 40, "-" * 20, "-" * 16))
|
print("%s %s %s" % ("-" * 40, "-" * 20, "-" * 16))
|
||||||
options.quiet = True
|
options.quiet = True
|
||||||
|
|
||||||
output = [fmt % x for x in data]
|
output = sorted([fmt % x for x in data])
|
||||||
output.sort()
|
|
||||||
for line in output:
|
for line in output:
|
||||||
print(line)
|
print(line)
|
||||||
|
|
||||||
|
|
@ -2379,7 +2377,7 @@ def anon_handle_list_api(goptions, session, args):
|
||||||
# older servers may not provide argdesc
|
# older servers may not provide argdesc
|
||||||
expanded = []
|
expanded = []
|
||||||
for arg in x['args']:
|
for arg in x['args']:
|
||||||
if type(arg) is str:
|
if isinstance(arg, str):
|
||||||
expanded.append(arg)
|
expanded.append(arg)
|
||||||
else:
|
else:
|
||||||
expanded.append('%s=%s' % (arg[0], arg[1]))
|
expanded.append('%s=%s' % (arg[0], arg[1]))
|
||||||
|
|
@ -2493,8 +2491,7 @@ def anon_handle_list_tagged(goptions, session, args):
|
||||||
print("%-40s %-20s %s" % ("Build", "Tag", "Built by"))
|
print("%-40s %-20s %s" % ("Build", "Tag", "Built by"))
|
||||||
print("%s %s %s" % ("-" * 40, "-" * 20, "-" * 16))
|
print("%s %s %s" % ("-" * 40, "-" * 20, "-" * 16))
|
||||||
|
|
||||||
output = [fmt % x for x in data]
|
output = sorted([fmt % x for x in data])
|
||||||
output.sort()
|
|
||||||
for line in output:
|
for line in output:
|
||||||
print(line)
|
print(line)
|
||||||
|
|
||||||
|
|
@ -2519,8 +2516,7 @@ def anon_handle_list_buildroot(goptions, session, args):
|
||||||
data = session.listRPMs(**opts)
|
data = session.listRPMs(**opts)
|
||||||
|
|
||||||
fmt = "%(nvr)s.%(arch)s"
|
fmt = "%(nvr)s.%(arch)s"
|
||||||
order = [(fmt % x, x) for x in data]
|
order = sorted([(fmt % x, x) for x in data])
|
||||||
order.sort()
|
|
||||||
for nvra, rinfo in order:
|
for nvra, rinfo in order:
|
||||||
if options.verbose and rinfo.get('is_update'):
|
if options.verbose and rinfo.get('is_update'):
|
||||||
print(nvra, "[update]")
|
print(nvra, "[update]")
|
||||||
|
|
@ -2573,8 +2569,7 @@ def anon_handle_list_untagged(goptions, session, args):
|
||||||
if options.show_references:
|
if options.show_references:
|
||||||
fmt = fmt + " %(refs)s"
|
fmt = fmt + " %(refs)s"
|
||||||
|
|
||||||
output = [fmt % x for x in data]
|
output = sorted([fmt % x for x in data])
|
||||||
output.sort()
|
|
||||||
for line in output:
|
for line in output:
|
||||||
print(line)
|
print(line)
|
||||||
|
|
||||||
|
|
@ -2612,8 +2607,7 @@ def anon_handle_list_groups(goptions, session, args):
|
||||||
opts['event'] = event['id']
|
opts['event'] = event['id']
|
||||||
event['timestr'] = time.asctime(time.localtime(event['ts']))
|
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)
|
||||||
tmp_list = [(x['name'], x) for x in session.getTagGroups(args[0], **opts)]
|
tmp_list = sorted([(x['name'], x) for x in session.getTagGroups(args[0], **opts)])
|
||||||
tmp_list.sort()
|
|
||||||
groups = [x[1] for x in tmp_list]
|
groups = [x[1] for x in tmp_list]
|
||||||
|
|
||||||
tags_cache = {}
|
tags_cache = {}
|
||||||
|
|
@ -2631,8 +2625,7 @@ def anon_handle_list_groups(goptions, session, args):
|
||||||
if len(args) > 1 and group['name'] != args[1]:
|
if len(args) > 1 and group['name'] != args[1]:
|
||||||
continue
|
continue
|
||||||
print("%s [%s]" % (group['name'], get_cached_tag(group['tag_id'])))
|
print("%s [%s]" % (group['name'], get_cached_tag(group['tag_id'])))
|
||||||
groups = [(x['name'], x) for x in group['grouplist']]
|
groups = sorted([(x['name'], x) for x in group['grouplist']])
|
||||||
groups.sort()
|
|
||||||
for x in [x[1] for x in groups]:
|
for x in [x[1] for x in groups]:
|
||||||
x['tag_name'] = get_cached_tag(x['tag_id'])
|
x['tag_name'] = get_cached_tag(x['tag_id'])
|
||||||
print_group_list_req_group(x)
|
print_group_list_req_group(x)
|
||||||
|
|
@ -2794,8 +2787,7 @@ def anon_handle_list_hosts(goptions, session, args):
|
||||||
opts['ready'] = options.ready
|
opts['ready'] = options.ready
|
||||||
if options.enabled is not None:
|
if options.enabled is not None:
|
||||||
opts['enabled'] = options.enabled
|
opts['enabled'] = options.enabled
|
||||||
tmp_list = [(x['name'], x) for x in session.listHosts(**opts)]
|
tmp_list = sorted([(x['name'], x) for x in session.listHosts(**opts)])
|
||||||
tmp_list.sort()
|
|
||||||
hosts = [x[1] for x in tmp_list]
|
hosts = [x[1] for x in tmp_list]
|
||||||
|
|
||||||
def yesno(x):
|
def yesno(x):
|
||||||
|
|
@ -3011,7 +3003,7 @@ def anon_handle_list_builds(goptions, session, args):
|
||||||
dt = dateutil.parser.parse(val)
|
dt = dateutil.parser.parse(val)
|
||||||
ts = time.mktime(dt.timetuple())
|
ts = time.mktime(dt.timetuple())
|
||||||
setattr(options, opt, ts)
|
setattr(options, opt, ts)
|
||||||
except:
|
except BaseException:
|
||||||
parser.error(_("Invalid time specification: %s") % val)
|
parser.error(_("Invalid time specification: %s") % val)
|
||||||
if options.before:
|
if options.before:
|
||||||
opts['completeBefore'] = getattr(options, 'before')
|
opts['completeBefore'] = getattr(options, 'before')
|
||||||
|
|
@ -3879,8 +3871,7 @@ def anon_handle_list_targets(goptions, session, args):
|
||||||
if not options.quiet:
|
if not options.quiet:
|
||||||
print("%-30s %-30s %-30s" % ('Name', 'Buildroot', 'Destination'))
|
print("%-30s %-30s %-30s" % ('Name', 'Buildroot', 'Destination'))
|
||||||
print("-" * 93)
|
print("-" * 93)
|
||||||
tmp_list = [(x['name'], x) for x in session.getBuildTargets(options.name)]
|
tmp_list = sorted([(x['name'], x) for x in session.getBuildTargets(options.name)])
|
||||||
tmp_list.sort()
|
|
||||||
targets = [x[1] for x in tmp_list]
|
targets = [x[1] for x in tmp_list]
|
||||||
for target in targets:
|
for target in targets:
|
||||||
print(fmt % target)
|
print(fmt % target)
|
||||||
|
|
@ -4278,8 +4269,7 @@ def _print_histline(entry, **kwargs):
|
||||||
else:
|
else:
|
||||||
return '%s.name' % key
|
return '%s.name' % key
|
||||||
if edit:
|
if edit:
|
||||||
keys = to_list(x.keys())
|
keys = sorted(to_list(x.keys()))
|
||||||
keys.sort()
|
|
||||||
y = other[-1]
|
y = other[-1]
|
||||||
for key in keys:
|
for key in keys:
|
||||||
if key in hidden_fields:
|
if key in hidden_fields:
|
||||||
|
|
@ -4293,8 +4283,7 @@ def _print_histline(entry, **kwargs):
|
||||||
continue
|
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':
|
elif create and options.verbose and table != 'tag_listing':
|
||||||
keys = to_list(x.keys())
|
keys = sorted(to_list(x.keys()))
|
||||||
keys.sort()
|
|
||||||
# the table keys have already been represented in the base format string
|
# the table keys have already been represented in the base format string
|
||||||
also_hidden = list(_table_keys[table])
|
also_hidden = list(_table_keys[table])
|
||||||
also_hidden.extend([get_nkey(k) for k in also_hidden])
|
also_hidden.extend([get_nkey(k) for k in also_hidden])
|
||||||
|
|
@ -4385,7 +4374,7 @@ def anon_handle_list_history(goptions, session, args):
|
||||||
dt = dateutil.parser.parse(val)
|
dt = dateutil.parser.parse(val)
|
||||||
ts = time.mktime(dt.timetuple())
|
ts = time.mktime(dt.timetuple())
|
||||||
setattr(options, opt, ts)
|
setattr(options, opt, ts)
|
||||||
except:
|
except BaseException:
|
||||||
parser.error(_("Invalid time specification: %s") % val)
|
parser.error(_("Invalid time specification: %s") % val)
|
||||||
for opt in ('package', 'tag', 'build', 'editor', 'user', 'permission',
|
for opt in ('package', 'tag', 'build', 'editor', 'user', 'permission',
|
||||||
'cg', 'external_repo', 'build_target', 'group', 'before',
|
'cg', 'external_repo', 'build_target', 'group', 'before',
|
||||||
|
|
@ -4768,8 +4757,7 @@ def anon_handle_taginfo(goptions, session, args):
|
||||||
print('')
|
print('')
|
||||||
print("Tag: %(name)s [%(id)d]" % info)
|
print("Tag: %(name)s [%(id)d]" % info)
|
||||||
print("Arches: %(arches)s" % info)
|
print("Arches: %(arches)s" % info)
|
||||||
group_list = [x['name'] for x in session.getTagGroups(info['id'], **event_opts)]
|
group_list = sorted([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'):
|
if info.get('locked'):
|
||||||
print('LOCKED')
|
print('LOCKED')
|
||||||
|
|
@ -6811,8 +6799,10 @@ def anon_handle_download_task(options, session, args):
|
||||||
base_task = session.getTaskInfo(base_task_id)
|
base_task = session.getTaskInfo(base_task_id)
|
||||||
if not base_task:
|
if not base_task:
|
||||||
error(_('No such task: #%i') % base_task_id)
|
error(_('No such task: #%i') % base_task_id)
|
||||||
|
|
||||||
|
def check_downloadable(task):
|
||||||
|
return task["method"] == "buildArch"
|
||||||
|
|
||||||
check_downloadable = lambda task: task["method"] == "buildArch"
|
|
||||||
downloadable_tasks = []
|
downloadable_tasks = []
|
||||||
|
|
||||||
if check_downloadable(base_task):
|
if check_downloadable(base_task):
|
||||||
|
|
|
||||||
|
|
@ -498,14 +498,14 @@ def download_file(url, relpath, quiet=False, noprogress=False, size=None, num=No
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
length = int(response.headers.get('content-length') or 0)
|
length = int(response.headers.get('content-length') or 0)
|
||||||
with open(relpath, 'wb') as f:
|
with open(relpath, 'wb') as f:
|
||||||
l = 0
|
pos = 0
|
||||||
for chunk in response.iter_content(chunk_size=65536):
|
for chunk in response.iter_content(chunk_size=65536):
|
||||||
l += len(chunk)
|
pos += len(chunk)
|
||||||
f.write(chunk)
|
f.write(chunk)
|
||||||
if not (quiet or noprogress):
|
if not (quiet or noprogress):
|
||||||
_download_progress(length, l)
|
_download_progress(length, pos)
|
||||||
if not length and not (quiet or noprogress):
|
if not length and not (quiet or noprogress):
|
||||||
_download_progress(l, l)
|
_download_progress(pos, pos)
|
||||||
|
|
||||||
if not (quiet or noprogress):
|
if not (quiet or noprogress):
|
||||||
print('')
|
print('')
|
||||||
|
|
|
||||||
|
|
@ -2634,7 +2634,7 @@ def repo_init(tag, with_src=False, with_debuginfo=False, event=None, with_separa
|
||||||
relpath = os.path.relpath(srcdir, dest_parent)
|
relpath = os.path.relpath(srcdir, dest_parent)
|
||||||
try:
|
try:
|
||||||
os.symlink(relpath, destlink)
|
os.symlink(relpath, destlink)
|
||||||
except:
|
except BaseException:
|
||||||
log_error('Error linking %s to %s' % (destlink, relpath))
|
log_error('Error linking %s to %s' % (destlink, relpath))
|
||||||
for artifact_dir, artifacts in six.iteritems(artifact_dirs):
|
for artifact_dir, artifacts in six.iteritems(artifact_dirs):
|
||||||
_write_maven_repo_metadata(artifact_dir, artifacts)
|
_write_maven_repo_metadata(artifact_dir, artifacts)
|
||||||
|
|
@ -4934,7 +4934,7 @@ def list_task_output(taskID, stat=False, all_volumes=False, strict=False):
|
||||||
# raise error if task doesn't exist
|
# raise error if task doesn't exist
|
||||||
try:
|
try:
|
||||||
Task(taskID).getInfo(strict=True)
|
Task(taskID).getInfo(strict=True)
|
||||||
except:
|
except BaseException:
|
||||||
raise koji.GenericError("Task doesn't exist")
|
raise koji.GenericError("Task doesn't exist")
|
||||||
|
|
||||||
if stat or all_volumes:
|
if stat or all_volumes:
|
||||||
|
|
@ -7288,10 +7288,10 @@ def check_rpm_sig(an_rpm, sigkey, sighdr):
|
||||||
ts.setVSFlags(0) # full verify
|
ts.setVSFlags(0) # full verify
|
||||||
with open(temp, 'rb') as fo:
|
with open(temp, 'rb') as fo:
|
||||||
hdr = ts.hdrFromFdno(fo.fileno())
|
hdr = ts.hdrFromFdno(fo.fileno())
|
||||||
except:
|
except BaseException:
|
||||||
try:
|
try:
|
||||||
os.unlink(temp)
|
os.unlink(temp)
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
raise
|
raise
|
||||||
raw_key = koji.get_header_field(hdr, 'siggpg')
|
raw_key = koji.get_header_field(hdr, 'siggpg')
|
||||||
|
|
|
||||||
|
|
@ -240,7 +240,7 @@ class ModXMLRPCRequestHandler(object):
|
||||||
except Fault as fault:
|
except Fault as fault:
|
||||||
self.traceback = True
|
self.traceback = True
|
||||||
response = dumps(fault, marshaller=Marshaller)
|
response = dumps(fault, marshaller=Marshaller)
|
||||||
except:
|
except BaseException:
|
||||||
self.traceback = True
|
self.traceback = True
|
||||||
# report exception back to server
|
# report exception back to server
|
||||||
e_class, e = sys.exc_info()[:2]
|
e_class, e = sys.exc_info()[:2]
|
||||||
|
|
|
||||||
|
|
@ -303,10 +303,10 @@ class GenericError(Exception):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
try:
|
try:
|
||||||
return str(self.args[0]['args'][0])
|
return str(self.args[0]['args'][0])
|
||||||
except:
|
except BaseException:
|
||||||
try:
|
try:
|
||||||
return str(self.args[0])
|
return str(self.args[0])
|
||||||
except:
|
except BaseException:
|
||||||
return str(self.__dict__)
|
return str(self.__dict__)
|
||||||
# END kojikamid dup #
|
# END kojikamid dup #
|
||||||
|
|
||||||
|
|
@ -1727,7 +1727,7 @@ def format_exc_plus():
|
||||||
# COULD cause any exception, so we MUST catch any...:
|
# COULD cause any exception, so we MUST catch any...:
|
||||||
try:
|
try:
|
||||||
rv += "%s\n" % value
|
rv += "%s\n" % value
|
||||||
except:
|
except BaseException:
|
||||||
rv += "<ERROR WHILE PRINTING VALUE>\n"
|
rv += "<ERROR WHILE PRINTING VALUE>\n"
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
|
|
@ -2265,7 +2265,7 @@ class VirtualMethod(object):
|
||||||
self.__session._apidoc = dict(
|
self.__session._apidoc = dict(
|
||||||
[(f["name"], f) for f in self.__func("_listapi", [], {})]
|
[(f["name"], f) for f in self.__func("_listapi", [], {})]
|
||||||
)
|
)
|
||||||
except:
|
except BaseException:
|
||||||
self.__session._apidoc = {}
|
self.__session._apidoc = {}
|
||||||
|
|
||||||
funcdoc = self.__session._apidoc.get(self.__name)
|
funcdoc = self.__session._apidoc.get(self.__name)
|
||||||
|
|
@ -2651,7 +2651,7 @@ class ClientSession(object):
|
||||||
if self.__dict__:
|
if self.__dict__:
|
||||||
try:
|
try:
|
||||||
self.logout()
|
self.logout()
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def callMethod(self, name, *args, **opts):
|
def callMethod(self, name, *args, **opts):
|
||||||
|
|
@ -3283,7 +3283,7 @@ class DBHandler(logging.Handler):
|
||||||
# self.cnx.commit()
|
# self.cnx.commit()
|
||||||
# XXX - committing here is most likely wrong, but we need to set commit_pending or something
|
# XXX - committing here is most likely wrong, but we need to set commit_pending or something
|
||||||
# ...and this is really the wrong place for that
|
# ...and this is really the wrong place for that
|
||||||
except:
|
except BaseException:
|
||||||
self.handleError(record)
|
self.handleError(record)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@ def _try_read_cpuinfo():
|
||||||
mounted). """
|
mounted). """
|
||||||
try:
|
try:
|
||||||
return open("/proc/cpuinfo", "r")
|
return open("/proc/cpuinfo", "r")
|
||||||
except:
|
except BaseException:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -248,7 +248,7 @@ def _parse_auxv():
|
||||||
# In case we can't open and read /proc/self/auxv, just return
|
# In case we can't open and read /proc/self/auxv, just return
|
||||||
try:
|
try:
|
||||||
data = open("/proc/self/auxv", "rb").read()
|
data = open("/proc/self/auxv", "rb").read()
|
||||||
except:
|
except BaseException:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Define values from /usr/include/elf.h
|
# Define values from /usr/include/elf.h
|
||||||
|
|
@ -323,7 +323,7 @@ def getCanonPPCArch(arch):
|
||||||
try:
|
try:
|
||||||
if platform.startswith("power") and int(platform[5:].rstrip('+')) >= 7:
|
if platform.startswith("power") and int(platform[5:].rstrip('+')) >= 7:
|
||||||
return "ppc64p7"
|
return "ppc64p7"
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if machine is None:
|
if machine is None:
|
||||||
|
|
@ -388,7 +388,7 @@ def getCanonArch(skipRpmPlatform=0):
|
||||||
f.close()
|
f.close()
|
||||||
(arch, vendor, opersys) = line.split("-", 2)
|
(arch, vendor, opersys) = line.split("-", 2)
|
||||||
return arch
|
return arch
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
arch = os.uname()[4]
|
arch = os.uname()[4]
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ class Session(object):
|
||||||
raise koji.AuthError('%s not specified in session args' % field)
|
raise koji.AuthError('%s not specified in session args' % field)
|
||||||
try:
|
try:
|
||||||
callnum = args['callnum'][0]
|
callnum = args['callnum'][0]
|
||||||
except:
|
except BaseException:
|
||||||
callnum = None
|
callnum = None
|
||||||
# lookup the session
|
# lookup the session
|
||||||
c = context.cnx.cursor()
|
c = context.cnx.cursor()
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,7 @@ def log_output(session, path, args, outfile, uploadpath, cwd=None, logerror=0, a
|
||||||
if env:
|
if env:
|
||||||
environ.update(env)
|
environ.update(env)
|
||||||
os.execvpe(path, args, environ)
|
os.execvpe(path, args, environ)
|
||||||
except:
|
except BaseException:
|
||||||
msg = ''.join(traceback.format_exception(*sys.exc_info()))
|
msg = ''.join(traceback.format_exception(*sys.exc_info()))
|
||||||
if fd:
|
if fd:
|
||||||
try:
|
try:
|
||||||
|
|
@ -147,7 +147,7 @@ def log_output(session, path, args, outfile, uploadpath, cwd=None, logerror=0, a
|
||||||
else:
|
else:
|
||||||
os.write(fd, msg)
|
os.write(fd, msg)
|
||||||
os.close(fd)
|
os.close(fd)
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
print(msg)
|
print(msg)
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
|
@ -166,7 +166,7 @@ def log_output(session, path, args, outfile, uploadpath, cwd=None, logerror=0, a
|
||||||
except IOError:
|
except IOError:
|
||||||
# will happen if the forked process has not created the logfile yet
|
# will happen if the forked process has not created the logfile yet
|
||||||
continue
|
continue
|
||||||
except:
|
except BaseException:
|
||||||
print('Error reading log file: %s' % outfile)
|
print('Error reading log file: %s' % outfile)
|
||||||
print(''.join(traceback.format_exception(*sys.exc_info())))
|
print(''.join(traceback.format_exception(*sys.exc_info())))
|
||||||
|
|
||||||
|
|
@ -1133,7 +1133,7 @@ class TaskManager(object):
|
||||||
try:
|
try:
|
||||||
self.session.logoutChild(session_id)
|
self.session.logoutChild(session_id)
|
||||||
del self.subsessions[task_id]
|
del self.subsessions[task_id]
|
||||||
except:
|
except BaseException:
|
||||||
# not much we can do about it
|
# not much we can do about it
|
||||||
pass
|
pass
|
||||||
if wait:
|
if wait:
|
||||||
|
|
@ -1233,7 +1233,7 @@ class TaskManager(object):
|
||||||
valid_host = handler.checkHost(self.hostdata)
|
valid_host = handler.checkHost(self.hostdata)
|
||||||
except (SystemExit, KeyboardInterrupt):
|
except (SystemExit, KeyboardInterrupt):
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
valid_host = False
|
valid_host = False
|
||||||
self.logger.warn('Error during host check')
|
self.logger.warn('Error during host check')
|
||||||
self.logger.warn(''.join(traceback.format_exception(*sys.exc_info())))
|
self.logger.warn(''.join(traceback.format_exception(*sys.exc_info())))
|
||||||
|
|
@ -1316,7 +1316,7 @@ class TaskManager(object):
|
||||||
# freeing this task will allow the pending restart to take effect
|
# freeing this task will allow the pending restart to take effect
|
||||||
self.session.host.freeTasks([handler.id])
|
self.session.host.freeTasks([handler.id])
|
||||||
return
|
return
|
||||||
except:
|
except BaseException:
|
||||||
tb = ''.join(traceback.format_exception(*sys.exc_info()))
|
tb = ''.join(traceback.format_exception(*sys.exc_info()))
|
||||||
self.logger.warn("TRACEBACK: %s" % tb)
|
self.logger.warn("TRACEBACK: %s" % tb)
|
||||||
# report exception back to server
|
# report exception back to server
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,8 @@ class CursorWrapper:
|
||||||
if hasattr(self.cursor, "mogrify"):
|
if hasattr(self.cursor, "mogrify"):
|
||||||
quote = self.cursor.mogrify
|
quote = self.cursor.mogrify
|
||||||
else:
|
else:
|
||||||
quote = lambda a, b: a % b
|
def quote(a, b):
|
||||||
|
return a % b
|
||||||
try:
|
try:
|
||||||
return quote(operation, parameters)
|
return quote(operation, parameters)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
||||||
|
|
@ -199,7 +199,7 @@ def run_callbacks(cbtype, *args, **kws):
|
||||||
cb_args, cb_kwargs = _fix_cb_args(func, args, kws, cache)
|
cb_args, cb_kwargs = _fix_cb_args(func, args, kws, cache)
|
||||||
try:
|
try:
|
||||||
func(cbtype, *cb_args, **cb_kwargs)
|
func(cbtype, *cb_args, **cb_kwargs)
|
||||||
except:
|
except BaseException:
|
||||||
msg = 'Error running %s callback from %s' % (cbtype, func.__module__)
|
msg = 'Error running %s callback from %s' % (cbtype, func.__module__)
|
||||||
if getattr(func, 'failure_is_an_option', False):
|
if getattr(func, 'failure_is_an_option', False):
|
||||||
logging.getLogger('koji.plugin').warn(msg, exc_info=True)
|
logging.getLogger('koji.plugin').warn(msg, exc_info=True)
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ class Rpmdiff:
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
try:
|
try:
|
||||||
PREREQ_FLAG = rpm.RPMSENSE_PREREQ
|
PREREQ_FLAG = rpm.RPMSENSE_PREREQ
|
||||||
except:
|
except BaseException:
|
||||||
# (proyvind): This seems ugly, but then again so does
|
# (proyvind): This seems ugly, but then again so does
|
||||||
# this whole check as well.
|
# this whole check as well.
|
||||||
PREREQ_FLAG = False
|
PREREQ_FLAG = False
|
||||||
|
|
@ -119,9 +119,8 @@ class Rpmdiff:
|
||||||
|
|
||||||
old_files_dict = self.__fileIteratorToDict(old.fiFromHeader())
|
old_files_dict = self.__fileIteratorToDict(old.fiFromHeader())
|
||||||
new_files_dict = self.__fileIteratorToDict(new.fiFromHeader())
|
new_files_dict = self.__fileIteratorToDict(new.fiFromHeader())
|
||||||
files = list(set(itertools.chain(six.iterkeys(old_files_dict),
|
files = sorted(set(itertools.chain(six.iterkeys(old_files_dict),
|
||||||
six.iterkeys(new_files_dict))))
|
six.iterkeys(new_files_dict))))
|
||||||
files.sort()
|
|
||||||
self.old_data['files'] = old_files_dict
|
self.old_data['files'] = old_files_dict
|
||||||
self.new_data['files'] = new_files_dict
|
self.new_data['files'] = new_files_dict
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ def safe_rmtree(path, unmount=False, strict=True):
|
||||||
logger.debug("Removing: %s" % path)
|
logger.debug("Removing: %s" % path)
|
||||||
try:
|
try:
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
except:
|
except BaseException:
|
||||||
if strict:
|
if strict:
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
18
util/koji-gc
18
util/koji-gc
|
|
@ -449,7 +449,7 @@ Build: %%(name)s-%%(version)s-%%(release)s
|
||||||
s.login(options.smtp_user, options.smtp_pass)
|
s.login(options.smtp_user, options.smtp_pass)
|
||||||
s.sendmail(msg['From'], msg['To'], msg.as_string())
|
s.sendmail(msg['From'], msg['To'], msg.as_string())
|
||||||
s.quit()
|
s.quit()
|
||||||
except:
|
except BaseException:
|
||||||
print("FAILED: Sending warning notice to %s" % msg['To'])
|
print("FAILED: Sending warning notice to %s" % msg['To'])
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -571,12 +571,10 @@ def handle_trash():
|
||||||
by_owner = {}
|
by_owner = {}
|
||||||
for binfo in to_trash:
|
for binfo in to_trash:
|
||||||
by_owner.setdefault(binfo['owner_name'], []).append(binfo)
|
by_owner.setdefault(binfo['owner_name'], []).append(binfo)
|
||||||
owners = to_list(by_owner.keys())
|
owners = sorted(to_list(by_owner.keys()))
|
||||||
owners.sort()
|
|
||||||
mcall = koji.MultiCallSession(session, batch=1000)
|
mcall = koji.MultiCallSession(session, batch=1000)
|
||||||
for owner_name in owners:
|
for owner_name in owners:
|
||||||
builds = [(b['nvr'], b) for b in by_owner[owner_name]]
|
builds = sorted([(b['nvr'], b) for b in by_owner[owner_name]])
|
||||||
builds.sort()
|
|
||||||
send_warning_notice(owner_name, [x[1] for x in builds])
|
send_warning_notice(owner_name, [x[1] for x in builds])
|
||||||
for nvr, binfo in builds:
|
for nvr, binfo in builds:
|
||||||
if options.test:
|
if options.test:
|
||||||
|
|
@ -646,8 +644,7 @@ def handle_delete(just_salvage=False):
|
||||||
"""
|
"""
|
||||||
print("Getting list of builds in trash...")
|
print("Getting list of builds in trash...")
|
||||||
trashcan_tag = options.trashcan_tag
|
trashcan_tag = options.trashcan_tag
|
||||||
trash = [(b['nvr'], b) for b in session.listTagged(trashcan_tag)]
|
trash = sorted([(b['nvr'], b) for b in session.listTagged(trashcan_tag)])
|
||||||
trash.sort()
|
|
||||||
print("...got %i builds" % len(trash))
|
print("...got %i builds" % len(trash))
|
||||||
# XXX - it would be better if there were more appropriate server calls for this
|
# XXX - it would be better if there were more appropriate server calls for this
|
||||||
grace_period = options.grace_period
|
grace_period = options.grace_period
|
||||||
|
|
@ -902,8 +899,7 @@ def handle_prune():
|
||||||
pkghist.setdefault(h['name'] + '-' + h['version'], []).append(h)
|
pkghist.setdefault(h['name'] + '-' + h['version'], []).append(h)
|
||||||
else:
|
else:
|
||||||
pkghist.setdefault(h['name'], []).append(h)
|
pkghist.setdefault(h['name'], []).append(h)
|
||||||
pkgs = to_list(pkghist.keys())
|
pkgs = sorted(to_list(pkghist.keys()))
|
||||||
pkgs.sort()
|
|
||||||
for pkg in pkgs:
|
for pkg in pkgs:
|
||||||
if not check_package(pkg):
|
if not check_package(pkg):
|
||||||
# if options.debug:
|
# if options.debug:
|
||||||
|
|
@ -1010,7 +1006,7 @@ if __name__ == "__main__":
|
||||||
if options.exit_on_lock:
|
if options.exit_on_lock:
|
||||||
try:
|
try:
|
||||||
session.logout()
|
session.logout()
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
os.close(lock_fd)
|
os.close(lock_fd)
|
||||||
|
|
@ -1041,7 +1037,7 @@ if __name__ == "__main__":
|
||||||
# print("%s: %s" % (exctype, value))
|
# print("%s: %s" % (exctype, value))
|
||||||
try:
|
try:
|
||||||
session.logout()
|
session.logout()
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
if not options.skip_main:
|
if not options.skip_main:
|
||||||
sys.exit(rv)
|
sys.exit(rv)
|
||||||
|
|
|
||||||
|
|
@ -450,7 +450,7 @@ class TrackedBuild(object):
|
||||||
# XXX - Move SCM class out of kojid and use it to check for scm url
|
# XXX - Move SCM class out of kojid and use it to check for scm url
|
||||||
if src.startswith('cvs:'):
|
if src.startswith('cvs:'):
|
||||||
return src
|
return src
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
# otherwise fail
|
# otherwise fail
|
||||||
return None
|
return None
|
||||||
|
|
@ -980,8 +980,7 @@ class BuildTracker(object):
|
||||||
for pkg in session.listPackages(pkgID=name):
|
for pkg in session.listPackages(pkgID=name):
|
||||||
owners.setdefault(pkg['owner_id'], []).append(pkg)
|
owners.setdefault(pkg['owner_id'], []).append(pkg)
|
||||||
if owners:
|
if owners:
|
||||||
order = [(len(v), k) for k, v in six.iteritems(owners)]
|
order = sorted([(len(v), k) for k, v in six.iteritems(owners)])
|
||||||
order.sort()
|
|
||||||
owner = order[-1][1]
|
owner = order[-1][1]
|
||||||
else:
|
else:
|
||||||
# just use ourselves
|
# just use ourselves
|
||||||
|
|
@ -1207,8 +1206,7 @@ class BuildTracker(object):
|
||||||
ret = False
|
ret = False
|
||||||
if options.max_jobs and len(self.state_idx['pending']) >= options.max_jobs:
|
if options.max_jobs and len(self.state_idx['pending']) >= options.max_jobs:
|
||||||
return ret
|
return ret
|
||||||
missing = [(b.order, b.id, b) for b in six.itervalues(self.state_idx['missing'])]
|
missing = sorted([(b.order, b.id, b) for b in six.itervalues(self.state_idx['missing'])])
|
||||||
missing.sort()
|
|
||||||
for order, build_id, build in missing:
|
for order, build_id, build in missing:
|
||||||
if not self.checkBuildDeps(build):
|
if not self.checkBuildDeps(build):
|
||||||
continue
|
continue
|
||||||
|
|
@ -1276,7 +1274,7 @@ def main(args):
|
||||||
filename = options.logfile
|
filename = options.logfile
|
||||||
try:
|
try:
|
||||||
logfile = os.open(filename, os.O_CREAT | os.O_RDWR | os.O_APPEND, 0o777)
|
logfile = os.open(filename, os.O_CREAT | os.O_RDWR | os.O_APPEND, 0o777)
|
||||||
except:
|
except BaseException:
|
||||||
logfile = None
|
logfile = None
|
||||||
if logfile is not None:
|
if logfile is not None:
|
||||||
log("logging to %s" % filename)
|
log("logging to %s" % filename)
|
||||||
|
|
@ -1330,6 +1328,6 @@ if __name__ == "__main__":
|
||||||
# log ("%s: %s" % (exctype, value))
|
# log ("%s: %s" % (exctype, value))
|
||||||
try:
|
try:
|
||||||
session.logout()
|
session.logout()
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
sys.exit(rv)
|
sys.exit(rv)
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ def clean_scratch_tasks(cursor, vacuum, test, age):
|
||||||
if opts['scratch']:
|
if opts['scratch']:
|
||||||
cursor.execute("INSERT INTO temp_scratch_tasks VALUES (%s)", (task_id,))
|
cursor.execute("INSERT INTO temp_scratch_tasks VALUES (%s)", (task_id,))
|
||||||
ids.append(task_id)
|
ids.append(task_id)
|
||||||
except:
|
except BaseException:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
parents = ids
|
parents = ids
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ class RepoManager(object):
|
||||||
while True:
|
while True:
|
||||||
self.checkCurrentRepos()
|
self.checkCurrentRepos()
|
||||||
time.sleep(self.options.sleeptime)
|
time.sleep(self.options.sleeptime)
|
||||||
except:
|
except BaseException:
|
||||||
self.logger.exception('Error in currency checker thread')
|
self.logger.exception('Error in currency checker thread')
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
|
|
@ -423,7 +423,7 @@ class RepoManager(object):
|
||||||
while True:
|
while True:
|
||||||
self.regenRepos()
|
self.regenRepos()
|
||||||
time.sleep(self.options.sleeptime)
|
time.sleep(self.options.sleeptime)
|
||||||
except:
|
except BaseException:
|
||||||
self.logger.exception('Error in regen thread')
|
self.logger.exception('Error in regen thread')
|
||||||
raise
|
raise
|
||||||
finally:
|
finally:
|
||||||
|
|
@ -851,7 +851,7 @@ def main(options, session):
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
logger.warn("Shutting down")
|
logger.warn("Shutting down")
|
||||||
break
|
break
|
||||||
except:
|
except BaseException:
|
||||||
# log the exception and continue
|
# log the exception and continue
|
||||||
logger.error(''.join(traceback.format_exception(*sys.exc_info())))
|
logger.error(''.join(traceback.format_exception(*sys.exc_info())))
|
||||||
try:
|
try:
|
||||||
|
|
@ -1000,7 +1000,7 @@ if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
logfile = open(options.logfile, "w")
|
logfile = open(options.logfile, "w")
|
||||||
logfile.close()
|
logfile.close()
|
||||||
except:
|
except BaseException:
|
||||||
sys.stderr.write("Cannot create logfile: %s\n" % options.logfile)
|
sys.stderr.write("Cannot create logfile: %s\n" % options.logfile)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if not os.access(options.logfile, os.W_OK):
|
if not os.access(options.logfile, os.W_OK):
|
||||||
|
|
|
||||||
|
|
@ -687,7 +687,7 @@ def stream_logs(server, handler, builds):
|
||||||
try:
|
try:
|
||||||
fd = open(log, 'r')
|
fd = open(log, 'r')
|
||||||
logs[log] = (relpath, fd)
|
logs[log] = (relpath, fd)
|
||||||
except:
|
except BaseException:
|
||||||
log_local('Error opening %s' % log)
|
log_local('Error opening %s' % log)
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
|
|
@ -701,7 +701,7 @@ def stream_logs(server, handler, builds):
|
||||||
del contents
|
del contents
|
||||||
try:
|
try:
|
||||||
server.uploadDirect(relpath, offset, size, digest, data)
|
server.uploadDirect(relpath, offset, size, digest, data)
|
||||||
except:
|
except BaseException:
|
||||||
log_local('error uploading %s' % relpath)
|
log_local('error uploading %s' % relpath)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
|
|
@ -717,14 +717,14 @@ def fail(server, handler):
|
||||||
logfd.flush()
|
logfd.flush()
|
||||||
upload_file(server, os.path.dirname(logfile),
|
upload_file(server, os.path.dirname(logfile),
|
||||||
os.path.basename(logfile))
|
os.path.basename(logfile))
|
||||||
except:
|
except BaseException:
|
||||||
log_local('error calling upload_file()')
|
log_local('error calling upload_file()')
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
# this is the very last thing we do, keep trying as long as we can
|
# this is the very last thing we do, keep trying as long as we can
|
||||||
server.failTask(tb)
|
server.failTask(tb)
|
||||||
break
|
break
|
||||||
except:
|
except BaseException:
|
||||||
log_local('error calling server.failTask()')
|
log_local('error calling server.failTask()')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
@ -794,7 +794,7 @@ def main():
|
||||||
results['logs'].append(os.path.basename(logfile))
|
results['logs'].append(os.path.basename(logfile))
|
||||||
|
|
||||||
server.closeTask(results)
|
server.closeTask(results)
|
||||||
except:
|
except BaseException:
|
||||||
fail(server, handler)
|
fail(server, handler)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
|
||||||
12
vm/kojivmd
12
vm/kojivmd
|
|
@ -241,7 +241,7 @@ def main(options, session):
|
||||||
break
|
break
|
||||||
except koji.RetryError:
|
except koji.RetryError:
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
# XXX - this is a little extreme
|
# XXX - this is a little extreme
|
||||||
# log the exception and continue
|
# log the exception and continue
|
||||||
logger.error('Error in main loop', exc_info=True)
|
logger.error('Error in main loop', exc_info=True)
|
||||||
|
|
@ -293,7 +293,7 @@ class DaemonXMLRPCServer(six.moves.xmlrpc_server.SimpleXMLRPCServer):
|
||||||
self.close_request(conn)
|
self.close_request(conn)
|
||||||
except socket.timeout:
|
except socket.timeout:
|
||||||
pass
|
pass
|
||||||
except:
|
except BaseException:
|
||||||
self.logger.error('Error handling requests', exc_info=True)
|
self.logger.error('Error handling requests', exc_info=True)
|
||||||
|
|
||||||
if sys.version_info[:2] <= (2, 4):
|
if sys.version_info[:2] <= (2, 4):
|
||||||
|
|
@ -310,7 +310,7 @@ class DaemonXMLRPCServer(six.moves.xmlrpc_server.SimpleXMLRPCServer):
|
||||||
response = six.moves.xmlrpc_client.dumps(response, methodresponse=1, allow_none=True)
|
response = six.moves.xmlrpc_client.dumps(response, methodresponse=1, allow_none=True)
|
||||||
except six.moves.xmlrpc_client.Fault as fault:
|
except six.moves.xmlrpc_client.Fault as fault:
|
||||||
response = six.moves.xmlrpc_client.dumps(fault)
|
response = six.moves.xmlrpc_client.dumps(fault)
|
||||||
except:
|
except BaseException:
|
||||||
# report exception back to server
|
# report exception back to server
|
||||||
response = six.moves.xmlrpc_client.dumps(
|
response = six.moves.xmlrpc_client.dumps(
|
||||||
six.moves.xmlrpc_client.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value))
|
six.moves.xmlrpc_client.Fault(1, "%s:%s" % (sys.exc_type, sys.exc_value))
|
||||||
|
|
@ -407,7 +407,7 @@ class WinBuildTask(MultiPlatformTask):
|
||||||
except (SystemExit, ServerExit, KeyboardInterrupt):
|
except (SystemExit, ServerExit, KeyboardInterrupt):
|
||||||
# we do not trap these
|
# we do not trap these
|
||||||
raise
|
raise
|
||||||
except:
|
except BaseException:
|
||||||
if not opts.get('scratch'):
|
if not opts.get('scratch'):
|
||||||
# scratch builds do not get imported
|
# scratch builds do not get imported
|
||||||
self.session.host.failBuild(self.id, build_id)
|
self.session.host.failBuild(self.id, build_id)
|
||||||
|
|
@ -1037,7 +1037,7 @@ class VMTaskManager(TaskManager):
|
||||||
if os.path.isfile(disk):
|
if os.path.isfile(disk):
|
||||||
os.unlink(disk)
|
os.unlink(disk)
|
||||||
self.logger.debug('Removed disk file %s for VM %s', disk, vm_name)
|
self.logger.debug('Removed disk file %s for VM %s', disk, vm_name)
|
||||||
except:
|
except BaseException:
|
||||||
self.logger.error('Error removing disk file %s for VM %s', disk, vm_name,
|
self.logger.error('Error removing disk file %s for VM %s', disk, vm_name,
|
||||||
exc_info=True)
|
exc_info=True)
|
||||||
return False
|
return False
|
||||||
|
|
@ -1054,7 +1054,7 @@ class VMTaskManager(TaskManager):
|
||||||
"""
|
"""
|
||||||
vms = self.libvirt_conn.listDefinedDomains() + self.libvirt_conn.listDomainsID()
|
vms = self.libvirt_conn.listDefinedDomains() + self.libvirt_conn.listDomainsID()
|
||||||
for vm_name in vms:
|
for vm_name in vms:
|
||||||
if type(vm_name) == int:
|
if isinstance(vm_name, int):
|
||||||
vm_name = self.libvirt_conn.lookupByID(vm_name).name()
|
vm_name = self.libvirt_conn.lookupByID(vm_name).name()
|
||||||
if vm_name.startswith(VMExecTask.CLONE_PREFIX):
|
if vm_name.startswith(VMExecTask.CLONE_PREFIX):
|
||||||
self.cleanupVM(vm_name)
|
self.cleanupVM(vm_name)
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,11 @@ from koji.server import ServerRedirect
|
||||||
from koji.util import to_list
|
from koji.util import to_list
|
||||||
from kojiweb.util import _genHTML, _getValidTokens, _initValues
|
from kojiweb.util import _genHTML, _getValidTokens, _initValues
|
||||||
|
|
||||||
|
|
||||||
# Convenience definition of a commonly-used sort function
|
# Convenience definition of a commonly-used sort function
|
||||||
_sortbyname = lambda x: x['name']
|
def _sortbyname(x):
|
||||||
|
return x['name']
|
||||||
|
|
||||||
|
|
||||||
# loggers
|
# loggers
|
||||||
authlogger = logging.getLogger('koji.auth')
|
authlogger = logging.getLogger('koji.auth')
|
||||||
|
|
@ -694,7 +697,7 @@ def taskinfo(environ, taskID):
|
||||||
if task['state'] in (koji.TASK_STATES['CLOSED'], koji.TASK_STATES['FAILED']):
|
if task['state'] in (koji.TASK_STATES['CLOSED'], koji.TASK_STATES['FAILED']):
|
||||||
try:
|
try:
|
||||||
result = server.getTaskResult(task['id'])
|
result = server.getTaskResult(task['id'])
|
||||||
except:
|
except BaseException:
|
||||||
excClass, exc = sys.exc_info()[:2]
|
excClass, exc = sys.exc_info()[:2]
|
||||||
values['result'] = exc
|
values['result'] = exc
|
||||||
values['excClass'] = excClass
|
values['excClass'] = excClass
|
||||||
|
|
@ -728,7 +731,7 @@ def taskinfo(environ, taskID):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
values['params_parsed'] = _genHTML(environ, 'taskinfo_params.chtml')
|
values['params_parsed'] = _genHTML(environ, 'taskinfo_params.chtml')
|
||||||
except:
|
except BaseException:
|
||||||
values['params_parsed'] = None
|
values['params_parsed'] = None
|
||||||
return _genHTML(environ, 'taskinfo.chtml')
|
return _genHTML(environ, 'taskinfo.chtml')
|
||||||
|
|
||||||
|
|
@ -2393,7 +2396,7 @@ def search(environ, start=None, order=None):
|
||||||
if match == 'regexp':
|
if match == 'regexp':
|
||||||
try:
|
try:
|
||||||
re.compile(terms)
|
re.compile(terms)
|
||||||
except:
|
except BaseException:
|
||||||
values['error'] = 'Invalid regular expression'
|
values['error'] = 'Invalid regular expression'
|
||||||
return _genHTML(environ, 'search.chtml')
|
return _genHTML(environ, 'search.chtml')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -205,7 +205,7 @@ class Dispatcher(object):
|
||||||
args = inspect.getargspec(val)
|
args = inspect.getargspec(val)
|
||||||
if not args[0] or args[0][0] != 'environ':
|
if not args[0] or args[0][0] != 'environ':
|
||||||
continue
|
continue
|
||||||
except:
|
except BaseException:
|
||||||
tb_str = ''.join(traceback.format_exception(*sys.exc_info()))
|
tb_str = ''.join(traceback.format_exception(*sys.exc_info()))
|
||||||
self.logger.error(tb_str)
|
self.logger.error(tb_str)
|
||||||
self.handler_index[name] = val
|
self.handler_index[name] = val
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ class NoSuchException(Exception):
|
||||||
try:
|
try:
|
||||||
# pyOpenSSL might not be around
|
# pyOpenSSL might not be around
|
||||||
from OpenSSL.SSL import Error as SSL_Error
|
from OpenSSL.SSL import Error as SSL_Error
|
||||||
except:
|
except BaseException:
|
||||||
SSL_Error = NoSuchException
|
SSL_Error = NoSuchException
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue