[openwrt/openwrt] imagebuilder: add ABI suffix to packages when using apk

LEDE Commits lede-commits at lists.infradead.org
Fri Jan 16 08:13:16 PST 2026


robimarko pushed a commit to openwrt/openwrt.git, branch openwrt-25.12:
https://git.openwrt.org/43057c5c16c093bb8da5542a563c7e25e7d3c8e6

commit 43057c5c16c093bb8da5542a563c7e25e7d3c8e6
Author: George Sapkin <george at sapk.in>
AuthorDate: Thu Jan 8 05:00:26 2026 +0200

    imagebuilder: add ABI suffix to packages when using apk
    
    If an apk package with an ABI version doesn't have priority set, it
    can't be selected by its base name:
    
    $ make manifest PACKAGES='libustream-openssl libsqlite3'
    ERROR: unable to select packages:
      libsqlite3 (virtual):
        note: please select one of the 'provided by'
              packages explicitly
        provided by: libsqlite3-0
        required by: world[libsqlite3]
      libustream-openssl (virtual):
        note: please select one of the 'provided by'
              packages explicitly
        provided by: libustream-openssl20201210
        required by: world[libustream-openssl]
    
    Look up the ABI version in apk index and if present, add an ABI suffix
    to all requested packages.
    
    Signed-off-by: George Sapkin <george at sapk.in>
    Link: https://github.com/openwrt/openwrt/pull/21449
    (cherry picked from commit 31cdd13d22dd374d4a8b8d86377627ad01928495)
    Link: https://github.com/openwrt/openwrt/pull/21547
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/imagebuilder/files/Makefile | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile
index ee40612c1f..a44eb8b988 100644
--- a/target/imagebuilder/files/Makefile
+++ b/target/imagebuilder/files/Makefile
@@ -145,6 +145,32 @@ BUILD_PACKAGES:=$(sort $(DEFAULT_PACKAGES) $($(USER_PROFILE)_PACKAGES) kernel)
 BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES))
 BUILD_PACKAGES:=$(USER_PACKAGES) $(BUILD_PACKAGES)
 BUILD_PACKAGES:=$(filter-out $(filter -%,$(BUILD_PACKAGES)) $(patsubst -%,%,$(filter -%,$(BUILD_PACKAGES))),$(BUILD_PACKAGES))
+
+ifneq ($(CONFIG_USE_APK),)
+BUILD_PACKAGES+= \
+  "base-files=$(BASE_FILES_VERSION)" \
+  "libc=$(LIBC_VERSION)" \
+  "kernel=$(KERNEL_VERSION)"
+endif
+
+# Get ABI version suffix for a package from an apk index
+#
+# 1: package name
+define GetABISuffix
+$(shell $(APK) query --fields tags --match provides $(1) | grep openwrt:abiversion | awk -F= '{print $$2; exit}')
+endef
+
+# Format packages by adding an ABI version suffix if found
+#
+# 1: list of packages
+define FormatPackages
+$(strip $(foreach pkg,$(strip $(subst ",,$(1))),
+  $(eval pkg_name:=$(firstword $(subst =, ,$(pkg))))
+  $(if $(findstring =,$(pkg)),$(eval pkg_ver:==$(lastword $(subst =, ,$(pkg)))))
+  $(pkg_name)$(call GetABISuffix,$(pkg_name))$(pkg_ver)
+))
+endef
+
 PACKAGES:=
 
 _call_image: staging_dir/host/.prereq-build
@@ -229,10 +255,8 @@ ifeq ($(CONFIG_USE_APK),)
 	$(OPKG) install $(wildcard $(PACKAGE_DIR)/kernel_*.ipk)
 	$(OPKG) install $(BUILD_PACKAGES)
 else
-	$(APK) add --arch $(ARCH_PACKAGES) --no-scripts $(BUILD_PACKAGES) \
-        "base-files=$(BASE_FILES_VERSION)" \
-        "libc=$(LIBC_VERSION)" \
-        "kernel=$(KERNEL_VERSION)"
+	$(eval BUILD_PACKAGES:=$(call FormatPackages,$(BUILD_PACKAGES)))
+	$(APK) add --arch $(ARCH_PACKAGES) --no-scripts $(BUILD_PACKAGES)
 endif
 
 prepare_rootfs: FORCE




More information about the lede-commits mailing list