_pmb_select: pmb installs pkg with highest priority first, then uninstalls it and installs the selected option
@craftyguy wrote in https://lists.sr.ht/~postmarketos/pmbootstrap-devel/patches/46900:
pmb/chroot/apk.py:install_run_apk, due to 6a741091, causes some extra work to be done. Basically what happens is if a package depends on something that can be selected with _pmb_select, pmb will install the option with the highest priority first, then later it will install the selected option.
From what I can tell by looking at install_run_apk, to_add installs pmos-ui-*, which pulls in pmos-base-ui. That in turn depends on pmos-wifi-backend (which is also in _pmb_select). The select preference was determined earlier but the results are in to_add_local so they aren't considered here. Instead apk looks at the provider priority and picks whatever is the highest. In cases where the selected option has a lower provides_priority, it is not selected when installing to_add, but it is installed later when installing to_add_local (the previous provides package is purged / replaced by the selected one).
The end result seems to be the desired result, as far as I can tell, there's just some weird case where an unselected-but-higher-priority package is installed first, then replaced when it does
apk add {to_add_local}
...