Extend `tar` command, with additional parameters, depending
on choosen package class and target distro features, in order
to support ACLs and xattr.

Currently only `package_ipk` supports fully ACLs and xattr.

Signed-off-by: Piotr Łobacz <p.lob...@welotec.com>
---
 meta/classes-global/package.bbclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/meta/classes-global/package.bbclass 
b/meta/classes-global/package.bbclass
index e8055a9cdc..7229e4f2b5 100644
--- a/meta/classes-global/package.bbclass
+++ b/meta/classes-global/package.bbclass
@@ -342,8 +342,14 @@ python perform_packagecopy () {
 
     # Start by package population by taking a copy of the installed
     # files to operate on
-    # Preserve sparse files and hard links
-    cmd = 'tar --exclude=./sysroot-only -cf - -C %s -p -S . | tar -xf - -C %s' 
% (dest, dvar)
+    # Preserve sparse files, hard links, ACLs and extended attributes
+    acl = ''
+    xattr = ''
+    # TODO: for the moment only ipk packages are supporting ACLs and extended 
attributes
+    if bb.utils.contains('PACKAGE_CLASSES', 'package_ipk', True, False, d):
+        acl = bb.utils.contains('DISTRO_FEATURES', 'acl', '--acls', '', d)
+        xattr = bb.utils.contains('DISTRO_FEATURES', 'xattr', '--xattrs', '', 
d)
+    cmd = f'tar {acl} {xattr} --numeric-owner --exclude=./sysroot-only -cf - 
-C {dest} -p -S . | tar {acl} {xattr} -xf - -C {dvar}'
     subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
 
     # replace RPATHs for the nativesdk binaries, to make them relocatable
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#184160): 
https://lists.openembedded.org/g/openembedded-core/message/184160
Mute This Topic: https://lists.openembedded.org/mt/100090080/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to