Deprecating list-tag-history and tagHistory
This commit is contained in:
parent
8f454e2390
commit
74e085572e
3 changed files with 15 additions and 8 deletions
|
|
@ -1613,10 +1613,10 @@ def handle_prune_signed_copies(options, session, args):
|
|||
is_protected = False
|
||||
last_latest = None
|
||||
tags = {}
|
||||
for entry in session.tagHistory(build=binfo['id']):
|
||||
#we used tagHistory rather than listTags so we can consider tags
|
||||
for entry in session.queryHistory(build=binfo['id'])['tag_listing']:
|
||||
#we used queryHistory rather than listTags so we can consider tags
|
||||
#that the build was recently untagged from
|
||||
tags.setdefault(entry['tag_name'], 1)
|
||||
tags.setdefault(entry['tag.name'], 1)
|
||||
if options.debug:
|
||||
print("Tags: %s" % to_list(tags.keys()))
|
||||
for tag_name in tags:
|
||||
|
|
@ -1635,7 +1635,7 @@ def handle_prune_signed_copies(options, session, args):
|
|||
continue
|
||||
#in order to determine how recently this build was latest, we have
|
||||
#to look at the tagging history.
|
||||
hist = session.tagHistory(tag=tag_name, package=binfo['name'])
|
||||
hist = session.queryHistory(tag=tag_name, package=binfo['name'])['tag_listing']
|
||||
if not hist:
|
||||
#really shouldn't happen
|
||||
raise koji.GenericError("No history found for %s in %s" % (nvr, tag_name))
|
||||
|
|
@ -4023,6 +4023,9 @@ def anon_handle_list_tag_history(goptions, session, args):
|
|||
parser.add_option("--tag", help=_("Only show data for a specific tag"))
|
||||
parser.add_option("--all", action="store_true", help=_("Allows listing the entire global history"))
|
||||
(options, args) = parser.parse_args(args)
|
||||
koji.util.deprecated("list-tag-history is deprecated and will be removed in a future version. "
|
||||
"See: https://pagure.io/koji/issue/836")
|
||||
|
||||
if len(args) != 0:
|
||||
parser.error(_("This command takes no arguments"))
|
||||
kwargs = {}
|
||||
|
|
|
|||
|
|
@ -7545,7 +7545,11 @@ def tag_history(build=None, tag=None, package=None, active=None, queryOpts=None)
|
|||
package: only for given package
|
||||
build: only for given build
|
||||
tag: only for given tag
|
||||
|
||||
Deprecated; will be removed in a future version
|
||||
See: https://pagure.io/koji/issue/836
|
||||
"""
|
||||
logger.warning("The tag_history call is deprecated and will be removed in a future version.")
|
||||
fields = ('build.id', 'package.name', 'build.version', 'build.release',
|
||||
'tag.id', 'tag.name', 'tag_listing.active',
|
||||
'tag_listing.create_event', 'tag_listing.revoke_event',
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ def handle_trash():
|
|||
if age < min_age:
|
||||
continue
|
||||
#see how long build has been untagged
|
||||
history = session.tagHistory(build=binfo['id'])
|
||||
history = session.queryHistory(build=binfo['id'])['tag_listing']
|
||||
age = None
|
||||
binfo2 = None
|
||||
if not history:
|
||||
|
|
@ -662,7 +662,7 @@ def handle_delete(just_salvage=False):
|
|||
continuing, trash = [], continuing
|
||||
for nvr, binfo in trash:
|
||||
# determine how long this build has been in the trashcan
|
||||
mcall.tagHistory(build=binfo['id'], tag=trashcan_tag)
|
||||
mcall.queryHistory(build=binfo['id'], tag=trashcan_tag)['tag_listing']
|
||||
|
||||
for (nvr, binfo), [history] in zip(trash, mcall.call_all()):
|
||||
current = [x for x in history if x['active']]
|
||||
|
|
@ -853,14 +853,14 @@ def handle_prune():
|
|||
if options.debug:
|
||||
print("Pruning tag: %s" % tagname)
|
||||
#get builds
|
||||
history = session.tagHistory(tag=tagname, active=True, queryOpts={'order': '-create_ts'})
|
||||
history = session.queryHistory(tag=tagname, active=True)['tag_listing']
|
||||
if not history:
|
||||
if options.debug:
|
||||
print("No history for %s" % tagname)
|
||||
continue
|
||||
pkghist = {}
|
||||
for h in history:
|
||||
if taginfo['maven_include_all'] and h['maven_build_id']:
|
||||
if taginfo['maven_include_all'] and h.get('maven_build_id', default=None):
|
||||
pkghist.setdefault(h['name'] + '-' + h['version'], []).append(h)
|
||||
else:
|
||||
pkghist.setdefault(h['name'], []).append(h)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue