From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 78D661382C5 for ; Fri, 30 Apr 2021 06:31:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 78C4BE0839; Fri, 30 Apr 2021 06:31:38 +0000 (UTC) Received: from rs234.mailgun.us (rs234.mailgun.us [209.61.151.234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 742C0E0839 for ; Fri, 30 Apr 2021 06:31:37 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=xxoo.ws; q=dns/txt; s=mx; t=1619764297; h=Content-Type: MIME-Version: Message-ID: Subject: To: From: Date: Sender; bh=yb3Eb1OSu9e8dBhDL9LDeYVHbaER+FYQLqfcUJa/0GU=; b=IBW8ec3VaaaqiDOydJoe2YYp+oeok+zd4MxVS0XLYs37joK5DlAjYCidx1qBTFO2DuUi97lV oiuiKbzAVDA3y3XXWx7U5jJkADT0ZkCIL3Ew0PvquTzTHFTGMkAtqKD7KVXFrkcsDhYIUgE4 p/0Qno/doTMxHOhj+5WDUHbVqMQ= X-Mailgun-Sending-Ip: 209.61.151.234 X-Mailgun-Sid: WyIxYmU3MyIsICJnZW50b28tY2F0YWx5c3RAbGlzdHMuZ2VudG9vLm9yZyIsICJlYTQwNTYiXQ== Received: from mail.0xdc.io (ip-54-37-0.eu [54.37.0.172]) by smtp-out-n03.prod.us-west-2.postgun.com with SMTP id 608ba447e0e9c9a6b62a6a10 (version=TLS1.3, cipher=TLS_AES_128_GCM_SHA256); Fri, 30 Apr 2021 06:31:35 GMT Sender: gentoo.catalyst@xxoo.ws Received: from pulsar (5.f.3.0.5.6.e.f.f.f.9.5.1.a.a.a.0.a.4.7.9.0.c.0.0.b.8.0.1.0.0.2.ip6.arpa [IPv6:2001:8b0:c09:74a0:aaa1:59ff:fe65:3f5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.0xdc.io (Postfix) with ESMTPSA id A65181023CC for ; Fri, 30 Apr 2021 06:32:02 +0000 (UTC) Date: Fri, 30 Apr 2021 06:31:31 +0000 From: Daniel Cordero To: gentoo-catalyst@lists.gentoo.org Subject: [gentoo-catalyst] snakeoil-0.9.6 removes FsLock Message-ID: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-catalyst@lists.gentoo.org Reply-to: gentoo-catalyst@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Archives-Salt: 7564ef71-e9df-4da6-814e-8c90c62403d3 X-Archives-Hash: a06d77c3547428fcff16ff75ac85e02c snakeoil-0.9.6, which has recently been released and stablised in the tree, removes osutils.FsLock that catalyst uses, causing builds to fail. https://github.com/pkgcore/snakeoil/commit/d7c9c2a40fd6fdf7e62d2f041b7dee3765abbf5f ERROR : CatalystError: Target "stage1" not available. Traceback (most recent call last): File "/substrate/master/catalyst/catalyst/main.py", line 78, in build_target module = import_module(target) File "/substrate/master/catalyst/catalyst/main.py", line 69, in import_module module = __import__(mod_name, [], [], ["not empty"]) File "/substrate/master/catalyst/catalyst/targets/stage1.py", line 9, in from catalyst.base.stagebase import StageBase File "/substrate/master/catalyst/catalyst/base/stagebase.py", line 28, in from catalyst.lock import LockDir, LockInUse File "/substrate/master/catalyst/catalyst/lock.py", line 11, in LockInUse = osutils.LockException AttributeError: module 'snakeoil.osutils' has no attribute 'LockException' ERROR:catalyst:CatalystError: Target "stage1" not available. Traceback (most recent call last): File "/substrate/master/catalyst/catalyst/main.py", line 78, in build_target module = import_module(target) File "/substrate/master/catalyst/catalyst/main.py", line 69, in import_module module = __import__(mod_name, [], [], ["not empty"]) File "/substrate/master/catalyst/catalyst/targets/stage1.py", line 9, in from catalyst.base.stagebase import StageBase File "/substrate/master/catalyst/catalyst/base/stagebase.py", line 28, in from catalyst.lock import LockDir, LockInUse File "/substrate/master/catalyst/catalyst/lock.py", line 11, in LockInUse = osutils.LockException AttributeError: module 'snakeoil.osutils' has no attribute 'LockException' Traceback (most recent call last): File "/substrate/master/catalyst/catalyst/main.py", line 78, in build_target module = import_module(target) File "/substrate/master/catalyst/catalyst/main.py", line 69, in import_module module = __import__(mod_name, [], [], ["not empty"]) File "/substrate/master/catalyst/catalyst/targets/stage1.py", line 9, in from catalyst.base.stagebase import StageBase File "/substrate/master/catalyst/catalyst/base/stagebase.py", line 28, in from catalyst.lock import LockDir, LockInUse File "/substrate/master/catalyst/catalyst/lock.py", line 11, in LockInUse = osutils.LockException AttributeError: module 'snakeoil.osutils' has no attribute 'LockException' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/substrate/master/catalyst/bin/catalyst", line 27, in main(sys.argv[1:]) File "/substrate/master/catalyst/catalyst/main.py", line 256, in main return _main(parser, opts) File "/substrate/master/catalyst/catalyst/main.py", line 366, in _main success = build_target(addlargs) File "/substrate/master/catalyst/catalyst/main.py", line 81, in build_target raise CatalystError( catalyst.support.CatalystError: Target "stage1" not available. The following patch just removes all of the locks and resolves the issue for me, but I'm sure locking was added for a reason and affects other users. --- catalyst/base/clearbase.py | 2 -- catalyst/base/stagebase.py | 7 ------ catalyst/lock.py | 58 ---------------------------------------------- 3 files changed, 67 deletions(-) diff --git a/catalyst/base/clearbase.py b/catalyst/base/clearbase.py index dcf6c523..6218330e 100644 --- a/catalyst/base/clearbase.py +++ b/catalyst/base/clearbase.py @@ -27,12 +27,10 @@ class ClearBase(): self.resume.clear_all(remove=True) def clear_chroot(self): - self.chroot_lock.unlock() log.notice('Clearing the chroot path ...') clear_dir(self.settings["chroot_path"], mode=0o755) def remove_chroot(self): - self.chroot_lock.unlock() log.notice('Removing the chroot path ...') clear_dir(self.settings["chroot_path"], mode=0o755, remove=True) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 448d6265..4959bab3 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -25,7 +25,6 @@ from catalyst.support import (CatalystError, file_locate, normpath, from catalyst.base.targetbase import TargetBase from catalyst.base.clearbase import ClearBase from catalyst.base.genbase import GenBase -from catalyst.lock import LockDir, LockInUse from catalyst.fileops import ensure_dirs, clear_dir, clear_path from catalyst.base.resume import AutoResume @@ -36,9 +35,6 @@ def run_sequence(sequence): sys.stdout.flush() try: func() - except LockInUse: - log.error('Unable to aquire the lock...') - return False except Exception: log.error('Exception running action sequence %s', func.__name__, exc_info=True) @@ -478,7 +474,6 @@ class StageBase(TargetBase, ClearBase, GenBase): """ self.settings["chroot_path"] = normpath(self.settings["storedir"] + "/tmp/" + self.settings["target_subpath"].rstrip('/')) - self.chroot_lock = LockDir(self.settings["chroot_path"]) def set_autoresume_path(self): self.settings["autoresume_path"] = normpath(pjoin( @@ -1366,8 +1361,6 @@ class StageBase(TargetBase, ClearBase, GenBase): pass def run(self): - self.chroot_lock.write_lock() - if "clear-autoresume" in self.settings["options"]: self.clear_autoresume() diff --git a/catalyst/lock.py b/catalyst/lock.py deleted file mode 100644 index e31745b2..00000000 --- a/catalyst/lock.py +++ /dev/null @@ -1,58 +0,0 @@ - -import os - -from contextlib import contextmanager - -from snakeoil import fileutils -from snakeoil import osutils -from catalyst.fileops import ensure_dirs - - -LockInUse = osutils.LockException - -class Lock: - """ - A fnctl-based filesystem lock - """ - def __init__(self, lockfile): - fileutils.touch(lockfile, mode=0o664) - os.chown(lockfile, uid=-1, gid=250) - self.lock = osutils.FsLock(lockfile) - - def read_lock(self): - self.lock.acquire_read_lock() - - def write_lock(self): - self.lock.acquire_write_lock() - - def unlock(self): - # Releasing a write lock is the same as a read lock. - self.lock.release_write_lock() - -class LockDir(Lock): - """ - A fnctl-based filesystem lock in a directory - """ - def __init__(self, lockdir): - ensure_dirs(lockdir) - lockfile = os.path.join(lockdir, '.catalyst_lock') - - Lock.__init__(self, lockfile) - -@contextmanager -def read_lock(filename): - lock = Lock(filename) - lock.read_lock() - try: - yield - finally: - lock.unlock() - -@contextmanager -def write_lock(filename): - lock = Lock(filename) - lock.write_lock() - try: - yield - finally: - lock.unlock()