]> code.ossystems Code Review - openembedded-core.git/commitdiff
gen-lockedsig-cache: Allow cross-filesystem copies.
authorRandy Witt <randy.e.witt@linux.intel.com>
Mon, 23 Feb 2015 17:00:35 +0000 (17:00 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 23 Feb 2015 18:00:11 +0000 (18:00 +0000)
Since this previously always tried to use hardlinks you couldn't have
the source and destination be on different devices. This change allows
for that and also prevents failure in situations where the files already
existed.

Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/gen-lockedsig-cache

index dfb282efd4a8e4d2ea817e3f602cabf3f430da63..c93b2c0b99bed52b9bf7d218a4a6c98218472c6f 100755 (executable)
@@ -35,6 +35,12 @@ for s in sigs:
 
 for f in files:
     dst = f.replace(sys.argv[2], sys.argv[3])
-    mkdir(os.path.dirname(dst))
-    os.link(f, dst)
+    destdir = os.path.dirname(dst)
+    mkdir(destdir)
 
+    if os.path.exists(dst):
+        os.remove(dst)
+    if (os.stat(f).st_dev == os.stat(destdir).st_dev):
+        os.link(f, dst)
+    else:
+        shutil.copyfile(f, dst)