]> git.ipfire.org Git - pakfire.git/commitdiff
Rework BUILDROOT.
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 27 Sep 2011 09:13:12 +0000 (11:13 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 27 Sep 2011 09:13:12 +0000 (11:13 +0200)
The buildroot directory was accidentially removed when a build
had an error.

macros/constants.macro
macros/quality-agent.macro
pakfire/base.py
pakfire/builder.py
pakfire/packages/make.py

index f7bcfd74ee73df10ae85d9bad39dc56345348149..27e086baeda84425604e50fc6894575016d82492 100644 (file)
@@ -1,9 +1,6 @@
 
-# XXX just for now
-PARALLELISMFLAGS = -j2
-
+BUILDROOT   = %{DIR_TMP}/buildroot_%{name}-%{thisver}
 BASEDIR     = /build
-BUILDROOT   = /buildroot
 
 DIR_APP     = %{DIR_SRC}/%{thisapp}
 DIR_DL      = %{BASEDIR}/files
index b82cba96b3afda1a5285bea1555c581126a804d7..a2e6b2627acb43fe546aac340f7b594503e48618 100644 (file)
@@ -7,7 +7,7 @@
 
 # Macro to define and start the quality agent.
 # Long term goal is to improve the commited code.
-MACRO_QUALITY_AGENT = /usr/lib/pakfire/quality-agent
+MACRO_QUALITY_AGENT = BUILDROOT=%{BUILDROOT} /usr/lib/pakfire/quality-agent
 
 # XXX to be moved to some place else
 #export QUALITY_AGENT_NO_DIRECTORY_CHECK
index 3753477cbe3063a30ad159c241fa2b5104537d51..b2c2fed3960e69dcb422cc76fb9efa6fc409956a 100644 (file)
@@ -452,8 +452,9 @@ class Pakfire(object):
                        b.build()
                except Error:
                        raise BuildError, _("Build command has failed.")
-               finally:
-                       b.cleanup()
+
+               # If the build was successful, cleanup all temporary files.
+               b.cleanup()
 
        @staticmethod
        def shell(pkg, **kwargs):
index 3acfe64e1fec2891f014d4c95ae5b2111721a06e..0633cf8cb7b0f5db5c19c5bc8fadee69a13880d3 100644 (file)
@@ -132,8 +132,6 @@ class BuildEnviron(object):
                }
                #self.settings.update(settings)
 
-               self.buildroot = "/buildroot"
-
                # Lock the buildroot
                self._lock = None
                self.lock()
@@ -436,7 +434,7 @@ class BuildEnviron(object):
                logging.debug("Cleaning environemnt.")
 
                # Remove the build directory and buildroot.
-               dirs = ("build", self.buildroot, "result")
+               dirs = ("build", "result")
 
                for d in dirs:
                        d = self.chrootPath(d)
@@ -519,9 +517,6 @@ class BuildEnviron(object):
                        "TERM" : os.environ.get("TERM", "dumb"),
                        "PS1"  : "\u:\w\$ ",
 
-                       "BUILDROOT" : self.buildroot,
-                       "PARALLELISMFLAGS" : "-j%s" % util.calc_parallelism(),
-
                        # Set the container that we can detect, if we are inside a
                        # chroot.
                        "container" : "pakfire-builder",
@@ -644,14 +639,15 @@ class Builder(object):
                # Open package file.
                self.pkg = packages.Makefile(self.pakfire, self.filename)
 
-               #self.buildroot = "/tmp/pakfire_buildroot/%s" % util.random_string(20)
-               self.buildroot = "/buildroot"
-
                self._environ = {
-                       "BUILDROOT" : self.buildroot,
-                       "LANG"      : "C",
+                       "LANG"             : "C",
+                       "PARALLELISMFLAGS" : "-j%s" % util.calc_parallelism(),
                }
 
+       @property
+       def buildroot(self):
+               return self.pkg.buildroot
+
        @property
        def distro(self):
                return self.pakfire.distro
index 66cc0bf021868d386e5f9a1e5c638b7c0fbceace..e422b21682d3ab6b3da80964284cdf99de06ae64 100644 (file)
@@ -80,7 +80,6 @@ class MakefileBase(Package):
                self.filename = os.path.abspath(filename)
 
                # Open and parse the makefile.
-               # XXX pass environment to lexer
                self.lexer = lexer.RootLexer.open(self.filename,
                        environ=self.pakfire.environ)
 
@@ -171,6 +170,10 @@ class MakefileBase(Package):
        def vendor(self):
                return self.lexer.get_var("DISTRO_VENDOR")
 
+       @property
+       def buildroot(self):
+               return self.lexer.get_var("BUILDROOT")
+
        @property
        def build_host(self):
                return socket.gethostname()