[projects/pld-builder.new] - make tmpdir unique and always create it and clean it up
baggins
baggins at pld-linux.org
Fri Oct 19 07:37:52 CEST 2012
commit d0825796dad39e5e611585468b2adff16c4f0895
Author: Jan Rękorajski <baggins at pld-linux.org>
Date: Fri Oct 19 07:37:24 2012 +0200
- make tmpdir unique and always create it and clean it up
PLD_Builder/install.py | 12 ++++++++++--
PLD_Builder/rpm_builder.py | 2 +-
2 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/PLD_Builder/install.py b/PLD_Builder/install.py
index 91cc889..b0b03e4 100644
--- a/PLD_Builder/install.py
+++ b/PLD_Builder/install.py
@@ -101,7 +101,8 @@ def uninstall(conflicting, b):
def uninstall_self_conflict(b):
b.log_line("checking BuildConflict-ing packages")
packagename = b.spec[:-5]
- tmpdir = os.environ.get('HOME') + "/rpm/BUILD/%s/tmp" % packagename
+ tmpdir = os.environ.get('HOME') + "/rpm/BUILD/%s.%s/tmp" % packagename, b.b_id[0:6]
+ chroot.run("install -m 700 -d %s" % tmpdir)
f = chroot.popen("set -e; TMPDIR=%(tmpdir)s rpmbuild -bp --nobuild --short-circuit --define 'prep exit 0' %(rpmdefs)s rpm/packages/%(package)s/%(spec)s 2>&1" % {
'tmpdir': tmpdir,
'rpmdefs' : b.rpmbuild_opts(),
@@ -119,8 +120,10 @@ def uninstall_self_conflict(b):
conflicting[m.group('name')] = 1
f.close()
if len(conflicting) and not uninstall(conflicting, b):
+ chroot.run("rm -rf %s" % tmpdir)
return False
b.log_line("no BuildConflicts found")
+ chroot.run("rm -rf %s" % tmpdir)
return True
def install_br(r, b):
@@ -129,7 +132,7 @@ def install_br(r, b):
ignore_br = re.compile(r'^\s*(rpmlib|cpuinfo|getconf|uname|soname|user|group|mounted|diskspace|digest|gnupg|macro|envvar|running|sanitycheck|vcheck|signature|verify|exists|executable|readable|writable)\(.*')
packagename = b.spec[:-5]
- tmpdir = os.environ.get('HOME') + "/rpm/BUILD/%s/tmp" % packagename
+ tmpdir = os.environ.get('HOME') + "/rpm/BUILD/%s.%s/tmp" % packagename, b.b_id[0:6]
chroot.run("install -m 700 -d %s" % tmpdir)
cmd = "set -e; TMPDIR=%(tmpdir)s rpmbuild --nobuild %(rpmdefs)s rpm/packages/%(package)s/%(spec)s 2>&1" % {
'tmpdir': tmpdir,
@@ -147,12 +150,14 @@ def install_br(r, b):
if m and not ignore_br.match(l):
needed[m.group('name')] = 1
f.close()
+ chroot.run("rm -rf %s" % tmpdir)
return needed
needed = get_missing_br(r, b);
if len(needed) == 0:
b.log_line("no BR needed")
+ chroot.run("rm -rf %s" % tmpdir)
return True
nbr = ""
@@ -178,6 +183,7 @@ def install_br(r, b):
b.log_line("no conflicts found")
else:
if not uninstall(conflicting, b):
+ chroot.run("rm -rf %s" % tmpdir)
return False
# recheck BuildRequires since above uninstallation could remove some required deps
@@ -185,6 +191,7 @@ def install_br(r, b):
if len(needed) == 0:
b.log_line("no BR needed")
+ chroot.run("rm -rf %s" % tmpdir)
return True
nbr = ""
@@ -196,6 +203,7 @@ def install_br(r, b):
res = chroot.run("poldek --noask --caplookup -Q -v --upgrade %s" % br,
user = "root",
logfile = b.logfile)
+ chroot.run("rm -rf %s" % tmpdir)
if res != 0:
b.log_line("error: BR installation failed")
return False
diff --git a/PLD_Builder/rpm_builder.py b/PLD_Builder/rpm_builder.py
index c41fbc3..17b6a6b 100644
--- a/PLD_Builder/rpm_builder.py
+++ b/PLD_Builder/rpm_builder.py
@@ -194,7 +194,7 @@ def build_rpm(r, b):
# it's better to have TMPDIR and BUILD dir on same partition:
# + /usr/bin/bzip2 -dc /home/services/builder/rpm/packages/kernel/patch-2.6.27.61.bz2
# patch: **** Can't rename file /tmp/B.a1b1d3/poKWwRlp to drivers/scsi/hosts.c : No such file or directory
- tmpdir = os.environ.get('HOME') + "/rpm/BUILD/%s/tmp" % packagename
+ tmpdir = os.environ.get('HOME') + "/rpm/BUILD/%s.%s/tmp" % packagename, b.b_id[0:6]
if res:
b.log_line("error: installing src rpm failed")
res = "FAIL_SRPM_INSTALL"
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/d0825796dad39e5e611585468b2adff16c4f0895
More information about the pld-cvs-commit
mailing list