path: root/bitbake/lib
diff options
authorChristopher Larson <>2012-07-31 22:20:14 (GMT)
committerRichard Purdie <>2012-08-02 16:05:06 (GMT)
commit420891731fd87fc04e973687cfe674765d0f0299 (patch)
treef63040600ce481568b52f0cc25649acbcd198dd2 /bitbake/lib
parentf1417a1349e609d6a4886aed2704beabf150fbb9 (diff)
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 <>
Diffstat (limited to 'bitbake/lib')
1 files changed, 5 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/ b/bitbake/lib/bb/fetch2/
index a7da899..d911307 100644
--- a/bitbake/lib/bb/fetch2/
+++ b/bitbake/lib/bb/fetch2/
@@ -560,7 +560,11 @@ def try_mirror_url(newuri, origud, ud, ld, check = False):
560 return None 560 return None
561 # Otherwise the result is a local file:// and we symlink to it 561 # Otherwise the result is a local file:// and we symlink to it
562 if not os.path.exists(origud.localpath): 562 if not os.path.exists(origud.localpath):
563 os.symlink(ud.localpath, origud.localpath) 563 if os.path.islink(origud.localpath):
564 # Broken symbolic link
565 os.unlink(origud.localpath)
567 os.symlink(ud.localpath, origud.localpath)
564 update_stamp(newuri, origud, ld) 568 update_stamp(newuri, origud, ld)
565 return ud.localpath 569 return ud.localpath
566 570