]> git.pld-linux.org Git - projects/pld-builder.new.git/blobdiff - PLD_Builder/build.py
Switch to https for client/request handler server and between builders communication...
[projects/pld-builder.new.git] / PLD_Builder / build.py
index 15a472593bfdda6a93c0792a22c58fa47b1440e8..a7c281b2f78a42fd186dfd66a0da28b9a61d2722 100644 (file)
@@ -16,9 +16,25 @@ import status
 from config import config, init_conf
 
 
+
 def run_command(batch):
+    # we want to keep "skip" in queue.html
+    command = batch.command
+
+    # rewrite special "skip:BUILD_ID into touch
+    if command[:5] == "skip:":
+        c = ""
+        for id in command[5:].split(','):
+            if os.path.isdir(path.srpms_dir + '/' + id):
+                c = c + "echo skip:%s;\n" % (id)
+                c = c + "touch %s/%s/skipme;\n" % (path.srpms_dir, id)
+            else:
+                c = c + "echo %s is not valid build-id;\n" % (id)
+        command = c
+
     if "no-chroot" in batch.command_flags:
-        c = "%s >> %s 2>&1" % (batch.command, batch.logfile)
+        # TODO: the append here by shell hack should be solved in python
+        c = "(%s) >> %s 2>&1" % (command, batch.logfile)
         f = os.popen(c)
         for l in f.xreadlines():
             pass
@@ -30,13 +46,13 @@ def run_command(batch):
     else:
         user = "root"
         if "as-builder" in batch.command_flags:
-            user = "builder"
-        return chroot.run(batch.command, logfile = batch.logfile, user = user)
+            user = None
+        return chroot.run(command, logfile = batch.logfile, user = user)
 
 def build_all(r, build_fnc):
     status.email = r.requester_email
     notify.begin(r)
-    tmp = path.build_dir + util.uuid() + "/"
+    tmp = path.build_dir + '/' + util.uuid() + "/"
     r.tmp_dir = tmp
     os.mkdir(tmp)
     atexit.register(util.clean_tmp, tmp)
@@ -51,7 +67,7 @@ def build_all(r, build_fnc):
             if dep.build_failed:
                 can_build = 0
                 failed_dep = dep.spec
-        
+
         if batch.is_command() and can_build:
             batch.logfile = tmp + "command"
             if config.builder in batch.builders:
@@ -83,11 +99,11 @@ def build_all(r, build_fnc):
             batch.requester_email=r.requester_email
             batch.build_failed = build_fnc(r, batch)
             if batch.build_failed:
-                log.notice("building %s FAILED" % batch.spec)
-                notify.add_batch(batch, "FAIL")
+                log.notice("building %s FAILED (%s)" % (batch.spec, batch.build_failed))
+                notify.add_batch(batch, batch.build_failed)
             else:
                 r.some_ok = 1
-                log.notice("building %s OK" % batch.spec)
+                log.notice("building %s OK" % (batch.spec))
                 notify.add_batch(batch, "OK")
             batch.build_time = stopwatch.stop()
             report.add_pld_builder_info(batch)
@@ -99,6 +115,6 @@ def build_all(r, build_fnc):
             batch.build_time = ""
             log.notice("building %s %s" % (batch.spec, batch.skip_reason))
             notify.add_batch(batch, "SKIP")
-            
+
     buildlogs.flush()
     chroot.run("rm -f %s" % string.join(r.chroot_files))
This page took 0.069434 seconds and 4 git commands to generate.