From c11b7c487c518f9a2aceaddbe119a70877053cf5 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 13 Dec 2011 18:02:23 -0800 Subject: [PATCH] locks.py: make hardlink lock files hidden This is for consistency with the behavior for normal lock files, since commit ce44ea3e914098a52bc0d1d995e71661659e77ca (bug #142369). --- pym/portage/locks.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pym/portage/locks.py b/pym/portage/locks.py index 9cfb87e2d..41539ba88 100644 --- a/pym/portage/locks.py +++ b/pym/portage/locks.py @@ -1,5 +1,5 @@ # portage: Lock management code -# Copyright 2004-2010 Gentoo Foundation +# Copyright 2004-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = ["lockdir", "unlockdir", "lockfile", "unlockfile", \ @@ -267,7 +267,9 @@ def unlockfile(mytuple): def hardlock_name(path): - return path+".hardlock-"+os.uname()[1]+"-"+str(os.getpid()) + base, tail = os.path.split(path) + return os.path.join(base, ".%s.hardlock-%s-%s" % + (tail, os.uname()[1], os.getpid())) def hardlink_is_mine(link,lock): try: @@ -349,7 +351,7 @@ def hardlock_cleanup(path, remove_all_locks=False): if os.path.isfile(path+"/"+x): parts = x.split(".hardlock-") if len(parts) == 2: - filename = parts[0] + filename = parts[0][1:] hostpid = parts[1].split("-") host = "-".join(hostpid[:-1]) pid = hostpid[-1] @@ -373,7 +375,7 @@ def hardlock_cleanup(path, remove_all_locks=False): remove_all_locks: for y in mylist[x]: for z in mylist[x][y]: - filename = path+"/"+x+".hardlock-"+y+"-"+z + filename = path+"/."+x+".hardlock-"+y+"-"+z if filename == mylockname: continue try: -- 2.26.2