[oe-commits] Randy Witt : gen-lockedsig-cache: Allow cross-filesystem copies.

git at git.openembedded.org git at git.openembedded.org
Mon Feb 23 17:46:26 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 79814a28fea945b5ec8b1eea9b9159795495e6c5
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=79814a28fea945b5ec8b1eea9b9159795495e6c5

Author: Randy Witt <randy.e.witt at linux.intel.com>
Date:   Mon Feb 23 17:00:35 2015 +0000

gen-lockedsig-cache: Allow cross-filesystem copies.

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 at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 scripts/gen-lockedsig-cache | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/scripts/gen-lockedsig-cache b/scripts/gen-lockedsig-cache
index dfb282e..c93b2c0 100755
--- a/scripts/gen-lockedsig-cache
+++ b/scripts/gen-lockedsig-cache
@@ -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)



More information about the Openembedded-commits mailing list