Better new-pocket affordances in invirtibuilder and build submission script
[invirt/packages/invirt-dev.git] / python / invirt / builder.py
index f864feb..8e24faf 100644 (file)
@@ -106,6 +106,13 @@ def getVersion(package, ref):
     """Get the version of a given package at a particular ref."""
     return getChangelog(package, ref).get_version()
 
+def pocketExists(pocket, repo):
+    branch = pocketToGit(pocket)
+    try:
+        c.captureOutput(['git', 'rev-parse', branch], cwd=repo)
+    except subprocess.CalledProcessError:
+        return False
+    return True
 
 def validateBuild(pocket, package, commit):
     """Given the parameters of a new build, validate that build.
@@ -167,6 +174,9 @@ def validateBuild(pocket, package, commit):
                                    (new_version, package, p, current_commit))
 
     if not config.build.pockets[pocket].get('allow_backtracking', False):
+        if not pocketExists(pocket, package_repo):
+            return True
+
         branch = pocketToGit(pocket)
         current_version = getVersion(package, branch)
         if new_version <= current_version: