bitbake: Convert fetcher code to using bb.utils locking functions

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3223 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie 2007-11-24 16:49:12 +00:00
parent c065977948
commit 62a3ee38ed
1 changed files with 3 additions and 6 deletions

View File

@ -141,21 +141,18 @@ def go(d):
# Touch md5 file to show activity
os.utime(ud.md5, None)
continue
lf = open(ud.lockfile, "a+")
fcntl.flock(lf.fileno(), fcntl.LOCK_EX)
lf = bb.utils.lockfile(ud.lockfile)
if not m.forcefetch(u, ud, d) and os.path.exists(ud.md5):
# If someone else fetched this before we got the lock,
# notice and don't try again
os.utime(ud.md5, None)
fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
lf.close
bb.utils.unlockfile(lf)
continue
m.go(u, ud, d)
if ud.localfile:
if not m.forcefetch(u, ud, d):
Fetch.write_md5sum(u, ud, d)
fcntl.flock(lf.fileno(), fcntl.LOCK_UN)
lf.close
bb.utils.unlockfile(lf)
def localpaths(d):
"""