Better new-pocket affordances in invirtibuilder and build submission script 0.1.25
authorPeter Iannucci <iannucci@mit.edu>
Mon, 15 Jul 2013 18:56:26 +0000 (14:56 -0400)
committerPeter Iannucci <iannucci@mit.edu>
Mon, 15 Jul 2013 19:56:37 +0000 (15:56 -0400)
debian/changelog
invirtibuilder
python/invirt/builder.py

index 05878d4..ac05680 100644 (file)
@@ -1,3 +1,11 @@
+invirt-dev (0.1.25) unstable; urgency=low
+
+  * invirt-submit-build allows builds in new pockets
+  * invirtibuilder warns if super-repository does not contain the pocket
+    branch
+
+ -- Peter Iannucci <iannucci@mit.edu>  Mon, 15 Jul 2013 14:46:00 -0400
+
 invirt-dev (0.1.25~glasgall1) unstable; urgency=low
 
   * Build source packages in a chroot as well so that they can take
 invirt-dev (0.1.25~glasgall1) unstable; urgency=low
 
   * Build source packages in a chroot as well so that they can take
index 4e73484..699ce07 100755 (executable)
@@ -220,6 +220,9 @@ def updateSuperproject(pocket, package, commit, principal, version, env):
     pushes to the superproject.
     """
     superproject = os.path.join(b._REPO_DIR, 'invirt/packages.git')
     pushes to the superproject.
     """
     superproject = os.path.join(b._REPO_DIR, 'invirt/packages.git')
+    if not b.pocketExists(pocket, superproject):
+        raise Exception("Super-repository does not contain pocket branch '%s'.  Create it first." % pocket)
+
     branch = b.pocketToGit(pocket)
     tree = logAndRun(['git', 'ls-tree', branch],
                      cwd=superproject).strip()
     branch = b.pocketToGit(pocket)
     tree = logAndRun(['git', 'ls-tree', branch],
                      cwd=superproject).strip()
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()
 
     """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.
 
 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):
                                    (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:
         branch = pocketToGit(pocket)
         current_version = getVersion(package, branch)
         if new_version <= current_version: