* [PATCH] fetch2: Handle lockfiles for file:// urls redirected to mirrors
@ 2016-03-24 16:11 Richard Purdie
0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2016-03-24 16:11 UTC (permalink / raw)
To: bitbake-devel
We recently dropped lockfiles for file:// urls which in itself makes
sense.
If a file url redirects to something like an http:// mirror, we'd have
no lock taken for the original file and could race against others
trying to download the file. We therefore need to ensure there is a
lock taken in the mirror handling code.
This adds code to take such a lock, assuming it isn't the same lock
as the parent url.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index f86014c..d87d8e8 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -915,6 +915,10 @@ def rename_bad_checksum(ud, suffix):
def try_mirror_url(fetch, origud, ud, ld, check = False):
# Return of None or a value means we're finished
# False means try another url
+
+ if ud.lockfile and ud.lockfile != origud.lockfile:
+ lf = bb.utils.lockfile(ud.lockfile)
+
try:
if check:
found = ud.method.checkstatus(fetch, ud, ld)
@@ -980,6 +984,10 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
except UnboundLocalError:
pass
return False
+ finally:
+ if ud.lockfile and ud.lockfile != origud.lockfile:
+ bb.utils.unlockfile(lf)
+
def try_mirrors(fetch, d, origud, mirrors, check = False):
"""
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2016-03-24 16:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-24 16:11 [PATCH] fetch2: Handle lockfiles for file:// urls redirected to mirrors Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.