Hi, if I want to add a CMake option to the fairmq.sh alidist recipe depending on the version that is built (e.g. add the option for all FairMQ v1.4+). What is the canonical way of doing this?
Should I just add an if block in the bash section of the recipe and somehow do my version compare against $PKGVERSION? Do we have any helpers for version comparisons? Can I assume python is available (in the bash section)?
I think that checking the version is always the wrong approach. This will break in case we use something other than versions (e.g. hashes).
The best way is grepping the piece of code in the source directory that makes you discriminate between the two distinct behaviors. You would grep for the old code (because it’s old, and will never change): if you find it, you enable the old behavior. If you don’t, you fall back on the new one.
There’s an example in alidist already, but I frankly forgot.
Ordering Git tags is a tough business. Don’t do that. This, incidentally, breaks in case you are using the package in development mode, and in case your local source is unaware of the remote tags.
You can only rely on the source code itself for this (data, not metadata). If there is some specific -DSOMETHING=ON option, I believe you can grep CMakeLists.txt to see if SOMETHING is somehow handled.
This would be a different condition (the option exists since a long time), but I want to switch it on only from releases v1.4.2+. The FairMQ version does not exist anywhere else but as a tag (We have no dist tarballs at the moment, where one would bake the version into the source tree).