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 = "set -x; echo SKIPME; echo SKIPME >&2;"
+ 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;\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)
+ c = "%s >> %s 2>&1" % (command, batch.logfile)
f = os.popen(c)
for l in f.xreadlines():
pass
user = "root"
if "as-builder" in batch.command_flags:
user = "builder"
- return chroot.run(batch.command, logfile = batch.logfile, user = user)
+ return chroot.run(command, logfile = batch.logfile, user = user)
def build_all(r, build_fnc):
status.email = r.requester_email
return
for batch in r.batches:
+
if not user.can_do("src", config.builder, batch.branch):
fail_mail("user %s is not allowed to src:%s:%s" \
% (user.get_login(), config.builder, batch.branch))
return
# src builder handles only special commands
- if batch.is_command() and (batch.command in ["cvs up"] or config.builder in batch.builders):
+ if batch.is_command() and (batch.command in ["cvs up"] or batch.command[:5] == "skip:" or config.builder in batch.builders):
batch.expand_builders(config.binary_builders + [config.src_builder])
else:
batch.expand_builders(config.binary_builders)
- if batch.skip:
- msg = ""
- for id in batch.skip:
- if os.path.isdir(path.srpms_dir + '/' + id):
- fd = open(path.srpms_dir + '/' + id + '/skipme', 'w')
- fd.write("skip request %s" % (user.get_login()))
- fd.close()
- log.notice("skip request %s by %s" % (id, user.get_login()))
- msg = msg + "skip %s\n" % id
- else:
- msg = msg + "no srpm dir for %s\n" % id
-
- m = user.message_to()
- m.set_headers(subject = "skip request")
- m.write_line(msg)
- m.send()
-
- lockf.close()
- return
-
if not batch.is_command() and config.builder in batch.builders:
batch.builders.remove(config.builder)
;;
-s|--skip)
- f_upgrade=no
- build_mode=test
- priority=-1
- skip=$2
+ skip="$2"
shift
;;
;;
esac
+# need to do this after distro selection
+if [ "$skip" ]; then
+ f_upgrade=no
+ build_mode=test
+ priority=-1
+ command="skip:$skip"
+ command_flags="no-chroot"
+ builders="$distro-src"
+fi
+
branch=${branch:-$default_branch}
specs=`for s in $specs; do
done
if [ "$ok" = "" ] ; then
- if [ -z "$command" -a -z "$skip" ]; then
+ if [ -z "$command" ]; then
die "no specs passed"
fi
else
echo " <builder>$b</builder>"
done
echo " </batch>"
-
- elif [ "$skip" ]; then
- bid=$(uuidgen)
- echo " <batch id='$bid' depends-on=''>"
- for s in {$skip,}; do
- [ "$s" ] || continue
- echo >&2 "* Skip: $s"
- echo "<skip>$s</skip>"
- done
- echo " </batch>"
else
echo >&2 "* Using priority $priority"