[releng] block_retired: Check whether packages are in tag

Till Maas till at fedoraproject.org
Thu May 7 16:36:26 UTC 2015


commit c4dea7dc547bc0dcaa3112cc68d83feb5850ebb7
Author: Till Maas <opensource at till.name>
Date:   Thu May 7 18:33:57 2015 +0200

    block_retired: Check whether packages are in tag
    
    Signed-off-by: Till Maas <opensource at till.name>

 scripts/block_retired.py |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/scripts/block_retired.py b/scripts/block_retired.py
index 0fb5000..4e58335 100755
--- a/scripts/block_retired.py
+++ b/scripts/block_retired.py
@@ -157,17 +157,31 @@ def block_package(packages, branch="master", staging=False):
     if len(packages) == 0:
         return None
 
-    def run_koji(koji_params):
+    def run_koji(koji_params, output=False):
         url = PRODUCTION_KOJI if not staging else STAGING_KOJI
         koji_cmd = ["koji", "--server", url]
         cmd = koji_cmd + koji_params
         log.debug("Running: %s", " ".join(cmd))
-        return subprocess.check_call(cmd)
+        if output:
+            return subprocess.check_output(cmd)
+        else:
+            return subprocess.check_call(cmd)
 
     mapper = ReleaseMapper(staging=staging)
     tag = mapper.koji_tag(branch)
     epel_build_tag = mapper.epel_build_tag(branch)
 
+    # Due to race conditions, puppet:configs/system/owner-sync-pkgdb might not
+    # have added the package to the tag, e.g. for EPEL only packages. Therefore
+    # process only packages that are actually in the tag
+    for package in list(packages):
+        tags = run_koji(["list-tags", "--package", package],
+                        output=True).splitlines()
+        if tag not in tags:
+            packages.remove(package)
+    if not packages:
+        return None
+
     # Untag builds first due to koji/mash bug:
     # https://fedorahosted.org/koji/ticket/299
     # FIXME: This introduces a theoretical race condition when a package is


More information about the rel-eng mailing list