diff mbox series

[kirkstone,v2,4/4] opkg-build: support ACLs and extended attributes

Message ID 20230403122409.3067997-4-p.lobacz@welotec.com
State New, archived
Headers show
Series [kirkstone,v2,1/4] package.bbclase: Add ACLs and xattrs to perform_packagecopy | expand

Commit Message

Piotr Łobacz April 3, 2023, 12:24 p.m. UTC
Signed-off-by: Piotr Łobacz <p.lobacz@welotec.com>
---
 ...support-ACLs-and-extended-attributes.patch | 52 +++++++++++++++++++
 .../opkg-utils/opkg-utils_0.5.0.bb            |  1 +
 2 files changed, 53 insertions(+)
 create mode 100644 meta/recipes-devtools/opkg-utils/opkg-utils/0002-opkg-build-support-ACLs-and-extended-attributes.patch
diff mbox series

Patch

diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils/0002-opkg-build-support-ACLs-and-extended-attributes.patch b/meta/recipes-devtools/opkg-utils/opkg-utils/0002-opkg-build-support-ACLs-and-extended-attributes.patch
new file mode 100644
index 0000000000..0744453ce9
--- /dev/null
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils/0002-opkg-build-support-ACLs-and-extended-attributes.patch
@@ -0,0 +1,52 @@ 
+From 61dcbe59656e0100dd13b980c530bf64ece78b37 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Piotr=20=C5=81obacz?= <p.lobacz@welotec.com>
+Date: Sun, 2 Apr 2023 01:10:05 +0200
+Subject: [PATCH] opkg-build: support ACLs and extended attributes
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Add support for tar archives created with --acls, --xattrs options and POSIX header format.
+
+GNU tar and libarchive already supports ACLs and extended attributes. We can now
+add this support as well to opkg-build script in order to use setfacl or setcap
+inside do_install command and end up with a file in an image with the relevant
+extended file attributes.
+
+Signed-off-by: Piotr Łobacz <p.lobacz@welotec.com>
+---
+ opkg-build | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/opkg-build b/opkg-build
+index a9e45d4..eb764a5 100755
+--- a/opkg-build
++++ b/opkg-build
+@@ -159,14 +159,13 @@ compressorargs=""
+ #    - Busybox tar doesn't support '--format'
+ #    - On some Linux distros, tar now defaults to posix format if '--format'
+ #      isn't explicitly specified
+-#    - Opkg doesn't currently support posix format archives
+ #
+ # It's easier to check for mention of the '--format' option than to detect the
+ # tar implementation and maintain a list of which support '--format'.
+ tarformat=""
+ if tar --help 2>&1 | grep -- "--format" > /dev/null;
+ then
+-    tarformat="--format=gnu"
++    tarformat="--format=posix"
+ fi
+ 
+ compressor_ext() {
+@@ -314,7 +313,7 @@ export LANG=C
+ export LC_ALL=C
+ ( cd $pkg_dir/$CONTROL && find . -type f | sort > $tmp_dir/control_list )
+ ( cd $pkg_dir && find . -path ./$CONTROL -prune -o -path . -o -print  | sort > $tmp_dir/file_list )
+-( cd $pkg_dir && tar $ogargs $tsortargs --no-recursion $mtime_args -c $tarformat -T $tmp_dir/file_list | $compressor $compressorargs > $tmp_dir/data.tar.$cext )
++( cd $pkg_dir && tar --xattrs --acls $ogargs $tsortargs --no-recursion $mtime_args -c $tarformat -T $tmp_dir/file_list | $compressor $compressorargs > $tmp_dir/data.tar.$cext )
+ ( cd $pkg_dir/$CONTROL && tar $ogargs $tsortargs --no-recursion --mtime=@$build_date -c $tarformat -T $tmp_dir/control_list | gzip $zipargs > $tmp_dir/control.tar.gz )
+ rm $tmp_dir/file_list
+ rm $tmp_dir/control_list
+-- 
+2.34.1
+
diff --git a/meta/recipes-devtools/opkg-utils/opkg-utils_0.5.0.bb b/meta/recipes-devtools/opkg-utils/opkg-utils_0.5.0.bb
index b27e3ded33..9349ba06d2 100644
--- a/meta/recipes-devtools/opkg-utils/opkg-utils_0.5.0.bb
+++ b/meta/recipes-devtools/opkg-utils/opkg-utils_0.5.0.bb
@@ -9,6 +9,7 @@  PROVIDES += "${@bb.utils.contains('PACKAGECONFIG', 'update-alternatives', 'virtu
 
 SRC_URI = "git://git.yoctoproject.org/opkg-utils;protocol=https;branch=master \
            file://0001-update-alternatives-correctly-match-priority.patch \
+           file://0002-opkg-build-support-ACLs-and-extended-attributes.patch \
            "
 SRCREV = "9239541f14a2529b9d01c0a253ab11afa2822dab"