diff mbox series

package.bbclase: Add ACLs and xattrs to perform_packagecopy

Message ID 20230403104216.3058652-1-p.lobacz@welotec.com
State New
Headers show
Series package.bbclase: Add ACLs and xattrs to perform_packagecopy | expand

Commit Message

Piotr Łobacz April 3, 2023, 10:42 a.m. UTC
This is necessary in order to preserve all the extended attributes
set in do_install also in PKGD directory, otherwise they are
dropped and not stored in created package(s).

For the momemnt it is only supported by OPKG package manager
as it has support for libarchive and tar implementations, which
supports ACLs and xattrs.

Fixes: [YOCTO #9858]

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

Comments

Richard Purdie April 3, 2023, 10:55 a.m. UTC | #1
On Mon, 2023-04-03 at 12:42 +0200, Piotr Łobacz wrote:
> This is necessary in order to preserve all the extended attributes
> set in do_install also in PKGD directory, otherwise they are
> dropped and not stored in created package(s).
> 
> For the momemnt it is only supported by OPKG package manager
> as it has support for libarchive and tar implementations, which
> supports ACLs and xattrs.
> 
> Fixes: [YOCTO #9858]
> 
> Signed-off-by: Piotr Łobacz <p.lobacz@welotec.com>
> ---
>  meta/classes/package.bbclass | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index 2950218145..b0334d9190 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -863,8 +863,8 @@ 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
> +    cmd = 'tar --acls --xattrs --exclude=./sysroot-only -cf - -C %s -p -S . | tar --acls --xattrs -xf - -C %s' % (dest, dvar)
>      subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
>  
>      # replace RPATHs for the nativesdk binaries, to make them relocatable

This patch looks to be against an older release as much of the
package.bbclass code is now in package.py. I'd definitely be interested
in this incremental improvement to the support of xattrs. 

I also wondered if it causes any issues with existing recipes? I'm not
sure if any set xattrs which we'd now suddenly "see"?

I'm not sure we can claim it entirely fixes #9858 since it sounds like
it works for opkg but not deb or rpm packages? It is still great to
see the progress though!

The final question I had was around testing - should we add some
automated tests for this to ensure it doesn't regress again?

Cheers,

Richard
Piotr Łobacz April 3, 2023, 11:16 a.m. UTC | #2
This is for the kikrstone release only as I'm currently working on it.

I have switched from debs to ipks as from what I have read they have the abbility to support this ACLs and xattrs.
There was already a commented part of the code in libopkg for supporting them.

Regarding seeing some xattrs I do not know.

Hmmm it fixes 9858 as the ACLs are preserved in package and packages-split directories. The additional issue
is with packages itself.

I think that we could add here some verification what packages we are creating but I haven't investigated it.
Maybe somebody of you have any ideas?

BR,
Piotr
Piotr Łobacz April 3, 2023, 11:35 a.m. UTC | #3
Richard I will send these patches in one message instead separate.

BR
Piotr
diff mbox series

Patch

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 2950218145..b0334d9190 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -863,8 +863,8 @@  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
+    cmd = 'tar --acls --xattrs --exclude=./sysroot-only -cf - -C %s -p -S . | tar --acls --xattrs -xf - -C %s' % (dest, dvar)
     subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
 
     # replace RPATHs for the nativesdk binaries, to make them relocatable