From e9c8d79ad2da416834cb3677a0459b574020c4e8 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 4 Jul 2013 18:51:21 +0200 Subject: [PATCH] builder: Fix catching errors if buildroot is RO. --- python/pakfire/builder.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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() -- 2.39.5