From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 0242413888F for ; Sun, 11 Oct 2015 17:26:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 5D980E07F2; Sun, 11 Oct 2015 17:26:41 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7EEBDE07F7 for ; Sun, 11 Oct 2015 17:26:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5A5F033E3A9 for ; Sun, 11 Oct 2015 17:26:39 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 44BE698F for ; Sun, 11 Oct 2015 17:26:37 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1444521276.1f48a8c57804569b747da23e4603ba7a42dea51d.vapier@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py X-VCS-Directories: catalyst/base/ X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 1f48a8c57804569b747da23e4603ba7a42dea51d X-VCS-Branch: master Date: Sun, 11 Oct 2015 17:26:37 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: e276b12d-5e52-45ee-8c7b-7148409ba281 X-Archives-Hash: 6e6c839c5c7480de6d096a6c7a425bb1 commit: 1f48a8c57804569b747da23e4603ba7a42dea51d Author: Mike Frysinger gentoo org> AuthorDate: Fri Oct 9 22:18:16 2015 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Sat Oct 10 23:54:36 2015 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=1f48a8c5 stagebase: simplify lock calls a bit We create self.snapcache_lock to hold the lock, then assign it to self.snapshot_lock_object, and then operate on self.snapshot_lock_object. There's no need for this indirection, so operate on self.snapcache_lock directly instead. catalyst/base/stagebase.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 88d71ba..3ce7dba 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -150,7 +150,6 @@ class StageBase(TargetBase, ClearBase, GenBase): self.set_source_subpath() # Set paths - self.snapshot_lock_object = None self.set_snapshot_path() self.set_root_path() self.set_source_path() @@ -822,7 +821,6 @@ class StageBase(TargetBase, ClearBase, GenBase): self.settings["snapshot_cache_path"]+\ " (This can take a long time)..." cleanup_errmsg="Error removing existing snapshot cache directory." - self.snapshot_lock_object=self.snapcache_lock if self.settings["snapshot_path_hash"]==snapshot_cache_hash: print "Valid snapshot cache, skipping unpack of portage tree..." @@ -846,7 +844,7 @@ class StageBase(TargetBase, ClearBase, GenBase): if unpack: if "snapcache" in self.settings["options"]: - self.snapshot_lock_object.write_lock() + self.snapcache_lock.write_lock() if os.path.exists(target_portdir): print cleanup_msg cleanup_cmd = "rm -rf " + target_portdir @@ -868,7 +866,7 @@ class StageBase(TargetBase, ClearBase, GenBase): data=self.settings["snapshot_path_hash"]) if "snapcache" in self.settings["options"]: - self.snapshot_lock_object.unlock() + self.snapcache_lock.unlock() def config_profile_link(self): if "autoresume" in self.settings["options"] \ @@ -946,7 +944,7 @@ class StageBase(TargetBase, ClearBase, GenBase): src=self.mountmap[x] #print "bind(); src =", src if "snapcache" in self.settings["options"] and x == "portdir": - self.snapshot_lock_object.read_lock() + self.snapcache_lock.read_lock() if os.uname()[0] == "FreeBSD": if src == "/dev": _cmd = "mount -t devfs none " + target @@ -998,7 +996,7 @@ class StageBase(TargetBase, ClearBase, GenBase): # It's possible the snapshot lock object isn't created yet. # This is because mount safety check calls unbind before the # target is fully initialized - self.snapshot_lock_object.unlock() + self.snapcache_lock.unlock() except Exception: pass if ouch: