[OE-core] [PATCH 2/2] oe.path: preserve xattr in copytree() and copyhardlinktree()
Nicolas Dechesne
nicolas.dechesne at linaro.org
Tue Sep 6 15:22:39 UTC 2016
On Fri, Aug 26, 2016 at 5:43 PM, Joshua Lock <joshua.g.lock at intel.com> wrote:
>
> diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
> index 3c07df3..631c3b4 100644
> --- a/meta/lib/oe/path.py
> +++ b/meta/lib/oe/path.py
> @@ -65,7 +65,7 @@ def copytree(src, dst):
> # This way we also preserve hardlinks between files in the tree.
>
> bb.utils.mkdirhier(dst)
> - cmd = 'tar -cf - -C %s -p . | tar -xf - -C %s' % (src, dst)
> + cmd = "tar --xattrs --xattrs-include='*' -cf - -C %s -p . | tar --xattrs --xattrs-include='*' -xf - -C %s" % (src, dst)
> subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
>
> def copyhardlinktree(src, dst):
> @@ -77,9 +77,14 @@ def copyhardlinktree(src, dst):
> if (os.stat(src).st_dev == os.stat(dst).st_dev):
> # Need to copy directories only with tar first since cp will error if two
> # writers try and create a directory at the same time
> - cmd = 'cd %s; find . -type d -print | tar -cf - -C %s -p --no-recursion --files-from - | tar -xf - -C %s' % (src, src, dst)
> + 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)
> - cmd = 'cd %s; find . -print0 | cpio --null -pdlu %s' % (src, dst)
> + 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)
> subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
> else:
> copytree(src, dst)
Now that this got merged, I am seeing the following error:
==
Exception: subprocess.CalledProcessError: Command 'cp -afl
--preserve=xattr
/home/nicolas.dechesne/work/oe-rpb-master/build-rpb/tmp-rpb-glibc/work/x86_64-linux/quilt-native/0.64-r0/license-destdir/*
/home/nicolas.dechesne/work/oe-rpb-master/build-rpb/tmp-rpb-glibc/deploy/licenses'
returned non-zero exit status 1
Subprocess output:
cp: cannot preserve extended attributes, cp is built without xattr support
==
What happens is that I am installing coreutils in my images, and i
have a copy of 'cp' in my sysroot *and* I don't have xattrs in
DISTRO_FEATURES. As a consequence the 'cp' command which is invoked
does not have xattrs support, while my host 'cp' command has it...
e.g.
~/work/oe-rpb-master/build-rpb$
tmp-rpb-glibc/sysroots/x86_64-linux/usr/bin/cp -afl --preserve=xattr
foo bar
tmp-rpb-glibc/sysroots/x86_64-linux/usr/bin/cp: cannot preserve
extended attributes, cp is built without xattr support
while this one works fine:
~/work/oe-rpb-master/build-rpb$ cp -afl --preserve=xattr foo bar
Should we revert these patches or am I missing anything?
thanks
More information about the Openembedded-core
mailing list