crystal-lang / shards

Dependency manager for the Crystal language
Other
763 stars 100 forks source link

Incorrect entries listed as "Unable to satisfy the following requirements" re: crystal version #491

Open Sija opened 3 years ago

Sija commented 3 years ago

When issuing shards install/update command, shards are refusing to cooperate due to unsupported crystal version in some of the dependencies and I'm greeted with a list of shards that are "Unable to satisfy the following requirements":

- `crystal (>= 0.35.0)` required by `raven 1.9.1`
- `crystal (>= 0.36.0)` required by `kemal 1.0.0`
- `crystal (>= 0.35.0)` required by `ameba 0.14.1`

(Notice the satisfied restriction for the shards above.)

But then running the above command with --ignore-crystal-version succeeds and the shards above are no longer (and correctly) logged with the message Shard “___" may be incompatible with Crystal 1.0.0.


For a repro case one can clone https://github.com/Sija/gphoto2-web.cr repo and test above steps.

asterite commented 3 years ago

Isn't this expected? Or what's unexpected?

Sija commented 3 years ago

>= 0.35.0 restriction satisfies version number 1.0.0, so what's unexpected is seeing shards with such restrictions listed there.

asterite commented 3 years ago

>= 0.35.0 does not satisfy 1.0.0

That's according to how it was all planned, to my understanding. See this large discussion: https://github.com/crystal-lang/shards/issues/413

Sija commented 3 years ago

It obviously does. I don't follow to which comment you're referring to.

asterite commented 3 years ago

https://github.com/crystal-lang/shards/issues/413#issuecomment-648393629

Sija commented 3 years ago

@asterite AFAIU it relates to the ~> operator.

straight-shoota commented 3 years ago

>= 0.35.0 does not satisfy 1.0.0

No, it does. 1.0.0 >= 0.35.0 is totally correct.

So if shards with CRYSTAL_VERSION=1.0.0 reports unsatisfied requirement crystal (>= 0.35.0), that's an error.

@Sija I can't reproduce with https://github.com/Sija/gphoto2-web.cr/commit/65a4751f349a30110dee5cc9d92b8763de6a9e66

The output of shards install is:

Unable to satisfy the following requirements:

- `crystal (~> 0.35, >= 0.35.1)` required by `gphoto2 0.9.0`
- `crystal (< 1.0.0)` required by `pool 0.2.3`
- `crystal (>= 0.35.0)` required by `raven 1.9.1`
- `crystal (~> 0.35, >= 0.35.0)` required by `kemal 0.27.0`
- `crystal (>= 0.35.0)` required by `ameba 0.14.1`
- `crystal (~> 0.35, >= 0.35.0)` required by `debug 2.0.0`

This correctly identifies a number of mismatches in Crystal requirements.

Sija commented 3 years ago

This correctly identifies a number of mismatches in Crystal requirements.

@straight-shoota It doesn't, look at the requirements for raven and ameba dependencies - these two shards shouldn't have been on this list at all.

straight-shoota commented 3 years ago

Indeed, you're right.

asterite commented 3 years ago

Maybe it's listing those shards so you can understand the conflict?

straight-shoota commented 3 years ago

Yeah, but >= 0.35.1 should be subsumed by all other restrictions except < 1.0.0. And even that is not a conflict.

Sija commented 3 years ago

This bug results in spreading confusion re: the version selectors, see https://github.com/crystal-community/timecop.cr/pull/7 and https://github.com/amberframework/amber-router/pull/30 as another instances of that.