b.log_line(msg)
return False
except urllib2.URLError, error:
- # see errno.h
- try:
- errno = error.errno
- except AttributeError:
- # python 2.4
- errno = error.reason[0]
+ errno = 0
+ if isinstance(error.args[0], IOError):
+ errno = error.args[0].errno
if errno in [-3, 60, 61, 110, 111]:
b.log_line("unable to connect to %s... trying again" % (src_url))
continue
else:
+ try:
+ print "error.errno: %s" % str(error.errno)
+ except Exception, e:
+ print "error.errno: exception %s" % e
+ try:
+ print "error.reason %s" % str(error.reason)
+ except Exception, e:
+ print "error.reason exception %s" % e
raise
o = chroot.popen("cat > %s" % b.src_rpm, mode = "w")
res = chroot.run("""
set -ex;
install -d %(topdir)s/{BUILD,RPMS};
+ LC_ALL=en_US.UTF-8 rpm -qp --changelog %(src_rpm)s;
rpm -Uhv --nodeps %(rpmdefs)s %(src_rpm)s;
rm -f %(src_rpm)s;
""" % {
res = "FAIL_SRPM_INSTALL"
else:
prepare_env()
- chroot.run("install -m 700 -d %s" % tmpdir)
-
+ chroot.run("set -x; install -m 700 -d %s" % tmpdir, logfile=b.logfile)
b.default_target(config.arch)
# check for build arch before filling BR
cmd = "set -ex; TMPDIR=%(tmpdir)s exec nice -n %(nice)s " \
if r.max_jobs > 0:
max_jobs = max(min(config.max_jobs, r.max_jobs), 1)
cmd = "set -ex; : build-id: %(r_id)s; TMPDIR=%(tmpdir)s exec nice -n %(nice)s " \
- "rpmbuild -bb --define '_smp_mflags -j%(max_jobs)d' %(rpmdefs)s %(topdir)s/%(spec)s" % {
+ "rpmbuild -bb --define '_smp_mflags -j%(max_jobs)d' --define '_make_opts -Otarget' --define '_pld_builder 1' %(rpmdefs)s %(topdir)s/%(spec)s" % {
'r_id' : r.id,
'tmpdir': tmpdir,
'nice' : config.nice,
res = "FAIL_%s" % last_section.upper()
b.files = files
+ # cleanup tmp and build files
chroot.run("""
set -ex;
- rpmbuild --nodeps --nobuild --clean --rmspec --rmsource %(rpmdefs)s %(topdir)s/%(spec)s;
- rm -rf %(tmpdir)s;
chmod -R u+rwX %(topdir)s/BUILD;
- rm -rf %(topdir)s/BUILD;
+ rm -rf %(topdir)s/{tmp,BUILD}
""" % {
- 'tmpdir' : tmpdir,
- 'spec': b.spec,
'topdir' : b._topdir,
- 'rpmdefs' : b.rpmbuild_opts()
}, logfile = b.logfile)
def ll(l):
chroot.cp(f, outfile = local, rm = True)
ftp.add(local)
+ # cleanup all remains from this build
+ chroot.run("""
+ set -ex;
+ rm -rf %(topdir)s;
+ """ % {
+ 'topdir' : b._topdir,
+ }, logfile = b.logfile)
+
def uploadinfo(b):
c="file:SRPMS:%s\n" % b.src_rpm
for f in b.files:
f.close()
l.close()
else:
+ # be able to avoid locking with very low priority
+ if req.priority > -1000:
+ # don't kill server
+ check_load()
+ # allow only one build in given builder at once
+ if not lock.lock("building-high-priority-rpm-for-%s" % config.builder, non_block = 1):
+ return
+
msg = "HIGH PRIORITY: "
msg += "handling request %s (%d) for %s from %s, priority %s" \