diff options
author | Richard Purdie <richard@openedhand.com> | 2007-11-24 16:49:12 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2007-11-24 16:49:12 +0000 |
commit | 62a3ee38ed1076de75d40f56c757098b6c219810 (patch) | |
tree | c1fca17266f850a3093493c173da2b7a9d553e39 /bitbake | |
parent | c0659779483182aff39d8e8a6821a40d1489dc0f (diff) | |
download | poky-62a3ee38ed1076de75d40f56c757098b6c219810.tar.gz |
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
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 4da92110ef..d75c618de6 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
@@ -141,21 +141,18 @@ def go(d): | |||
141 | # Touch md5 file to show activity | 141 | # Touch md5 file to show activity |
142 | os.utime(ud.md5, None) | 142 | os.utime(ud.md5, None) |
143 | continue | 143 | continue |
144 | lf = open(ud.lockfile, "a+") | 144 | lf = bb.utils.lockfile(ud.lockfile) |
145 | fcntl.flock(lf.fileno(), fcntl.LOCK_EX) | ||
146 | if not m.forcefetch(u, ud, d) and os.path.exists(ud.md5): | 145 | if not m.forcefetch(u, ud, d) and os.path.exists(ud.md5): |
147 | # If someone else fetched this before we got the lock, | 146 | # If someone else fetched this before we got the lock, |
148 | # notice and don't try again | 147 | # notice and don't try again |
149 | os.utime(ud.md5, None) | 148 | os.utime(ud.md5, None) |
150 | fcntl.flock(lf.fileno(), fcntl.LOCK_UN) | 149 | bb.utils.unlockfile(lf) |
151 | lf.close | ||
152 | continue | 150 | continue |
153 | m.go(u, ud, d) | 151 | m.go(u, ud, d) |
154 | if ud.localfile: | 152 | if ud.localfile: |
155 | if not m.forcefetch(u, ud, d): | 153 | if not m.forcefetch(u, ud, d): |
156 | Fetch.write_md5sum(u, ud, d) | 154 | Fetch.write_md5sum(u, ud, d) |
157 | fcntl.flock(lf.fileno(), fcntl.LOCK_UN) | 155 | bb.utils.unlockfile(lf) |
158 | lf.close | ||
159 | 156 | ||
160 | def localpaths(d): | 157 | def localpaths(d): |
161 | """ | 158 | """ |