diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-03-27 04:35:36 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-03-27 04:35:36 +0000 |
commit | 2843c55bc39b0b8ce2ec317f54776a639162726d (patch) | |
tree | 89c4fda8bc5ca70c37b1957e51c0db297d1f5793 /pym | |
parent | d622d5478c0cb651b5e561f0485ac9d4d200ef6c (diff) | |
download | portage-2843c55bc39b0b8ce2ec317f54776a639162726d.tar.gz portage-2843c55bc39b0b8ce2ec317f54776a639162726d.tar.bz2 portage-2843c55bc39b0b8ce2ec317f54776a639162726d.zip |
revert previous commit since it had portage_locks stuff mixed in
svn path=/main/branches/2.1.2/; revision=9516
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage_locks.py | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/pym/portage_locks.py b/pym/portage_locks.py index 340096a7c..9b17c60e3 100644 --- a/pym/portage_locks.py +++ b/pym/portage_locks.py @@ -79,7 +79,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, waiting_msg=None): except IOError, e: if "errno" not in dir(e): raise - if e.errno in (errno.EACCES, errno.EAGAIN): + if e.errno == errno.EAGAIN: # resource temp unavailable; eg, someone beat us to the lock. if waiting_msg is None: if isinstance(mypath, int): @@ -111,7 +111,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, waiting_msg=None): if type(lockfilename) == types.StringType and \ - myfd != HARDLINK_FD and _fstat_nlink(myfd) == 0: + myfd != HARDLINK_FD and os.fstat(myfd).st_nlink == 0: # The file was deleted on us... Keep trying to make one... os.close(myfd) portage_util.writemsg("lockfile recurse\n",1) @@ -122,22 +122,6 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, waiting_msg=None): portage_util.writemsg(str((lockfilename,myfd,unlinkfile))+"\n",1) return (lockfilename,myfd,unlinkfile,locking_method) -def _fstat_nlink(fd): - """ - @param fd: an open file descriptor - @type fd: Integer - @rtype: Integer - @return: the current number of hardlinks to the file - """ - try: - return os.fstat(fd).st_nlink - except EnvironmentError, e: - if e.errno == errno.ENOENT: - # Some filesystems such as CIFS return - # ENOENT which means st_nlink == 0. - return 0 - raise - def unlockfile(mytuple): import fcntl @@ -183,7 +167,7 @@ def unlockfile(mytuple): # We won the lock, so there isn't competition for it. # We can safely delete the file. portage_util.writemsg("Got the lockfile...\n",1) - if _fstat_nlink(myfd) == 1: + if os.fstat(myfd).st_nlink == 1: os.unlink(lockfilename) portage_util.writemsg("Unlinked lockfile...\n",1) locking_method(myfd,fcntl.LOCK_UN) |