From: Michael Tremer Date: Sat, 13 Feb 2021 13:11:23 +0000 (+0000) Subject: builder: Do not lock build environments X-Git-Tag: 0.9.28~1285^2~738 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e701ec56a80da82adc8331f60cfbadc980483d17;p=pakfire.git builder: Do not lock build environments 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 --- diff --git a/src/pakfire/builder.py b/src/pakfire/builder.py index c4f851fa0..eb6b57c8d 100644 --- a/src/pakfire/builder.py +++ b/src/pakfire/builder.py @@ -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) diff --git a/src/pakfire/errors.py b/src/pakfire/errors.py index 7b698da2e..69ca8b872 100644 --- a/src/pakfire/errors.py +++ b/src/pakfire/errors.py @@ -41,9 +41,6 @@ class BuildAbortedException(Error): class BuildError(Error): pass -class BuildRootLocked(Error): - pass - class CompressionError(Error): message = _("Could not compress/decompress data.")