gen-lockedsig-cache: ensure symlinks are dereferenced

If you set up a local mirror in SSTATE_MIRRORS then you can end up with
symlinks in SSTATE_DIR rather than real files. We don't want these
symlinks in the sstate-cache prodcued by gen-lockedsig-cache, so
dereference any symlinks before copying.

(From OE-Core rev: d65a6ee9e7a9c63b9a16bdb5025af8a7c6433c4f)

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:
Paul Eggleton 2016-08-11 16:44:58 +12:00 committed by Richard Purdie
parent 65ff9f5e0a
commit 0a78f987de
1 changed files with 4 additions and 3 deletions

View File

@ -57,13 +57,14 @@ for f in files:
destdir = os.path.dirname(dst)
mkdir(destdir)
src = os.path.realpath(f)
if os.path.exists(dst):
os.remove(dst)
if (os.stat(f).st_dev == os.stat(destdir).st_dev):
if (os.stat(src).st_dev == os.stat(destdir).st_dev):
print('linking')
os.link(f, dst)
os.link(src, dst)
else:
print('copying')
shutil.copyfile(f, dst)
shutil.copyfile(src, dst)
print('Done!')