aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-01-24 21:40:06 +0000
committerPaul Eggleton <paul.eggleton@linux.intel.com>2014-08-15 16:08:06 +0100
commit142aec63946a389f2ef9e2ef27141f90062bb606 (patch)
treee94d229645f9752b62be6703c4dad9e16c3269b6
parent9096eb59d6b11726e2c8bb2f35901e5fb7c17024 (diff)
downloadopenembedded-core-contrib-142aec63946a389f2ef9e2ef27141f90062bb606.tar.gz
openembedded-core-contrib-142aec63946a389f2ef9e2ef27141f90062bb606.tar.bz2
openembedded-core-contrib-142aec63946a389f2ef9e2ef27141f90062bb606.zip
scripts: Add script to generate sstate directory from a locked-sigs file
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xscripts/gen-lockedsig-cache40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/gen-lockedsig-cache b/scripts/gen-lockedsig-cache
new file mode 100755
index 0000000000..dfb282efd4
--- /dev/null
+++ b/scripts/gen-lockedsig-cache
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+#
+# gen-lockedsig-cache <locked-sigs.inc> <input-cachedir> <output-cachedir>
+#
+
+import os
+import sys
+import glob
+import shutil
+import errno
+
+def mkdir(d):
+ try:
+ os.makedirs(d)
+ except OSError as e:
+ if e.errno != errno.EEXIST:
+ raise e
+
+if len(sys.argv) < 3:
+ print("Incorrect number of arguments specified")
+ sys.exit(1)
+
+sigs = []
+with open(sys.argv[1]) as f:
+ for l in f.readlines():
+ if ":" in l:
+ sigs.append(l.split(":")[2].split()[0])
+
+files = set()
+for s in sigs:
+ p = sys.argv[2] + "/" + s[:2] + "/*" + s + "*"
+ files |= set(glob.glob(p))
+ p = sys.argv[2] + "/*/" + s[:2] + "/*" + s + "*"
+ files |= set(glob.glob(p))
+
+for f in files:
+ dst = f.replace(sys.argv[2], sys.argv[3])
+ mkdir(os.path.dirname(dst))
+ os.link(f, dst)
+