瀏覽代碼

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.

(From OE-Core rev: cf675896340ebed7c4830b93d791ddb08999031f)

Signed-off-by: Randy Witt <randy.e.witt@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Randy Witt 10 年之前
父節點
當前提交
67c1d2eeb7
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      scripts/gen-lockedsig-cache

+ 8 - 2
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)