Skip to contentSkip to conversation

opkg: fix WITH_ACL and USE_ATTR being enabled per default

PATCH New [email protected] 1 participant 2 messages Dec 3, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 opkg: fix WITH_ACL and USE_ATTR being enabled per default

From: Etienne Cordonnier <[email protected]>

ENABLE_XATTR and ENABLE_ACL were both "no" per default in autoconf, and this default value was mistakenly changed during the cmake migration. Change it back to OFF per default

---
 ...003-cmake-fix-WITH_ACL-and-USE_XATTR.patch | 95 +++++++++++++++++++
 meta/recipes-devtools/opkg/opkg_0.9.0.bb      |  1 +
 2 files changed, 96 insertions(+)
 create mode 100644 meta/recipes-devtools/opkg/opkg/0003-cmake-fix-WITH_ACL-and-USE_XATTR.patch
meta/recipes-devtools/opkg/opkg/0003-cmake-fix-WITH_ACL-and-USE_XATTR.patch new file +95 -0
new file mode 100644
index 0000000000..a041965515
@@ -0,0 +1,95 @@
+From 6d2eb69bb7b8f1ada6232eba4eb9c223be386d29 Mon Sep 17 00:00:00 2001
+From: Etienne Cordonnier <[email protected]>
+Date: Thu, 27 Nov 2025 19:05:16 +0100
+Subject: [PATCH] cmake: fix WITH_ACL and USE_XATTR
+
+- CMakeLists.txt was using USE_ACL, but config.h.in was using WITH_ACL.
+  Use the consistent logic that optional dependencies use the prefix HAVE_,
+  and thus since use WITH_ACL consistently (build dependency libacl).
+
+- opkg_archive.c was using ifdef instead of if for both USE_ACL and USE_XATTR.
+
+- ENABLE_XATTR and ENABLE_ACL were both "no" per default in autoconf, and this default
+  value was mistakenly changed during the cmake migration. Change it back to OFF per default.
+
+Upstream-Status: Backport [https://git.yoctoproject.org/opkg/commit/?id=6d2eb69bb7b8f1ada6232eba4eb9c223be386d29]
+Signed-off-by: Etienne Cordonnier <[email protected]>
+Signed-off-by: Alex Stewart <[email protected]>
+---
+ CMakeLists.txt         | 6 ++++--
+ config.h.in            | 2 +-
+ libopkg/CMakeLists.txt | 2 +-
+ libopkg/opkg_archive.c | 4 ++--
+ 4 files changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index f2c01b1..316e343 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -13,6 +13,7 @@ set(PROJECT_VERSION "${PROJECT_VERSION}+git")
+ set(VERSION ${PROJECT_VERSION})
+ 
+ option(STATIC_LIBOPKG "Statically link libopkg into opkg" OFF)
++# Options which add optional dependencies are prefixed with "WITH_"
+ # The current libopkg API is deprecated so only build it if requested
+ option(WITH_LIBOPKG_API "Enable deprecated libopkg API" OFF)
+ option(WITH_XZ "Enable xz compressor support" ON)
+@@ -23,8 +24,9 @@ option(WITH_CURL "Enable downloading with curl" ON)
+ include(CMakeDependentOption)
+ cmake_dependent_option(WITH_SSLCURL "Enable certificate authentication with curl" ON "WITH_CURL" OFF)
+ option(WITH_SHA256 "Enable sha256sum check" OFF)
+-option(USE_ACL "Enable ACL support" ON)
+-option(USE_XATTR "Enable xattr support" ON)
++option(WITH_ACL "Enable ACL support" OFF)
++# Options which don't add optional dependencies are prefixed with "USE_"
++option(USE_XATTR "Enable xattr support" OFF)
+ option(USE_SOLVER_LIBSOLV "Enable libsolv solver support if true. Enable the internal solver if false." ON)
+ if(USE_SOLVER_LIBSOLV)
+     set(USE_SOLVER_INTERNAL OFF CACHE BOOL "Disable internal solver")
+diff --git a/config.h.in b/config.h.in
+index 877b8c7..f2d74c5 100644
+--- a/config.h.in
++++ b/config.h.in
+@@ -6,7 +6,7 @@
+ #cmakedefine01 WITH_CURL
+ #cmakedefine01 WITH_SSLCURL
+ #cmakedefine01 WITH_ACL
+-#cmakedefine01 WITH_XATTR
++#cmakedefine01 USE_XATTR
+ #cmakedefine01 USE_SOLVER_LIBSOLV
+ #cmakedefine01 USE_SOLVER_INTERNAL
+ #cmakedefine01 WITH_GPGME
+diff --git a/libopkg/CMakeLists.txt b/libopkg/CMakeLists.txt
+index 628cb8c..39064c2 100644
+--- a/libopkg/CMakeLists.txt
++++ b/libopkg/CMakeLists.txt
+@@ -182,7 +182,7 @@ if(WITH_SSLCURL)
+     target_link_libraries(libopkg OpenSSL::Crypto OpenSSL::SSL)
+ endif()
+ 
+-if(USE_ACL)
++if(WITH_ACL)
+     pkg_check_modules(acl REQUIRED IMPORTED_TARGET libacl)
+     target_link_libraries(libopkg PkgConfig::acl)
+ endif()
+diff --git a/libopkg/opkg_archive.c b/libopkg/opkg_archive.c
+index 48f80c0..fb40db3 100644
+--- a/libopkg/opkg_archive.c
++++ b/libopkg/opkg_archive.c
+@@ -914,11 +914,11 @@ struct opkg_ar *ar_open_pkg_data_archive(const char *filename)
+     ar->extract_flags = ARCHIVE_EXTRACT_OWNER | ARCHIVE_EXTRACT_PERM |
+         ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_UNLINK | ARCHIVE_EXTRACT_NO_OVERWRITE;
+ 
+-#ifdef USE_ACL
++#if WITH_ACL
+     ar->extract_flags |= ARCHIVE_EXTRACT_ACL;
+ #endif
+ 
+-#ifdef USE_XATTR
++#if USE_XATTR
+     ar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS | ARCHIVE_EXTRACT_XATTR;
+ #endif
+ 
+-- 
+2.43.0
+
meta/recipes-devtools/opkg/opkg_0.9.0.bb +1 -0
index ed2f36d636..f021fd9b5a 100644
@@ -16,6 +16,7 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz
            file://opkg.conf \
            file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \
            file://0002-config.h.in-fix-typo.patch \
+           file://0003-cmake-fix-WITH_ACL-and-USE_XATTR.patch \
            file://run-ptest \
            "
 
Signature · 1 line
2.43.0
#1 lore raw

PATCH v2 2/2 opkg: add PACKAGECONFIG options for acl and xattr

From: Etienne Cordonnier <[email protected]>

During the last opkg update the application's ACL feature was enabled by default, which requires acl recipe as a dependency, however it wasn't enabled in the recipe, making compilation fail when libacl wasn't in the sysroot.

This change adds a PACKAGECONFIG that makes acl an optional dependency, and it is only enabled automatically if "acl" is present in DISTRO_FEATURES.

It also enables xattr per default when the corresponding DISTRO_FEATURES is enabled.

---
 meta/recipes-devtools/opkg/opkg_0.9.0.bb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-devtools/opkg/opkg_0.9.0.bb +3 -1
index f021fd9b5a..7551f1bc49 100644
@@ -32,7 +32,7 @@ inherit cmake pkgconfig ptest
 target_localstatedir := "${localstatedir}"
 OPKGLIBDIR ??= "${target_localstatedir}/lib"
 
-PACKAGECONFIG ??= "libsolv"
+PACKAGECONFIG ??= "libsolv ${@bb.utils.filter('DISTRO_FEATURES', 'acl xattr', d)}"
 
 PACKAGECONFIG[gpg] = "-DWITH_GPGME=ON,-DWITH_GPGME=OFF,\
     gnupg gpgme libgpg-error,\
@@ -41,6 +41,8 @@ PACKAGECONFIG[gpg] = "-DWITH_GPGME=ON,-DWITH_GPGME=OFF,\
 PACKAGECONFIG[curl] = "-DWITH_CURL=ON,-DWITH_CURL=OFF,curl"
 PACKAGECONFIG[ssl-curl] = "-DWITH_SSLCURL=ON,-DWITH_SSLCURL=OFF,curl openssl"
 PACKAGECONFIG[sha256] = "-DWITH_SHA256=ON,-DWITH_SHA256=OFF"
+PACKAGECONFIG[acl] = "-DWITH_ACL=ON, -DWITH_ACL=OFF, acl"
+PACKAGECONFIG[xattr] = "-DUSE_XATTR=ON, -DUSE_XATTR=OFF"
 PACKAGECONFIG[libsolv] = "-DUSE_SOLVER_LIBSOLV=ON,-DUSE_SOLVER_LIBSOLV=OFF,libsolv"
 
 EXTRA_OECMAKE = "-DWITH_ZSTD=ON"
Signature · 1 line
2.43.0