mirror of
https://git.yoctoproject.org/poky
synced 2026-09-24 22:36:21 +02:00
scripts/gen-lockedsig-cache: improve output
* Print some status when running * When incorrect number of arguments specified, print usage text (From OE-Core master rev: ac38d245878b618ddf56f9a68834d344500e45a6) (From OE-Core rev: 5c5953cbc44c7532650cb9e3c877fa86c9d0f242) 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>
This commit is contained in:
committed by
Richard Purdie
parent
4b5d4ca1c9
commit
f181e72cb8
@@ -1,7 +1,4 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
|
||||||
# gen-lockedsig-cache <locked-sigs.inc> <input-cachedir> <output-cachedir>
|
|
||||||
#
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
@@ -18,14 +15,17 @@ def mkdir(d):
|
|||||||
|
|
||||||
if len(sys.argv) < 3:
|
if len(sys.argv) < 3:
|
||||||
print("Incorrect number of arguments specified")
|
print("Incorrect number of arguments specified")
|
||||||
|
print("syntax: gen-lockedsig-cache <locked-sigs.inc> <input-cachedir> <output-cachedir>")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
print('Reading %s' % sys.argv[1])
|
||||||
sigs = []
|
sigs = []
|
||||||
with open(sys.argv[1]) as f:
|
with open(sys.argv[1]) as f:
|
||||||
for l in f.readlines():
|
for l in f.readlines():
|
||||||
if ":" in l:
|
if ":" in l:
|
||||||
sigs.append(l.split(":")[2].split()[0])
|
sigs.append(l.split(":")[2].split()[0])
|
||||||
|
|
||||||
|
print('Gathering file list')
|
||||||
files = set()
|
files = set()
|
||||||
for s in sigs:
|
for s in sigs:
|
||||||
p = sys.argv[2] + "/" + s[:2] + "/*" + s + "*"
|
p = sys.argv[2] + "/" + s[:2] + "/*" + s + "*"
|
||||||
@@ -33,10 +33,13 @@ for s in sigs:
|
|||||||
p = sys.argv[2] + "/*/" + s[:2] + "/*" + s + "*"
|
p = sys.argv[2] + "/*/" + s[:2] + "/*" + s + "*"
|
||||||
files |= set(glob.glob(p))
|
files |= set(glob.glob(p))
|
||||||
|
|
||||||
|
print('Processing files')
|
||||||
for f in files:
|
for f in files:
|
||||||
|
sys.stdout.write('Processing %s... ' % f)
|
||||||
_, ext = os.path.splitext(f)
|
_, ext = os.path.splitext(f)
|
||||||
if not ext in ['.tgz', '.siginfo', '.sig']:
|
if not ext in ['.tgz', '.siginfo', '.sig']:
|
||||||
# Most likely a temp file, skip it
|
# Most likely a temp file, skip it
|
||||||
|
print('skipping')
|
||||||
continue
|
continue
|
||||||
dst = f.replace(sys.argv[2], sys.argv[3])
|
dst = f.replace(sys.argv[2], sys.argv[3])
|
||||||
destdir = os.path.dirname(dst)
|
destdir = os.path.dirname(dst)
|
||||||
@@ -45,6 +48,10 @@ for f in files:
|
|||||||
if os.path.exists(dst):
|
if os.path.exists(dst):
|
||||||
os.remove(dst)
|
os.remove(dst)
|
||||||
if (os.stat(f).st_dev == os.stat(destdir).st_dev):
|
if (os.stat(f).st_dev == os.stat(destdir).st_dev):
|
||||||
|
print('linking')
|
||||||
os.link(f, dst)
|
os.link(f, dst)
|
||||||
else:
|
else:
|
||||||
|
print('copying')
|
||||||
shutil.copyfile(f, dst)
|
shutil.copyfile(f, dst)
|
||||||
|
|
||||||
|
print('Done!')
|
||||||
|
|||||||
Reference in New Issue
Block a user