]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: fetch2: handle broken symlinks in local mirror handling
authorChristopher Larson <chris_larson@mentor.com>
Tue, 31 Jul 2012 22:20:14 +0000 (15:20 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 2 Aug 2012 16:05:06 +0000 (17:05 +0100)
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>
bitbake/lib/bb/fetch2/__init__.py

index a7da899c2237827d509e0f452c8ce81be5b265a4..d911307f6ebcc7a16b5b35880c319488676702f7 100644 (file)
@@ -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