]> git.ipfire.org Git - pakfire.git/commitdiff
builder: Do not lock build environments
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 13 Feb 2021 13:11:23 +0000 (13:11 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 13 Feb 2021 13:11:23 +0000 (13:11 +0000)
This feels a bit unnecessary because the paths are being randomised
anyways and this might need to move into Pakfire().

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/builder.py
src/pakfire/errors.py

index c4f851fa06024e18097f564ea299ef6049fbf97c..eb6b57c8dece0787aabc6dd1d83424313f42316d 100644 (file)
@@ -47,7 +47,7 @@ log = logging.getLogger("pakfire.builder")
 from .system import system
 from .constants import *
 from .i18n import _
-from .errors import BuildError, BuildRootLocked, Error
+from .errors import BuildError, Error
 
 
 BUILD_LOG_HEADER = """
@@ -94,7 +94,6 @@ class Builder(object):
 
                # Path
                self.path = os.path.join(BUILD_ROOT, self.build_id)
-               self._lock = None
 
                # Architecture to build for
                self.arch = arch or _pakfire.native_arch()
@@ -119,9 +118,6 @@ class Builder(object):
                        # Raise all other errors
                        raise
 
-               # Lock the build environment
-               self.lock()
-
                # Setup domain name resolution in chroot
                self.setup_dns()
 
@@ -140,9 +136,6 @@ class Builder(object):
                # Umount the build environment
                self._umountall()
 
-               # Unlock build environment
-               self.unlock()
-
                # Delete everything
                self._destroy()
 
@@ -181,26 +174,6 @@ class Builder(object):
 
                return cgroup
 
-       def lock(self):
-               filename = os.path.join(self.path, ".lock")
-
-               try:
-                       self._lock = open(filename, "a+")
-               except IOError as e:
-                       return 0
-
-               try:
-                       fcntl.lockf(self._lock.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
-               except IOError as e:
-                       raise BuildRootLocked("Buildroot is locked")
-
-               return 1
-
-       def unlock(self):
-               if self._lock:
-                       self._lock.close()
-                       self._lock = None
-
        def _destroy(self):
                self.log.debug("Destroying environment %s" % self.path)
 
index 7b698da2e5b752e11fb6ddf1c92c372a8e766dd9..69ca8b8727111b9ab2513656ec91acdf1508d815 100644 (file)
@@ -41,9 +41,6 @@ class BuildAbortedException(Error):
 class BuildError(Error):
        pass
 
-class BuildRootLocked(Error):
-       pass
-
 class CompressionError(Error):
        message = _("Could not compress/decompress data.")