]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
gen-lockedsig-cache: ensure symlinks are dereferenced
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Thu, 11 Aug 2016 04:44:58 +0000 (16:44 +1200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 17 Aug 2016 09:32:01 +0000 (10:32 +0100)
If you set up a local mirror in SSTATE_MIRRORS then you can end up with
symlinks in SSTATE_DIR rather than real files. We don't want these
symlinks in the sstate-cache prodcued by gen-lockedsig-cache, so
dereference any symlinks before copying.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/gen-lockedsig-cache

index de8a20c78774d1aba56a00d9a85409f3aa57d6ca..49de74ed9b21a0a1cb1307508dd399f7b419eac1 100755 (executable)
@@ -57,13 +57,14 @@ for f in files:
     destdir = os.path.dirname(dst)
     mkdir(destdir)
 
+    src = os.path.realpath(f)
     if os.path.exists(dst):
         os.remove(dst)
-    if (os.stat(f).st_dev == os.stat(destdir).st_dev):
+    if (os.stat(src).st_dev == os.stat(destdir).st_dev):
         print('linking')
-        os.link(f, dst)
+        os.link(src, dst)
     else:
         print('copying')
-        shutil.copyfile(f, dst)
+        shutil.copyfile(src, dst)
 
 print('Done!')