make the output listPackages() consistent regardless of with_dups
This commit is contained in:
parent
581a857182
commit
d71432b3d9
3 changed files with 21 additions and 20 deletions
22
cli/koji
22
cli/koji
|
|
@ -1676,23 +1676,20 @@ def anon_handle_list_pkgs(options, session, args):
|
|||
print "%-23s %-23s %-16s %-16s" % ('Package','Tag','Extra Arches','Owner')
|
||||
print "%s %s %s %s" % ('-'*23,'-'*23,'-'*16,'-'*16)
|
||||
for pkg in data:
|
||||
if options.tag:
|
||||
pkg = [pkg[0]]
|
||||
if allpkgs:
|
||||
print pkg['package_name']
|
||||
continue
|
||||
for tagged_pkg in pkg:
|
||||
if not options.show_blocked and tagged_pkg.get('blocked',False):
|
||||
else:
|
||||
if not options.show_blocked and pkg.get('blocked',False):
|
||||
continue
|
||||
if tagged_pkg.has_key('tag_id'):
|
||||
if tagged_pkg['extra_arches'] is None:
|
||||
tagged_pkg['extra_arches'] = ""
|
||||
if pkg.has_key('tag_id'):
|
||||
if pkg['extra_arches'] is None:
|
||||
pkg['extra_arches'] = ""
|
||||
fmt = "%(package_name)-23s %(tag_name)-23s %(extra_arches)-16s %(owner_name)-16s"
|
||||
if tagged_pkg.get('blocked',False):
|
||||
if pkg.get('blocked',False):
|
||||
fmt += " [BLOCKED]"
|
||||
else:
|
||||
fmt = "%(package_name)s"
|
||||
print fmt % tagged_pkg
|
||||
print fmt % pkg
|
||||
|
||||
def anon_handle_rpminfo(options, session, args):
|
||||
"Print basic information about an RPM"
|
||||
|
|
@ -2816,11 +2813,6 @@ def handle_set_pkg_owner_global(options, session, args):
|
|||
if not entries:
|
||||
print "No data for package %s" % package
|
||||
continue
|
||||
elif len(entries) > 1:
|
||||
# since we specified exactly one package, the list should
|
||||
# only have one entry
|
||||
raise koji.GenericError, "Unexpected return format"
|
||||
entries = entries[0]
|
||||
for entry in entries:
|
||||
if user['id'] == entry['owner_id']:
|
||||
if options.verbose:
|
||||
|
|
|
|||
|
|
@ -4679,10 +4679,19 @@ class RootExports(object):
|
|||
userID = get_user(userID,strict=True)['id']
|
||||
if pkgID is not None:
|
||||
pkgID = get_package_id(pkgID,strict=True)
|
||||
results = readPackageList(tagID=tagID, userID=userID, pkgID=pkgID,
|
||||
inherit=inherited, with_dups=with_dups).values()
|
||||
result_list = readPackageList(tagID=tagID, userID=userID, pkgID=pkgID,
|
||||
inherit=inherited, with_dups=with_dups).values()
|
||||
if with_dups:
|
||||
# when with_dups=True, readPackageList returns a list of list of dicts
|
||||
# convert it to a list of dicts for consistency
|
||||
results = []
|
||||
for result in result_list:
|
||||
results.extend(result)
|
||||
else:
|
||||
results = result_list
|
||||
|
||||
if prefix:
|
||||
prefix = prefix.lower()
|
||||
results = [package for package in results if package['package_name'].lower().startswith(prefix)]
|
||||
|
||||
return results
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ def index(req, packageOrder='package_name', packageStart=None, buildOrder='-comp
|
|||
start=taskStart, dataName='tasks', prefix='task', order=taskOrder, pageSize=10)
|
||||
|
||||
if user:
|
||||
packages = kojiweb.util.paginateResults(server, values, 'listPackages', kw={'userID': user['id']},
|
||||
packages = kojiweb.util.paginateResults(server, values, 'listPackages', kw={'userID': user['id'], 'with_dups': True},
|
||||
start=packageStart, dataName='packages', prefix='package', order=packageOrder, pageSize=10)
|
||||
|
||||
notifs = server.getBuildNotifications(user['id'])
|
||||
|
|
@ -896,7 +896,7 @@ def userinfo(req, userID, packageOrder='package_name', packageStart=None, buildO
|
|||
values['user'] = user
|
||||
values['userID'] = user['id']
|
||||
|
||||
packages = kojiweb.util.paginateResults(server, values, 'listPackages', kw={'userID': user['id']},
|
||||
packages = kojiweb.util.paginateResults(server, values, 'listPackages', kw={'userID': user['id'], 'with_dups': True},
|
||||
start=packageStart, dataName='packages', prefix='package', order=packageOrder, pageSize=10)
|
||||
|
||||
builds = kojiweb.util.paginateMethod(server, values, 'listBuilds', kw={'userID': user['id']},
|
||||
|
|
@ -1315,7 +1315,7 @@ def packagesbyuser(req, start=None, order=None):
|
|||
|
||||
server.multicall = True
|
||||
for user in users:
|
||||
server.count('listPackages', userID=user['id'])
|
||||
server.count('listPackages', userID=user['id'], with_dups=True)
|
||||
packageCounts = server.multiCall()
|
||||
|
||||
for user, [numPackages] in zip(users, packageCounts):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue