apko icon indicating copy to clipboard operation
apko copied to clipboard

Unable to correctly resolve packages if a provides is used with a constraint

Open philroche opened this issue 3 months ago • 3 comments

apko is unable to resolve correctly when a dependency is defined using a provides AND a constraint.

It resolves to the provides first and then is unable to resolve the constraints as it has already chosen based on provides.

The simplest reproducer is py3-numpy<2.0

There are multiple packages that provide py3-numpy, 1.25, 1.25, 2.0, 2.1 etc. The expectation is that when using py3-numpy<2.0 it would resolve to 1.26. It does not.

Instead we see

solving "py3.12-numpy<2.0" constraint:   py3.12-numpy-1.26-1.26.5-r0.apk disqualified because parsing "": invalid version , could not parse
  py3.12-numpy-1.26-1.26.5-r4.apk disqualified because py3.13-numpy-1.26-1.26.5-r5.apk already provides py3-numpy
  py3.12-numpy-1.26-1.26.5-r5.apk disqualified because py3.13-numpy-1.26-1.26.5-r5.apk already provides py3-numpy

In apko logs.

We can work around this by using 1.26 expliclitly but not being able to use constraints with a provides is a gap and we should fix.

APK itself does not have this issue.

philroche avatar Sep 19 '25 12:09 philroche