From: Michael Tremer Date: Thu, 4 Jul 2013 16:51:21 +0000 (+0200) Subject: builder: Fix catching errors if buildroot is RO. X-Git-Tag: 0.9.26~10^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e9c8d79ad2da416834cb3677a0459b574020c4e8;p=pakfire.git builder: Fix catching errors if buildroot is RO. --- diff --git a/python/pakfire/builder.py b/python/pakfire/builder.py index cf2608c19..ebb34e2f4 100644 --- a/python/pakfire/builder.py +++ b/python/pakfire/builder.py @@ -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()