fetch2: handle broken symlinks in local mirror handling
PATCH 1/1 fetch2: handle broken symlinks in local mirror handling
From: Christopher Larson <[email protected]>
If a file:// mirror is being used, the fetcher will create a symlink to the local file. However, if the local file gets removed, that link will be dead, and os.path.exists() returns False in that case, so it tries and fails to recreate the link. Now we unlink such a dead link if it exists.
--- lib/bb/fetch2/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
lib/bb/fetch2/__init__.py +5 -1
@@ -557,7 +557,11 @@ def try_mirror_url(newuri, origud, ud, ld, check = False): return None # Otherwise the result is a local file:// and we symlink to it if not os.path.exists(origud.localpath): - os.symlink(ud.localpath, origud.localpath) + if os.path.islink(origud.localpath): + # Broken symbolic link + os.unlink(origud.localpath) + + os.symlink(ud.localpath, origud.localpath) update_stamp(newuri, origud, ld) return ud.localpath
Signature · 1 line
1.7.9.5
Richard Purdie
AppliedQuoted 11 lines · Christopher Larson
From: Christopher Larson <[email protected]>
If a file:// mirror is being used, the fetcher will create a symlink to the local file. However, if the local file gets removed, that link will be dead, and
os.path.exists()returns False in that case, so it tries and fails to recreate the link. Now we unlink such a dead link if it exists.Signed-off-by Christopher Larson <[email protected]>--- lib/bb/fetch2/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Merged to master, thanks.
Richard