]> git.ipfire.org Git - pakfire.git/commitdiff
builder: Fix catching errors if buildroot is RO.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Jul 2013 16:51:21 +0000 (18:51 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 4 Jul 2013 16:51:21 +0000 (18:51 +0200)
python/pakfire/builder.py

index cf2608c1971289ecd546d18527972f32427836ef..ebb34e2f4137d5138264dcaabc04ae502d32aecd 100644 (file)
@@ -168,11 +168,6 @@ class BuildEnviron(object):
        def start(self):
                assert not self.pakfire.initialized, "Pakfire has already been initialized"
 
-               # Check if we can write our build directory.
-               build_mp = system.get_mountpoint(self.pakfire.path)
-               if build_mp and build_mp.is_readonly():
-                       raise RuntimeError, "Build directory is read-only: %s" % self.pakfire.path
-
                # Unshare namepsace.
                # If this fails because the kernel has no support for CLONE_NEWIPC or CLONE_NEWUTS,
                # we try to fall back to just set CLONE_NEWNS.
@@ -182,7 +177,14 @@ class BuildEnviron(object):
                        _pakfire.unshare(_pakfire.SCHED_CLONE_NEWNS)
 
                # Mount the directories.
-               self._mountall()
+               try:
+                       self._mountall()
+               except OSError, e:
+                       if e.errno == 30: # Read-only FS
+                               raise BuildError, "Buildroot is read-only: %s" % self.pakfire.path
+
+                       # Raise all other errors.
+                       raise
 
                # Lock the build environment.
                self.lock()