Skip to content

Commit 473f387

Browse files
committed
apk: assign provider-priority
All cases where names are virtual names(non-versioned)(provides only, as the default package names are versioned de-facto) need that, at least, one provider define a non-default provider-priority(!=0) or apk will throw a error like this [1]: (maybe we want this "error" in some case?) ERROR: unable to select packages: wget (virtual): note: please select one of the 'provided by' packages explicitly provided by: uclient-fetch wget-nossl wget-ssl. "apk"'s package selection logic for a given name will look for packages names and provides names and select the provider package following this logic: - Virtual names(non-versioned names): apk will select the package with higher provider-priority. If the provider-priority is the same for several providers the apk internal logic will select the provider in alphabetically order (provider's package name)[2][3]. - Non-virtual(Versioned names): If the names are versioned apk will select the package with higher version but if the version is the exactly the same, apk will also use provider-priority to select the package, or the lower provider's package name in lexicographical order if the provider-priority is also the same. - Hybrid(Virtual name and versioned name): apk will select the package with a versioned provide name. DEFAULT_VARIANT can be used for assigning this priority in some cases (variants defined inside a common source package makefile). In other cases we need other ways to calculate a priority, the proposed logic is like this: - If DEFAULT_VARIANT=1 assign 100. - If define ALTERNATIVES assign 1(TODO: use alternative priority). - If it is an in-tree kmod assign 50.(for the kmod-r8169 particular case where the desired default provider name it is higher in alphabetical order)(only needed if we rename the package and we use a virtual name). - Else, assign 1 as default priority-provider so apk will select a package in all cases. *In most cases the "apk"'s default selecting behaviour when priority-provider is the same will be the correct one because of the package name lexicographical order. [1]: apk docs https://gitlab.alpinelinux.org/alpine/apk-tools/-/blob/master/doc/apk-package.5.scd?#L215 [2]: PR comments and debugging apk logs. openwrt#21288 (comment) [3]: openwrt#21369 Signed-off-by: Mario Andrés Pérez <mapb_@outlook.com>
1 parent 127a030 commit 473f387

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/package-pack.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ else
439439
) \
440440
$(1)$$(ABIV_$(1))[conflict]=$(VERSION) \
441441
$(if $(CONFLICTS),$(foreach conflict,$(CONFLICTS), $(conflict)$$(ABIV_$(1))[conflict]=0.0.0))" \
442-
$(if $(DEFAULT_VARIANT),--info "provider-priority:100",$(if $(PROVIDES),--info "provider-priority:1")) \
442+
$(if $(DEFAULT_VARIANT),--info "provider-priority:100",$(if $(findstring kernel/linux,$(SOURCE)),--info "provider-priority:50",--info "provider-priority:1")) \
443443
$$(APK_SCRIPTS_$(1)) \
444444
--info "depends:$$(foreach depends,$$(subst $$(comma),$$(space),$$(subst $$(space),,$$(subst $$(paren_right),,$$(subst $$(paren_left),,$$(Package/$(1)/DEPENDS))))),$$(depends))" \
445445
--files "$$(IDIR_$(1))" \

0 commit comments

Comments
 (0)