Commit 473f387
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
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
439 | 439 | | |
440 | 440 | | |
441 | 441 | | |
442 | | - | |
| 442 | + | |
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| |||
0 commit comments