From 4ddbebc2db22d322ffb29c5f75360f8edcfc317f Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Sep 15 2022 21:21:12 +0000 Subject: Consistent order of users in pagure_owner_alias.json Before this commit users were returned in a random order list. See https://pagure.io/fedora-infrastructure/issue/10445#comment-772182 for the screenshot. --- diff --git a/scripts/pagure_owner_alias.py b/scripts/pagure_owner_alias.py index 9fc0d01..5924962 100644 --- a/scripts/pagure_owner_alias.py +++ b/scripts/pagure_owner_alias.py @@ -70,7 +70,7 @@ def main(args): for entry in query.all(): namespace, package, admin = entry - output[namespace][package] = set([admin]) + output[namespace][package] = [admin] # Add the users with commit and admin ACLs @@ -89,16 +89,11 @@ def main(args): for entry in query.all(): namespace, package, user = entry - output[namespace][package].add(user) - - # Convert the sets into lists - final = collections.defaultdict(dict) - for ns in output: - for pkg in output[ns]: - final[ns][pkg] = list(output[ns][pkg]) + if user not in output[namespace][package]: + output[namespace][package].append(user) with open(os.path.join(args[0], "pagure_owner_alias.json"), "w") as stream: - json.dump(final, stream, indent=4, sort_keys=True) + json.dump(output, stream, indent=4, sort_keys=True) session.remove()