summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-10-20 09:19:19 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-01 21:32:02 +0000
commitc63b36fb39367ce422ff45be91855c7493e9e200 (patch)
treeff0585349170f1c65f699b8f6eaa770ff69c07cb /scripts
parent67af6d640203433116a9c1e39fd46da02005130f (diff)
downloadpoky-c63b36fb39367ce422ff45be91855c7493e9e200.tar.gz
scripts/gen-lockedsig-cache: improve output
* Print some status when running * When incorrect number of arguments specified, print usage text (From OE-Core rev: ac38d245878b618ddf56f9a68834d344500e45a6) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen-lockedsig-cache13
1 files changed, 10 insertions, 3 deletions
diff --git a/scripts/gen-lockedsig-cache b/scripts/gen-lockedsig-cache
index 806c1e4caa..9c16506cd6 100755
--- a/scripts/gen-lockedsig-cache
+++ b/scripts/gen-lockedsig-cache
@@ -1,7 +1,4 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2#
3# gen-lockedsig-cache <locked-sigs.inc> <input-cachedir> <output-cachedir>
4#
5 2
6import os 3import os
7import sys 4import sys
@@ -18,14 +15,17 @@ def mkdir(d):
18 15
19if len(sys.argv) < 3: 16if len(sys.argv) < 3:
20 print("Incorrect number of arguments specified") 17 print("Incorrect number of arguments specified")
18 print("syntax: gen-lockedsig-cache <locked-sigs.inc> <input-cachedir> <output-cachedir>")
21 sys.exit(1) 19 sys.exit(1)
22 20
21print('Reading %s' % sys.argv[1])
23sigs = [] 22sigs = []
24with open(sys.argv[1]) as f: 23with open(sys.argv[1]) as f:
25 for l in f.readlines(): 24 for l in f.readlines():
26 if ":" in l: 25 if ":" in l:
27 sigs.append(l.split(":")[2].split()[0]) 26 sigs.append(l.split(":")[2].split()[0])
28 27
28print('Gathering file list')
29files = set() 29files = set()
30for s in sigs: 30for s in sigs:
31 p = sys.argv[2] + "/" + s[:2] + "/*" + s + "*" 31 p = sys.argv[2] + "/" + s[:2] + "/*" + s + "*"
@@ -33,10 +33,13 @@ for s in sigs:
33 p = sys.argv[2] + "/*/" + s[:2] + "/*" + s + "*" 33 p = sys.argv[2] + "/*/" + s[:2] + "/*" + s + "*"
34 files |= set(glob.glob(p)) 34 files |= set(glob.glob(p))
35 35
36print('Processing files')
36for f in files: 37for f in files:
38 sys.stdout.write('Processing %s... ' % f)
37 _, ext = os.path.splitext(f) 39 _, ext = os.path.splitext(f)
38 if not ext in ['.tgz', '.siginfo', '.sig']: 40 if not ext in ['.tgz', '.siginfo', '.sig']:
39 # Most likely a temp file, skip it 41 # Most likely a temp file, skip it
42 print('skipping')
40 continue 43 continue
41 dst = f.replace(sys.argv[2], sys.argv[3]) 44 dst = f.replace(sys.argv[2], sys.argv[3])
42 destdir = os.path.dirname(dst) 45 destdir = os.path.dirname(dst)
@@ -45,6 +48,10 @@ for f in files:
45 if os.path.exists(dst): 48 if os.path.exists(dst):
46 os.remove(dst) 49 os.remove(dst)
47 if (os.stat(f).st_dev == os.stat(destdir).st_dev): 50 if (os.stat(f).st_dev == os.stat(destdir).st_dev):
51 print('linking')
48 os.link(f, dst) 52 os.link(f, dst)
49 else: 53 else:
54 print('copying')
50 shutil.copyfile(f, dst) 55 shutil.copyfile(f, dst)
56
57print('Done!')