conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
945 stars 1.71k forks source link

[conan.io/center] Versions may not be displayed in the "correct" order #9418

Open SpaceIm opened 2 years ago

SpaceIm commented 2 years ago

Sometimes, recipes mix different versioning, either because library author has change versioning or because we have both cci.yyyymmdd and regular versions. As a result, looking at versions in https://conan.io/center, it's not obvious for users what is the last version.

For example spirv-headers.

In https://conan.io/center (https://conan.io/center/spirv-headers), it claims that cci.20211010 is the last version (yes as soon as you have a cci.yyyymmdd, it's over it will always be the latest version for conan.io), and order is:

1.2.198.0
1.3.204.0
1.5.1
1.5.3
1.5.4
cci.20210414
cci.20210616
cci.20210811
cci.20211010

It's completely wrong, 1.3.204.0 is the last version, and order should be:

1.5.1
1.5.3
1.5.4
cci.20210414
cci.20210616
cci.20210811
cci.20211010
1.2.198.0
1.3.204.0

Because there is nothing obvious in this order, I suggest to enforce a specific order in config.yml so that https://conan.io/center can rely on it.

igormironchik commented 2 years ago

I totally agree with this issue. Maintainer of the recipe should have possibility to set version order. +1 from me.

db4 commented 2 years ago

@SpaceIm if implemented this only affects display order at Conan center website, right? Conan client cannot benefit from it?

SSE4 commented 2 years ago

I personally believe it's something to be implemented in the client, as a first-class feature. a recipe should be able to provide its own comparator for the versions, as it knows the correct order. if order differs from default (semver), conan will not be able to deduce that, and there should be the way to specify it from the outside. that way, not only conan.io/center website will benefit, but it may allow using version ranges with arbitrary libraries, as well as other cool features on top of version comparison (get the last version, bisect, and so on).

jgsogo commented 2 years ago

...and it can get really complex with libraries using two sets of versions https://github.com/conan-io/conan-center-index/pull/9544

Of course, nothing generic would work, and someone/somewhere needs to take care of it in a way that people can contribute other weird versioning schemas that will pop up from time to time. I see different proposals:

I would say that first we need to open this issue on the Conan client repository and get some feedback from that side. Then, we can think about something cci-specific if needed.

jgsogo commented 2 years ago

I don't want to forget about something that @SSE4 has suggested just some minutes ago: versioning_schema.

To provide an attribute in the recipes (maybe config.yml if it is specific to CCI) that declares the versioning schema used by the library (semver, cci.date,...)

Then, the logic in that library could implement something like:

// Check first if there is anything custom for that name
if (name == "xxxx") {
   return custom::compareXXX;
} else if (name == "yyyy") {
   return custom::compareYYY;
}

// Now use the versioning scheme
if (versioning_schema == "semver") {
   return semverCompare;
} else if (versioning_schema == "cci.date") {
   return cciDateCompare;
} else if (....) {
   ...
} else {
   return lexicographic;
}
jgsogo commented 2 years ago

I would like to collect here patterns we can see in libraries that are contributed to ConanCenter:

SSE4 commented 2 years ago

packages.txt