gliderlabs / docker-alpine

Alpine Linux Docker image. Win at minimalism!
http://gliderlabs.viewdocs.io/docker-alpine
BSD 2-Clause "Simplified" License
5.7k stars 529 forks source link

Using version pinning and virtual packages results in unsatisfiable constraints #205

Open allanlei opened 8 years ago

allanlei commented 8 years ago

When using virtual packages in-conjunction with version pinning results in the package not found. I am trying to install gdal-dev which is not in v3.4 but is in edge/testing. If I remove the virtual package, it installs.

Is this possible or bug?

/etc/apk/repositories:

http://dl-cdn.alpinelinux.org/alpine/v3.4/main
http://dl-cdn.alpinelinux.org/alpine/v3.4/community
@edge-testing http://dl-cdn.alpinelinux.org/alpine/edge/testing

Commands:

# apk --no-cache add --virtual .build-deps gdal-dev@edge-testing
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
ERROR: unsatisfiable constraints:
  gdal-2.1.0-r1:
    masked in: @edge-testing
    satisfies: gdal-dev-2.1.0-r1[gdal] gdal-dev-2.1.0-r1[gdal=2.1.0-r1]
  gdal-dev-2.1.0-r1:
    masked in: @edge-testing
  .build-deps-0:
    masked in: cache
    satisfies: world[.build-deps]

Without virtual packages

# apk --no-cache add gdal-dev@edge-testing
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.4/community/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/edge/testing/x86_64/APKINDEX.tar.gz
(1/9) Installing libgcc (5.3.0-r0)
(2/9) Installing giflib (5.1.4-r1)
(3/9) Installing libjpeg-turbo (1.4.2-r0)
(4/9) Installing libstdc++ (5.3.0-r0)
(5/9) Installing tiff (4.0.6-r3)
(6/9) Installing gdal@edge-testing (2.1.0-r1)
(7/9) Installing pkgconf (0.9.12-r0)
(8/9) Installing pkgconfig (0.25-r1)
(9/9) Installing gdal-dev@edge-testing (2.1.0-r1)
Executing busybox-1.24.2-r9.trigger
OK: 72 MiB in 41 packages
msnelling commented 7 years ago

I'm seeing the same thing.

andyshinn commented 7 years ago

@ncopa is this an upstream bug?

kaniini commented 7 years ago

In general using the edge/testing repo should require using edge/main. edge/testing is similar to Debian's "experimental" repo, which implies that you're running "unstable"... same idea basically.

With that said, it might be a problem in the dependency resolver. It is most certainly an apk-tools bug at any rate, as using --virtual shouldn't cause such a radical change in dependency resolution.

udondan commented 7 years ago

Still the same with Alpine 3.6

apk add --no-cache --virtual foo gosu@testing=1.9-r0
ERROR: unsatisfiable constraints:
  gosu-1.9-r0:
    masked in: @testing
  foo-0:
    masked in: cache
    satisfies: world[foo]

No problem w/o --virtual foo

kaniini commented 7 years ago

I will look into it in apk-tools as time permits.

raoofm commented 6 years ago

any update on this?

kaniini commented 6 years ago

The problem is that gosu@testing=1.9-r0 is an invalid dependency (because dependencies aren't allowed to be masked, only "world dependencies").

kaniini commented 6 years ago

In other words, the problem is that apk does not properly explain that a child dependency cannot be tagged.

Improving apk diagnostics is something I am actively working on at this moment.

kaniini commented 6 years ago

I added a diagnostic for this, but pinned child dependencies are explicitly not allowed by the solver for a multitude of reasons.

When you use --virtual what you're doing is creating a package on the fly and then attaching the dependencies to it. If a pinned repo becomes unavailable, or the pinning itself changes later, then the dependency tree will have orphaned nodes and become unsolvable.

This will be in the apk-tools 2.10 release.

kaniini commented 6 years ago

Final thoughts:

seanpianka commented 4 years ago

I've been using --virtual for my build deps, but version pinning an edge package. Then, trying to apk del the virtual was throwing this unsatisfiable constraints error.

@kaniini Your advice to use alpine:edge as my base image solved my issue, thanks!