Allow a backtracking branch to upload any package version
authorGreg Brockman <gdb@mit.edu>
Tue, 6 Jul 2010 04:28:30 +0000 (00:28 -0400)
committerGreg Brockman <gdb@mit.edu>
Tue, 6 Jul 2010 04:28:30 +0000 (00:28 -0400)
svn path=/trunk/packages/invirt-dev/; revision=3044

invirtibuilder

index ca12398..e1c3d80 100755 (executable)
@@ -166,13 +166,19 @@ def updateSubmoduleBranch(pocket, package, commit):
 
 def uploadBuild(pocket, workdir):
     """Upload all build products in the work directory."""
+    force = config.build.pockets[pocket].get('allow_backtracking', False)
     apt = b.pocketToApt(pocket)
     for changes in glob.glob(os.path.join(workdir, '*.changes')):
-        c.captureOutput(['reprepro-env',
-                       '--ignore=wrongdistribution',
-                       'include',
-                       apt,
-                       changes])
+        upload = ['reprepro-env', '--ignore=wrongdistribution',
+                  'include', apt, changes]
+        try:
+            c.captureOutput(upload)
+        except subprocess.CalledProcessError, e:
+            if not force:
+                raise
+            package = deb822.Changes(open(changes).read())['Binary']
+            c.captureOutput(['reprepro-env', 'remove', apt, package])
+            c.captureOutput(upload)
 
 
 def updateSuperproject(pocket, package, commit, principal, version, env):