From b37853be89247571d3b4bd05c6192c9c300e3a92 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Jun 23 2020 09:11:49 +0000 Subject: [PATCH 1/2] koji-gc: fix py3 compare behaviour for dicts Fixes: https://pagure.io/koji/issue/2325 --- diff --git a/util/koji-gc b/util/koji-gc index 87b7b86..07c693a 100755 --- a/util/koji-gc +++ b/util/koji-gc @@ -526,8 +526,11 @@ def handle_trash(): else: age = time.time() - ts else: - history = [(h['revoke_event'], h) for h in history] - last = max(history)[1] + last = history[0] + for h in history: + actual = h['revoke_event'] or 0 + if not last['revoke_event'] or actual > last['revoke_event']: + last = h if not last['revoke_event']: # this might happen if the build was tagged just now print("[%i/%i] Warning: build not untagged: %s" % (i, N, nvr)) From 7bbc49581264149be28d57d1723409b46b47f4a7 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Jun 23 2020 09:14:40 +0000 Subject: [PATCH 2/2] koji-gc: check retagged builds correctly --- diff --git a/util/koji-gc b/util/koji-gc index 07c693a..5bb8f73 100755 --- a/util/koji-gc +++ b/util/koji-gc @@ -526,12 +526,15 @@ def handle_trash(): else: age = time.time() - ts else: + tagged = False last = history[0] for h in history: - actual = h['revoke_event'] or 0 - if not last['revoke_event'] or actual > last['revoke_event']: + if not h['revoke_event']: + tagged = True + break + if h['revoke_event'] > last['revoke_event']: last = h - if not last['revoke_event']: + if tagged: # this might happen if the build was tagged just now print("[%i/%i] Warning: build not untagged: %s" % (i, N, nvr)) continue