diff options
-rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 16 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch/git.py | 6 |
2 files changed, 20 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 8d7ec8036c..2b0b288df0 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
@@ -222,6 +222,18 @@ def init(urls, d, setup = True): | |||
222 | urldata_cache[fn] = urldata | 222 | urldata_cache[fn] = urldata |
223 | return urldata | 223 | return urldata |
224 | 224 | ||
225 | def try_premirror(u, ud, d): | ||
226 | """ | ||
227 | Should we try premirrors for this url, u? | ||
228 | We should if forcefetch is set or the localfile and md5 don't exist | ||
229 | """ | ||
230 | if ud.method.forcefetch(u, ud, d): | ||
231 | return True | ||
232 | elif os.path.exists(ud.md5) and os.path.exists(ud.localfile): | ||
233 | return False | ||
234 | else: | ||
235 | return True | ||
236 | |||
225 | def go(d, urls = None): | 237 | def go(d, urls = None): |
226 | """ | 238 | """ |
227 | Fetch all urls | 239 | Fetch all urls |
@@ -235,7 +247,7 @@ def go(d, urls = None): | |||
235 | ud = urldata[u] | 247 | ud = urldata[u] |
236 | m = ud.method | 248 | m = ud.method |
237 | if ud.localfile: | 249 | if ud.localfile: |
238 | if not m.forcefetch(u, ud, d) and os.path.exists(ud.md5) and os.path.exists(ud.localfile): | 250 | if not m.try_premirror(u, ud, d): |
239 | # File already present along with md5 stamp file | 251 | # File already present along with md5 stamp file |
240 | # Touch md5 file to show activity | 252 | # Touch md5 file to show activity |
241 | try: | 253 | try: |
@@ -245,7 +257,7 @@ def go(d, urls = None): | |||
245 | pass | 257 | pass |
246 | continue | 258 | continue |
247 | lf = bb.utils.lockfile(ud.lockfile) | 259 | lf = bb.utils.lockfile(ud.lockfile) |
248 | if not m.forcefetch(u, ud, d) and os.path.exists(ud.md5) and os.path.exists(ud.localfile): | 260 | if not m.try_premirror(u, ud, d): |
249 | # If someone else fetched this before we got the lock, | 261 | # If someone else fetched this before we got the lock, |
250 | # notice and don't try again | 262 | # notice and don't try again |
251 | try: | 263 | try: |
diff --git a/bitbake/lib/bb/fetch/git.py b/bitbake/lib/bb/fetch/git.py index b6126cbe91..938e0c08ba 100644 --- a/bitbake/lib/bb/fetch/git.py +++ b/bitbake/lib/bb/fetch/git.py | |||
@@ -90,6 +90,12 @@ class Git(Fetch): | |||
90 | return True | 90 | return True |
91 | return False | 91 | return False |
92 | 92 | ||
93 | def try_premirror(self, d, ud): | ||
94 | if os.path.exists(ud.clonedir): | ||
95 | return False | ||
96 | |||
97 | return True | ||
98 | |||
93 | def go(self, loc, ud, d): | 99 | def go(self, loc, ud, d): |
94 | """Fetch url""" | 100 | """Fetch url""" |
95 | 101 | ||