From 53ba99e99b491e4142d8f9d7498f363739da80a6 Mon Sep 17 00:00:00 2001 From: Brendan Reilly Date: May 21 2018 19:46:03 +0000 Subject: Deprecating list-tag-history and tagHistory --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index a9c14ac..4d5096d 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -1608,10 +1608,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" % list(tags.keys())) for tag_name in tags: @@ -1630,7 +1630,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)) @@ -3886,6 +3886,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")) assert False # pragma: no cover diff --git a/hub/kojihub.py b/hub/kojihub.py index af87e77..dc42653 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -6845,7 +6845,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', diff --git a/util/koji-gc b/util/koji-gc index fa64f04..10dff69 100755 --- a/util/koji-gc +++ b/util/koji-gc @@ -486,7 +486,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: @@ -632,7 +632,7 @@ def handle_delete(just_salvage=False): # skip the rest when salvaging continue # determine how long this build has been in the trashcan - history = session.tagHistory(build=binfo['id'], tag=trashcan_tag) + history = session.queryHistory(build=binfo['id'], tag=trashcan_tag)['tag_listing'] current = [x for x in history if x['active']] if not current: #untagged just now? @@ -819,14 +819,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)