summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index cd7362c44a..f36f01a707 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -967,7 +967,14 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
967 open(ud.donestamp, 'w').close() 967 open(ud.donestamp, 'w').close()
968 dest = os.path.join(dldir, os.path.basename(ud.localpath)) 968 dest = os.path.join(dldir, os.path.basename(ud.localpath))
969 if not os.path.exists(dest): 969 if not os.path.exists(dest):
970 os.symlink(ud.localpath, dest) 970 # In case this is executing without any file locks held (as is
971 # the case for file:// URLs), two tasks may end up here at the
972 # same time, in which case we do not want the second task to
973 # fail when the link has already been created by the first task.
974 try:
975 os.symlink(ud.localpath, dest)
976 except FileExistsError:
977 pass
971 if not verify_donestamp(origud, ld) or origud.method.need_update(origud, ld): 978 if not verify_donestamp(origud, ld) or origud.method.need_update(origud, ld):
972 origud.method.download(origud, ld) 979 origud.method.download(origud, ld)
973 if hasattr(origud.method,"build_mirror_data"): 980 if hasattr(origud.method,"build_mirror_data"):
@@ -979,7 +986,11 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
979 # Broken symbolic link 986 # Broken symbolic link
980 os.unlink(origud.localpath) 987 os.unlink(origud.localpath)
981 988
982 os.symlink(ud.localpath, origud.localpath) 989 # As per above, in case two tasks end up here simultaneously.
990 try:
991 os.symlink(ud.localpath, origud.localpath)
992 except FileExistsError:
993 pass
983 update_stamp(origud, ld) 994 update_stamp(origud, ld)
984 return ud.localpath 995 return ud.localpath
985 996