make the wait-repo command wait for the specified build(s) to be the latest in the tag, rather than just being present in the tag
This commit is contained in:
parent
89d8055731
commit
a6c16232a7
2 changed files with 9 additions and 5 deletions
4
cli/koji
4
cli/koji
|
|
@ -5484,7 +5484,7 @@ def anon_handle_wait_repo(options, session, args):
|
|||
usage += _("\n(Specify the --help global option for a list of other help options)")
|
||||
parser = OptionParser(usage=usage)
|
||||
parser.add_option("--build", metavar="NVR", dest="builds", action="append", default=[],
|
||||
help=_("Check that the given build (or a later build of the same package) is in the newly-generated repo (may be used multiple times)"))
|
||||
help=_("Check that the given build is in the newly-generated repo (may be used multiple times)"))
|
||||
parser.add_option("--target", action="store_true", help=_("Interpret the argument as a build target name"))
|
||||
parser.add_option("--timeout", type="int", help=_("Amount of time to wait (in minutes) before giving up (default: 120)"), default=120)
|
||||
parser.add_option("--quiet", action="store_true", help=_("Suppress output, success or failure will be indicated by the return value only"), default=options.quiet)
|
||||
|
|
@ -5527,7 +5527,7 @@ def anon_handle_wait_repo(options, session, args):
|
|||
|
||||
while True:
|
||||
if builds and repo and repo != last_repo:
|
||||
if koji.util.checkForBuilds(session, tag_id, builds, repo['create_event']):
|
||||
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)
|
||||
return
|
||||
|
|
|
|||
10
koji/util.py
10
koji/util.py
|
|
@ -70,10 +70,14 @@ def parseTime(val):
|
|||
time = [int(r) for r in result.groups()]
|
||||
return calendar.timegm(date + time + [0, 0, 0])
|
||||
|
||||
def checkForBuilds(session, tag, builds, event):
|
||||
"""Check that the builds existed in tag at the time of the event."""
|
||||
def checkForBuilds(session, tag, builds, event, latest=False):
|
||||
"""Check that the builds existed in tag at the time of the event.
|
||||
If latest=True, check that the builds are the latest in tag."""
|
||||
for build in builds:
|
||||
tagged_list = session.listTagged(tag, event=event, package=build['name'], inherit=True)
|
||||
if latest:
|
||||
tagged_list = session.getLatestBuilds(tag, event=event, package=build['name'])
|
||||
else:
|
||||
tagged_list = session.listTagged(tag, event=event, package=build['name'], inherit=True)
|
||||
for tagged in tagged_list:
|
||||
if tagged['version'] == build['version'] and tagged['release'] == build['release']:
|
||||
break
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue