support querying package listings at an event
This commit is contained in:
parent
79de9eaf3e
commit
aced7c5794
2 changed files with 11 additions and 2 deletions
8
cli/koji
8
cli/koji
|
|
@ -2231,6 +2231,9 @@ def anon_handle_list_pkgs(options, session, args):
|
|||
parser.add_option("--noinherit", action="store_true", help=_("Don't follow inheritance"))
|
||||
parser.add_option("--show-blocked", action="store_true", help=_("Show blocked packages"))
|
||||
parser.add_option("--show-dups", action="store_true", help=_("Show superseded owners"))
|
||||
parser.add_option("--event", type='int', metavar="EVENT#", help=_("query at event"))
|
||||
parser.add_option("--ts", type='int', metavar="TIMESTAMP", help=_("query at timestamp"))
|
||||
parser.add_option("--repo", type='int', metavar="REPO#", help=_("query at event for a repo"))
|
||||
(options, args) = parser.parse_args(args)
|
||||
if len(args) != 0:
|
||||
parser.error(_("This command takes no arguments"))
|
||||
|
|
@ -2261,6 +2264,11 @@ def anon_handle_list_pkgs(options, session, args):
|
|||
opts['with_dups'] = options.show_dups
|
||||
else:
|
||||
opts['with_dups'] = True
|
||||
event = koji.util.eventFromOpts(session, options)
|
||||
if event:
|
||||
opts['event'] = event['id']
|
||||
event['timestr'] = time.asctime(time.localtime(event['ts']))
|
||||
print "Querying at event %(id)i (%(timestr)s)" % event
|
||||
data = session.listPackages(**opts)
|
||||
if not data:
|
||||
print "(no matching packages)"
|
||||
|
|
|
|||
|
|
@ -5752,7 +5752,7 @@ class RootExports(object):
|
|||
|
||||
getPackage = staticmethod(lookup_package)
|
||||
|
||||
def listPackages(self, tagID=None, userID=None, pkgID=None, prefix=None, inherited=False, with_dups=False):
|
||||
def listPackages(self, tagID=None, userID=None, pkgID=None, prefix=None, inherited=False, with_dups=False, event=None):
|
||||
"""List if tagID and/or userID is specified, limit the
|
||||
list to packages belonging to the given user or with the
|
||||
given tag.
|
||||
|
|
@ -5784,7 +5784,8 @@ class RootExports(object):
|
|||
if pkgID is not None:
|
||||
pkgID = get_package_id(pkgID,strict=True)
|
||||
result_list = readPackageList(tagID=tagID, userID=userID, pkgID=pkgID,
|
||||
inherit=inherited, with_dups=with_dups).values()
|
||||
inherit=inherited, with_dups=with_dups,
|
||||
event=event).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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue