CI: extra_package is brittle when combined with patches
The extra_package function in ci/config.sh is used to ensure that certain packages are always built on each CI run, regardless of whether or not they happen to have a corresponding patch at the time. See here for the list of extra_packages at the time of writing.
extra_package takes an input either a Hackage package name with a version number, or a package name without a version number. If given the latter, extra_package will download the latest Hackage version and build that. The latter, while convenient, is the source of CI fragility. Here is a somewhat common scenario:
- Someone adds
extra_package foo(without a version number), so the CI will try to download the latest Hackage version offooand build it. - There is also a
head.hackagepatch forfoo-1.2.3. At the time of the patch's creation,foo-1.2.3is the latest Hackage version, soextra_package foowill also download version1.2.3. Everything seems fine at the time. - Later, someone uploads
foo-1.2.4.extra_package foowill try to download and build version1.2.4, since it is the most recent. However, thehead.hackagepatch still pins the CI on version1.2.3. As a result, CI will reject the build plan since it is not compatible with version1.2.3.
This scenario has happened multiple times in the past, most recently with an Agda-2.6.2.1 patch preventing a build plan with the more recent Agda-2.6.2.2 that was downloaded by extra_package Agda. See here for an example of this breaking CI. The workaround is to explicitly pin the version number by writing extra_package Agda 2.6.2.1. This is very unfortunate, however, since it requires patch writers to remember to keep the extra_package version numbers in sync with the patched version numbers. I instead propose that if:
- A use of
extra_package foodoesn't specify a version number, and - There are patches for
fooinhead.hackage
Then extra_package should download the version corresponding to the most recent head.hackage patch. This would go a long way to reducing the brittleness of extra_package.