[releng] block_retired: Move run_koji() to top level

Till Maas till at fedoraproject.org
Fri May 8 20:53:02 UTC 2015


commit 04a315311c4ef903567e6558e489650d9e1a53ea
Author: Till Maas <opensource at till.name>
Date:   Fri May 8 22:45:53 2015 +0200

    block_retired: Move run_koji() to top level
    
    Signed-off-by: Till Maas <opensource at till.name>

 scripts/block_retired.py |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/scripts/block_retired.py b/scripts/block_retired.py
index 41dd5d5..b2b1156 100755
--- a/scripts/block_retired.py
+++ b/scripts/block_retired.py
@@ -153,6 +153,17 @@ def get_retirement_info(message):
     return None
 
 
+def run_koji(koji_params, output=False, staging=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))
+    if output:
+        return subprocess.check_output(cmd)
+    else:
+        return subprocess.check_call(cmd)
+
+
 def block_package(packages, branch="master", staging=False):
     if isinstance(packages, basestring):
         packages = [packages]
@@ -160,16 +171,6 @@ def block_package(packages, branch="master", staging=False):
     if len(packages) == 0:
         return None
 
-    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))
-        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)
@@ -179,12 +180,12 @@ def block_package(packages, branch="master", staging=False):
     # FIXME: This introduces a theoretical race condition when a package is
     # built after all builds were untagged and before the package is blocked
     if epel_build_tag:
-        run_koji(["untag-build", "--all", tag] + packages)
+        run_koji(["untag-build", "--all", tag] + packages, staging=staging)
 
-    run_koji(["block-pkg", tag] + packages)
+    run_koji(["block-pkg", tag] + packages, staging=staging)
 
     if epel_build_tag:
-        run_koji(["unblock-pkg", epel_build_tag] + packages)
+        run_koji(["unblock-pkg", epel_build_tag] + packages, staging=staging)
 
 
 def handle_message(message, retiring_branches=RETIRING_BRANCHES,


More information about the rel-eng mailing list