oe.path: fix copyhardlinktree()

The change to preserve extended attributes in copytree() and
copyhardlinktree() (e591d69103a40ec4f76d1132a6039d9cb1555103)
resulted in an incorrect cp invocation in copyhardlinktree() when
the source directory contained hidden files.

This was because the passed src was modified in place but some code
paths expected it to remain unmodified from the passed value.
Resolve the issue by constructing a new source string, rather than
modifying the passed in string.

(From OE-Core rev: 2b9fdd8448c2c29418d1c3fca9fe1789466f09b4)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock 2016-09-05 14:35:09 +01:00 committed by Richard Purdie
parent f5b4ca2ad7
commit 822c708e8f

View File

@ -79,12 +79,15 @@ def copyhardlinktree(src, dst):
# writers try and create a directory at the same time
cmd = "cd %s; find . -type d -print | tar --xattrs --xattrs-include='*' -cf - -C %s -p --no-recursion --files-from - | tar --xattrs --xattrs-include='*' -xf - -C %s" % (src, src, dst)
subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
source = ''
if os.path.isdir(src):
import glob
if len(glob.glob('%s/.??*' % src)) > 0:
src = src + '/.??* '
src = src + '/*'
cmd = 'cp -afl --preserve=xattr %s %s' % (src, dst)
source = '%s/.??* ' % src
source = source + '%s/*' % src
else:
source = src
cmd = 'cp -afl --preserve=xattr %s %s' % (source, dst)
subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
else:
copytree(src, dst)