> + # We use to os.makedirs(lockdir, mode=0755) ... but that
ACK, Just a missing 'd' there. But setting ._lockfile in _lock() seems easier:
@@ -2147,8 +2147,6 @@ much more problems).
# Another copy seems to be running.
msg = _('Existing lock %s: another copy is running as pid %s.') %
(lockfile, oldpid)
raise Errors.LockError(0, msg, oldpid)
- # We've got the lock, store it so we can auto-unlock on __del__...
- self._lockfile = lockfile
def doUnlock(self, lockfile=None):
"""Release the yum lock.
@@ -2181,15 +2179,16 @@ much more problems).
self._unlock(lockfile)
self._lockfile = None
- @staticmethod
- def _lock(filename, contents='', mode=0777):
+ def _lock(self, filename, contents='', mode=0777):
lockdir = os.path.dirname(filename)
try:
if not os.path.exists(lockdir):
- os.makedirs(lockdir, mode=0755)
+ return 1
fd = os.open(filename, os.O_EXCL|os.O_CREAT|os.O_WRONLY, mode)
os.write(fd, contents)
os.close(fd)
+ # We've got the lock, store it so we can auto-unlock on __del__...
+ self._lockfile = lockfile
return 1
except OSError, msg:
if not msg.errno == errno.EEXIST:
_______________________________________________
Yum-devel mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum-devel