]> git.ipfire.org Git - pakfire.git/commitdiff
Better cleanup for build environments.
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Feb 2011 08:04:10 +0000 (09:04 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 26 Feb 2011 08:04:10 +0000 (09:04 +0100)
Build environments where not cleaned up completely if an exception
was raised or the user interupted the build.

pakfire/__init__.py
pakfire/builder.py

index ced0aae8e21346478ba61b3374e8d5af1c69447f..57630ce04b448496a1e47779c3669486d088fc4a 100644 (file)
@@ -114,9 +114,10 @@ class Pakfire(object):
                resultdirs.append(self.repos.local_build.path)
 
                b = builder.Builder(pakfire=self, pkg=pkg)
-               b.extract()
 
                try:
+                       b.prepare()
+                       b.extract()
                        b.build()
 
                        # Copy-out all resultfiles
@@ -133,9 +134,10 @@ class Pakfire(object):
                self.check_host_arch(arch)
 
                b = builder.Builder(pakfire=self, pkg=pkg)
-               b.extract(SHELL_PACKAGES)
 
                try:
+                       b.prepare()
+                       b.extract(SHELL_PACKAGES)
                        b.shell()
                finally:
                        b.cleanup()
@@ -144,7 +146,13 @@ class Pakfire(object):
                self.check_build_mode()
 
                b = builder.Builder(pakfire=self, pkg=pkg)
-               b.extract(build_deps=False)
+               try:
+                       b.prepare()
+                       b.extract(build_deps=False)
+               except:
+                       # If there is any exception, we cleanup our stuff and raise it.
+                       b.cleanup()
+                       raise
 
                if not resultdirs:
                        resultdirs = []
index 35ba1b3f0e75b1ead6af1d14c76b69ef9627edce..04b7af68335b1959ae76fb2ddc7ebdfff30c9d4c 100644 (file)
@@ -52,9 +52,6 @@ class Builder(object):
 
                self.build_id = build_id
 
-               # Initialize the environment
-               self.prepare()
-
        @property
        def info(self):
                return {