pmb sometimes fails to resolve virtual package dependencies
This was observed in the CI for pmaports!5000, where:
-
branch added a new virtual package (pmos-ramdisk), with an existing package (pmos-initramfs) "providing" it
-
other package (pmos-base) was set to depend on the new virtual package
-
pmb build fails with:
(000433) [17:23:25] ERROR: Package 'postmarketos-ramdisk': Could not find aport, and could not find this package in any APKINDEX!
(000433) [17:23:25] See also: <https://postmarketos.org/troubleshooting>
(000433) [17:23:25] Traceback (most recent call last):
File "/tmp/pmbootstrap/pmb/__init__.py", line 76, in main
getattr(frontend, args.action)(args)
File "/tmp/pmbootstrap/pmb/helpers/frontend.py", line 123, in build
if not pmb.build.package(args, package, arch_package, force,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pmbootstrap/pmb/build/_package.py", line 529, in package
if not init_buildenv(args, apkbuild, arch, strict, force, cross, suffix,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pmbootstrap/pmb/build/_package.py", line 219, in init_buildenv
depends, built = build_depends(args, apkbuild, depends_arch, strict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pmbootstrap/pmb/build/_package.py", line 167, in build_depends
if package(args, depend, arch, strict=strict):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pmbootstrap/pmb/build/_package.py", line 520, in package
apkbuild = get_apkbuild(args, pkgname, arch)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pmbootstrap/pmb/build/_package.py", line 64, in get_apkbuild
raise RuntimeError("Package '" + pkgname + "': Could not find aport, and"
In the example above, I retried the CI job and it worked, suggesting that this is an intermittent failure.
I noticed that the failing function pmb/helpers/package.py:get
isn't explicitly checking providers, but there's a similar code path in pmb/build/_package.py:get_apkbuild
where providers are searched.