stefan-hoeck / idris2-pack

BSD 3-Clause "New" or "Revised" License
90 stars 23 forks source link

[ feature request ] Support constraints in `collection` setting in `pack.toml` #293

Open buzden opened 2 weeks ago

buzden commented 2 weeks ago

Local pack.tomls are very useful in setting desired requirements, especially when something non-standard needs to be reproducible, say when we ship a repository to, say, a customer.

But sometimes we need to limit possible pack collections without saying a particular one -- say, we know that out code works on collection, say, nightly-240621 because some library was added or some feature was implemented, and we hope that further collections are okay for that too, then we would like to set a constraint to the used collection in the local pack.toml. Or, if we know that some feature is broken or, say, removed in collection nightly-240625, we may want to say that we need a collection strictly earlier than that.

So, it's good if we can not only set particular collection, but set some constraints on them. In this case, pack switch latest would choose the latest available collection with respect to constraints in all local pack.tomls (if they are present).

pack build now respects collection from the local pack.toml, in the case of constraints it may choose the latest possible one conforming the constraints.

Now we have only nightly- constraints, so we can compare them easily, but in the future we may potentially have several types of collections and several types of their numbering. I would suggest the following vision: collection names are interpreted as <basename>-<number>(.<number>)* (where * means "zero or more times") and collections with different basenames are incomparable, then numbers are compared from left to right. Lack of number may be interpreted as zero, or strictly less than any number.