* [PATCH] fetch2: handle broken symlinks in local mirror handling
@ 2012-07-31 22:20 Christopher Larson
2012-08-02 16:05 ` Richard Purdie
0 siblings, 1 reply; 2+ messages in thread
From: Christopher Larson @ 2012-07-31 22:20 UTC (permalink / raw)
To: bitbake-devel; +Cc: Christopher Larson
From: Christopher Larson <chris_larson@mentor.com>
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 <chris_larson@mentor.com>
---
lib/bb/fetch2/__init__.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index fa963be..8f5b097 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -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
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fetch2: handle broken symlinks in local mirror handling
2012-07-31 22:20 [PATCH] fetch2: handle broken symlinks in local mirror handling Christopher Larson
@ 2012-08-02 16:05 ` Richard Purdie
0 siblings, 0 replies; 2+ messages in thread
From: Richard Purdie @ 2012-08-02 16:05 UTC (permalink / raw)
To: Christopher Larson; +Cc: Christopher Larson, bitbake-devel
On Tue, 2012-07-31 at 15:20 -0700, Christopher Larson wrote:
> From: Christopher Larson <chris_larson@mentor.com>
>
> 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 <chris_larson@mentor.com>
> ---
> lib/bb/fetch2/__init__.py | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Merged to master, thanks.
Richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-08-02 16:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-31 22:20 [PATCH] fetch2: handle broken symlinks in local mirror handling Christopher Larson
2012-08-02 16:05 ` Richard Purdie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.