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
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)
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:
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)
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))