[openwrt/openwrt] build: add default priority to ABI-versioned packages

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


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

commit d943ebf5b33da82a032081f599572981f64852eb
Author: George Sapkin <george at sapk.in>
AuthorDate: Tue Jan 6 03:50:37 2026 +0200

    build: add default priority to ABI-versioned packages
    
    If a package has an ABI version defined, set priority to 10. The enables
    packages with an ABI version to be installed by their base name instead
    of a name and an ABI version, e.g.:
    
    libfoo3, where 3 is the ABI version can be installed by just libfoo.
    
    This affects manual installation only, as the dependency resolution
    takes care of ABI versions.
    
    Refactor apk priority logic into a helper define.
    
    Signed-off-by: George Sapkin <george at sapk.in>
    Link: https://github.com/openwrt/openwrt/pull/21369
    (cherry picked from commit 470e030a5eae77e94192e0dd933d7b1b657f7b2c)
    Link: https://github.com/openwrt/openwrt/pull/21547
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 include/package-pack.mk | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/include/package-pack.mk b/include/package-pack.mk
index 3fcab2da02..723d23e201 100644
--- a/include/package-pack.mk
+++ b/include/package-pack.mk
@@ -245,6 +245,29 @@ $(strip
 )
 endef
 
+# Get apk provider priority
+#
+# - if a package is marked as a default variant, set it to 100.
+#
+# - if a package has an ABI version defined, set it to 10.
+#   The enables packages with an ABI version to be installed by their base name
+#   instead of a name and an ABI version, e.g.:
+#   libfoo3, where 3 is the ABI version can be installed by just libfoo.
+#   This affects manual installation only, as the dependency resolution takes
+#   care of ABI versions.
+#
+# - otherwise return nothing, i.e. package will have the default priority 0.
+#
+# 1: Default variant
+# 2: ABI version
+define GetProviderPriority
+$(strip
+  $(if $(1),100,
+    $(if $(2),10)
+  )
+)
+endef
+
 ifneq ($(PKG_NAME),toolchain)
   define CheckDependencies
 	@( \
@@ -384,6 +407,7 @@ endif
       Package/$(1)/PROVIDES := $$(filter-out $(1)$$(ABIV_$(1)),$$(Package/$(1)/PROVIDES)$$(if $$(ABIV_$(1)), $(1) $$(foreach provide,$$(Package/$(1)/PROVIDES),$$(provide)$$(ABIV_$(1)))))
     else
       Package/$(1)/PROVIDES := $$(call FormatProvides,$(1),$(VERSION),$(ABI_VERSION),$(PROVIDES))
+      Package/$(1)/PRIORITY := $$(call GetProviderPriority,$(DEFAULT_VARIANT),$(ABI_VERSION))
     endif
 
 $(_define) Package/$(1)/CONTROL
@@ -577,7 +601,7 @@ else
 	  --info "url:$(URL)" \
 	  --info "maintainer:$(MAINTAINER)" \
 	  $$(if $$(Package/$(1)/PROVIDES),--info "provides:$$(Package/$(1)/PROVIDES)") \
-	  $(if $(DEFAULT_VARIANT),--info "provider-priority:100") \
+	  $$(if $$(Package/$(1)/PRIORITY),--info "provider-priority:$$(Package/$(1)/PRIORITY)") \
 	  $$(APK_SCRIPTS_$(1)) \
 	  --info "depends:$$(foreach depends,$$(subst $$(comma),$$(space),$$(subst $$(space),,$$(subst $$(paren_right),,$$(subst $$(paren_left),,$$(Package/$(1)/DEPENDS))))),$$(depends))" \
 	  --files "$$(IDIR_$(1))" \




More information about the lede-commits mailing list