diff mbox series

[3/3] package.bbclass: add support for ACLs and xattr

Message ID 20230710095800.2033309-3-p.lobacz@welotec.com
State New
Headers show
Series [1/3] bitbake.conf: add acl and xattr distro native features support | expand

Commit Message

Piotr Łobacz July 10, 2023, 9:58 a.m. UTC
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.lobacz@welotec.com>
---
 meta/classes-global/package.bbclass | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Comments

Ross Burton July 10, 2023, 11:46 a.m. UTC | #1
On 10 Jul 2023, at 10:58, Piotr Łobacz via lists.openembedded.org <p.lobacz=welotec.com@lists.openembedded.org> wrote:
> +    # 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}'

Is there much of a hit if we always tell tar to always preserve the acl/xattr information, instead of changing behaviour based on whether ipkg is enabled?  I don’t like how enabling ipkgs changes the tar command that is also used to build the rpms.

Ross
Piotr Łobacz July 12, 2023, 11:26 a.m. UTC | #2
I have removed this check as you are absolutelly right. Besides in future I suspect that we will have also support for ACLs and xattrs in both debs and rpms as well.

Thx
Piotr
diff mbox series

Patch

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