diff options
author | Christopher Larson <chris_larson@mentor.com> | 2012-07-31 15:20:14 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-02 17:05:06 +0100 |
commit | 420891731fd87fc04e973687cfe674765d0f0299 (patch) | |
tree | f63040600ce481568b52f0cc25649acbcd198dd2 /bitbake/lib | |
parent | f1417a1349e609d6a4886aed2704beabf150fbb9 (diff) | |
download | poky-420891731fd87fc04e973687cfe674765d0f0299.tar.gz |
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 <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 6 |
1 files changed, 5 insertions, 1 deletions
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): | |||
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) | ||
566 | |||
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 | ||