parse.depends: consider selected providers when resolving providers

If a package had _pmb_select set and an appropriate provider configured
in pmb's cfg, it was not being used when providers were being resolved.
With this change, those are now being considered. The order is also
important, we want a selected provider to be chosen before it tries to
make a decision based on provider_priority later in step #6.

Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20231122081214.11872-2-clayton@craftyguy.net%3E
This commit is contained in:
Clayton Craft 2023-11-22 00:06:01 -08:00 committed by Oliver Smith
parent c25425b97d
commit d38589a121
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 9 additions and 2 deletions

View File

@ -72,13 +72,20 @@ def package_provider(args, pkgname, pkgnames_install, suffix="native"):
"chroot already")
return provider
# 5. Pick the provider(s) with the highest priority
# 5. Pick an explicitly selected provider
provider_pkgname = args.selected_providers.get(pkgname, "")
if provider_pkgname in providers:
logging.verbose(f"{pkgname}: choosing provider '{provider_pkgname}', "
"because it was explicitly selected.")
return providers[provider_pkgname]
# 6. Pick the provider(s) with the highest priority
providers = pmb.parse.apkindex.provider_highest_priority(
providers, pkgname)
if len(providers) == 1:
return list(providers.values())[0]
# 6. Pick the shortest provider. (Note: Normally apk would fail here!)
# 7. Pick the shortest provider. (Note: Normally apk would fail here!)
return pmb.parse.apkindex.provider_shortest(providers, pkgname)