diff options
author | Richard Purdie <richard@openedhand.com> | 2007-08-16 09:55:21 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2007-08-16 09:55:21 +0000 |
commit | 7611768e23d9809f458691454c2aeb60d7b26e7d (patch) | |
tree | 050786d6475e1d0ed219d01dac1f02b1ebbdbb81 /bitbake/lib/bb/fetch | |
parent | 11ce59b501b5c82f6705db4d76e468fcbe3412db (diff) | |
download | poky-7611768e23d9809f458691454c2aeb60d7b26e7d.tar.gz |
bitbake: Sync with 1.8 head. Adds locking to the fetcher to prevent parallel downloads, fixes key expansion issues and occasional missing dependency graph links
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2502 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb/fetch')
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 229b28c19d..bbff516ffc 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
@@ -24,7 +24,7 @@ BitBake build tools. | |||
24 | # | 24 | # |
25 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig | 25 | # Based on functions from the base bb module, Copyright 2003 Holger Schurig |
26 | 26 | ||
27 | import os, re | 27 | import os, re, fcntl |
28 | import bb | 28 | import bb |
29 | from bb import data | 29 | from bb import data |
30 | from bb import persist_data | 30 | from bb import persist_data |
@@ -140,9 +140,21 @@ def go(d): | |||
140 | # Touch md5 file to show activity | 140 | # Touch md5 file to show activity |
141 | os.utime(ud.md5, None) | 141 | os.utime(ud.md5, None) |
142 | continue | 142 | continue |
143 | lf = open(ud.lockfile, "a+") | ||
144 | fcntl.flock(lf.fileno(), fcntl.LOCK_EX) | ||
145 | if ud.localfile and not m.forcefetch(u, ud, d) and os.path.exists(ud.md5): | ||
146 | # If someone else fetched this before we got the lock, | ||
147 | # notice and don't try again | ||
148 | os.utime(ud.md5, None) | ||
149 | fcntl.flock(lf.fileno(), fcntl.LOCK_UN) | ||
150 | lf.close | ||
151 | continue | ||
143 | m.go(u, ud, d) | 152 | m.go(u, ud, d) |
144 | if ud.localfile and not m.forcefetch(u, ud, d): | 153 | if ud.localfile and not m.forcefetch(u, ud, d): |
145 | Fetch.write_md5sum(u, ud, d) | 154 | Fetch.write_md5sum(u, ud, d) |
155 | fcntl.flock(lf.fileno(), fcntl.LOCK_UN) | ||
156 | lf.close | ||
157 | |||
146 | 158 | ||
147 | def localpaths(d): | 159 | def localpaths(d): |
148 | """ | 160 | """ |
@@ -264,6 +276,7 @@ class FetchData(object): | |||
264 | else: | 276 | else: |
265 | self.localpath = self.method.localpath(self.url, self, d) | 277 | self.localpath = self.method.localpath(self.url, self, d) |
266 | self.md5 = self.localpath + '.md5' | 278 | self.md5 = self.localpath + '.md5' |
279 | self.lockfile = self.localpath + '.lock' | ||
267 | # if user sets localpath for file, use it instead. | 280 | # if user sets localpath for file, use it instead. |
268 | 281 | ||
269 | 282 | ||