Shards: Error when version conflict should say what shards need the conflicting version

Created on 30 Mar 2020  路  7Comments  路  Source: crystal-lang/shards

When installing shards that need conflicting versions I get:
Error resolving db (~> 0.8.0, *, ~> 0.7.0)
Ideally, this should give me the name of the shards requesting each version, as:
Error resolving db (sqlite3: ~> 0.8.0, *, crecto: ~> 0.7.0)

OBS:
Reporting against 0.8.1. Not tested on shards 0.9 because of #338

question

Most helpful comment

Well... the new algorithm resolves to this set of dependencies without any error:

kemal (0.26.1)
kilt (0.4.0)
slang (1.7.1)
sqlite3 (0.15.0)
crecto (0.2.0)
radix (0.3.9)
exception_page (0.1.4)
db (0.8.0)
pg (0.20.0)
pool (0.2.3)
micrate (0.6.1)

And it does it in just 4 seconds (plus time to fetch repositories) and uses a maximum o 7MB of memory 馃槃

All 7 comments

@c-cesar the solver algorithm has changed for the (not yet released) version 0.10: https://github.com/crystal-lang/shards/pull/322

That means the error messages have changed (hopefully improved). Do you want to try again with the version at master branch? Or share your shard.yml (and shard.lock) if possible so I can use it as a test case.

The shards.yml that shows the conflict is on #338. To resolve, the conflict I specified a previous sqlite version, so this would give the message.

dependencies:
  kemal:
    github: kemalcr/kemal
  kilt:
    github: jeromegn/kilt
  slang:
    github: jeromegn/slang
  sqlite3:
    github: crystal-lang/crystal-sqlite3
  crecto:
    github: Crecto/crecto

Well... the new algorithm resolves to this set of dependencies without any error:

kemal (0.26.1)
kilt (0.4.0)
slang (1.7.1)
sqlite3 (0.15.0)
crecto (0.2.0)
radix (0.3.9)
exception_page (0.1.4)
db (0.8.0)
pg (0.20.0)
pool (0.2.3)
micrate (0.6.1)

And it does it in just 4 seconds (plus time to fetch repositories) and uses a maximum o 7MB of memory 馃槃

BTW, this is how it looks when there is a conflict. In this case I tried to fix sqlite3 to 0.8.0 and crecto to 0.7.0.

Resolving dependencies
Unable to satisfy the following requirements:

- `db ~> 0.3.0` required by `sqlite3 0.8.0`
- `db 0.4.2` required by `crecto 0.7.0`
Failed to resolve dependencies

Nice. The new message is very informative and point what to fix. Closed.

And, this will be a little offtopic, but the crecto version resolved is very old. The current version is 0.11.2. Shards 0.8 give me this versions

$ shards list
Shards installed:
  * kemal (0.26.1)
  * radix (0.3.9)
  * kilt (0.4.0) 
  * exception_page (0.1.4)
  * kilt (0.4.0)
  * slang (1.7.1)
  * sqlite3 (0.14.0) # older version manually fixed
  * db (0.7.0) # 0.8 gives older version
  * crecto (0.11.2) # 0.8 gives newer version
  * db (0.7.0)

Interesting. I'll investigate. Thanks!

Well, crecto is lagging behind on the requirement of db. Latest version requires ~> 0.7.0 while sqlite3 0.15.0 uses ~> 0.8.0. Because sqlite3 is earlier in the shards.yml the algoritm ends prioritizing a more recent version of it. If crecto is moved to the top for example, it resolves to the same set of versions you listed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ysbaddaden picture ysbaddaden  路  7Comments

bcardiff picture bcardiff  路  8Comments

vladfaust picture vladfaust  路  7Comments

kostya picture kostya  路  3Comments

InstanceOfMichael picture InstanceOfMichael  路  5Comments