Use the expanded commit name internally
[invirt/packages/invirt-dev.git] / invirtibuilder
index d2a571c..24861f5 100755 (executable)
@@ -113,11 +113,11 @@ def aptCopy(package, commit, dst_pocket, src_pocket):
 
 def sbuild(package, ref, arch, workdir, arch_all=False):
     """Build a package for a particular architecture."""
-    args = ['sbuild', '-d', DISTRIBUTION, '--arch', arch]
+    args = ['sbuild', '-v', '-d', DISTRIBUTION, '--arch', arch]
     if arch_all:
         args.append('-A')
     args.append(getDscName(package, ref))
-    c.captureOutput(args, cwd=workdir, stdout=None)
+    c.captureOutput(args, cwd=workdir)
 
 
 def sbuildAll(package, ref, workdir):
@@ -288,11 +288,11 @@ def build():
 
         try:
             db.failed_stage = 'validating job'
-            src = b.validateBuild(pocket, package, commit)
             # Don't expand the commit in the DB until we're sure the user
             # isn't trying to be tricky.
-            db.commit = commit = c.captureOutput(['git', 'rev-parse', commit],
-                                                 cwd=b.getRepo(package)).strip()
+            b.ensureValidPackage(package)
+            db.commit = commit = b.canonicalize_commit(package, commit)
+            src = b.validateBuild(pocket, package, commit)
 
             db.version = str(b.getVersion(package, commit))
 
@@ -332,8 +332,8 @@ def build():
                         if not os.path.exists(logdir):
                             os.makedirs(logdir)
 
-                        for log in glob.glob(os.path.join(workdir, '*.build')):
-                            os.copy2(log, logdir)
+                        for log in glob.glob(os.path.join(workdir, 'build-*.log')):
+                            os.copy(log, logdir)
 
                     db.failed_stage = 'processing metadata'
                     env = dict(os.environ)