From 420891731fd87fc04e973687cfe674765d0f0299 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Tue, 31 Jul 2012 15:20:14 -0700 Subject: bitbake: fetch2: handle broken symlinks in local mirror handling 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. (Bitbake rev: 229ed3857e826e3e215e843cb51f729c1e13ed37) Signed-off-by: Christopher Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bitbake/lib') diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index a7da899c22..d911307f6e 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -560,7 +560,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 -- cgit v1.2.3-54-g00ecf