mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00

When constructing the sstate-cache directory for the extensible SDK, we were copying in any matching native sstate packages, and as the signature doesn't actually change when the distro changes (since NATIVELSBSTRING is just a path separator for the artifacts and is not part of the signature) we ended up copying duplicated packages when the distro changed e.g. upon host distro upgrade. Only search in the NATIVELSBSTRING-named subdirectory for native packages and the issue goes away. Fixes [YOCTO #8885]. (From OE-Core rev: 6c6baf6aa1823b8b20123f505e45c2768a193ad5) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
58 lines
1.4 KiB
Python
Executable File
58 lines
1.4 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
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) < 5:
|
|
print("Incorrect number of arguments specified")
|
|
print("syntax: gen-lockedsig-cache <locked-sigs.inc> <input-cachedir> <output-cachedir> <nativelsbstring>")
|
|
sys.exit(1)
|
|
|
|
print('Reading %s' % sys.argv[1])
|
|
sigs = []
|
|
with open(sys.argv[1]) as f:
|
|
for l in f.readlines():
|
|
if ":" in l:
|
|
sigs.append(l.split(":")[2].split()[0])
|
|
|
|
print('Gathering file list')
|
|
files = set()
|
|
for s in sigs:
|
|
p = sys.argv[2] + "/" + s[:2] + "/*" + s + "*"
|
|
files |= set(glob.glob(p))
|
|
p = sys.argv[2] + "/%s/" % sys.argv[4] + s[:2] + "/*" + s + "*"
|
|
files |= set(glob.glob(p))
|
|
|
|
print('Processing files')
|
|
for f in files:
|
|
sys.stdout.write('Processing %s... ' % f)
|
|
_, ext = os.path.splitext(f)
|
|
if not ext in ['.tgz', '.siginfo', '.sig']:
|
|
# Most likely a temp file, skip it
|
|
print('skipping')
|
|
continue
|
|
dst = f.replace(sys.argv[2], sys.argv[3])
|
|
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):
|
|
print('linking')
|
|
os.link(f, dst)
|
|
else:
|
|
print('copying')
|
|
shutil.copyfile(f, dst)
|
|
|
|
print('Done!')
|