[projects/pld-builder.new/new-builddir-new: 17/21] - use topdir in /tmp not to depend on $HOME outside chroot

draenog draenog at pld-linux.org
Mon Oct 29 11:58:25 CET 2012


commit a73fab54b4be5b1f6aad1ff1f80e25b64afaa855
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Sat Oct 27 16:28:40 2012 +0200

    - use topdir in /tmp not to depend on $HOME outside chroot

 PLD_Builder/request.py     | 2 +-
 PLD_Builder/rpm_builder.py | 2 +-
 PLD_Builder/util.py        | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/PLD_Builder/request.py b/PLD_Builder/request.py
index 21bc600..6cbb06f 100644
--- a/PLD_Builder/request.py
+++ b/PLD_Builder/request.py
@@ -173,7 +173,7 @@ class Batch:
 
         self.parse_xml(e)
 
-        self._topdir = os.path.abspath(os.path.join(os.environ.get('HOME'), 'rpmbuild', self.b_id))
+        self._topdir = '/tmp/B.%s' % self.b_id
 
     def parse_xml(self, e):
         for c in e.childNodes:
diff --git a/PLD_Builder/rpm_builder.py b/PLD_Builder/rpm_builder.py
index 2323af9..7235268 100644
--- a/PLD_Builder/rpm_builder.py
+++ b/PLD_Builder/rpm_builder.py
@@ -238,7 +238,7 @@ def build_rpm(r, b):
                 b.log_line("ended at: %s, done in %s" % (time.asctime(), datetime.timedelta(0, end_time - begin_time)))
                 if res:
                     res = "FAIL"
-                files = util.collect_files(b.logfile)
+                files = util.collect_files(b.logfile, basedir = b._topdir)
                 if len(files) > 0:
                     r.chroot_files.extend(files)
                 else:
diff --git a/PLD_Builder/util.py b/PLD_Builder/util.py
index 316a8f1..9051878 100644
--- a/PLD_Builder/util.py
+++ b/PLD_Builder/util.py
@@ -49,9 +49,9 @@ def clean_tmp(dir):
     # FIXME: use python
     os.system("rm -f %s/* 2>/dev/null; rmdir %s 2>/dev/null" % (dir, dir))
 
-def collect_files(log):
+def collect_files(log, basedir = "/home"):
     f = open(log, 'r')
-    rx = re.compile(r"^Wrote: (/home.*\.rpm)$")
+    rx = re.compile(r"^Wrote: (%s.*\.rpm)$" % basedir)
     files = []
     for l in f.xreadlines():
         m = rx.search(l)
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/pld-builder.new.git/commitdiff/6fbf8d5befabd83f4260bf17d230d8b32ec42ec2



More information about the pld-cvs-commit mailing list