You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of pinning the snapshot to a specific date, we set it to
'nightly', which should allow more flexibility i.e. users can build
whichever ghc corresponds to the latest snapshot. This should
hopefully decrease the chance of users running into issues with
ghc minor version upgrades e.g. bounds errors.
Snapshot updates that upgrade the ghc major version will almost
certainly require manual intervention here, but failures will likely
be caught by the CI job that builds everything with --dry-run, so
there should be some warning.
Copy file name to clipboardExpand all lines: README.md
+42-1Lines changed: 42 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ An impact assessment is due when
14
14
15
15
The procedure is as follows:
16
16
17
-
1. Rebase changes, mandated by your proposal, atop of `ghc-9.10` branch.
17
+
1. Rebase changes, mandated by your proposal, atop the ghc branch (or tag) that corresponds to the current [stackage nightly](https://www.stackage.org/nightly). For example, if the latest snapshot ghc is `ghc-9.12.3`, we would want to rebase our changes on the `ghc-9.12.3-release` tag. See [GHC / Stack snapshot compatibility](#ghc--stack-snapshot-compatibility) for more info on choosing a good ghc.
18
18
19
19
2. Compile a patched GHC, say, `~/ghc/_build/stage1/bin/ghc`.
20
20
@@ -36,6 +36,7 @@ The procedure is as follows:
36
36
* You can interrupt `cabal` at any time and rerun again later.
37
37
* Consider setting `--jobs` to retain free CPU cores for other tasks.
38
38
* Full build requires roughly 7 Gb of free disk space.
39
+
* If the build fails with an error about max amount of arguments in `gcc`, run again, but with smaller batch size. 250 worked well for me.
39
40
40
41
To get an idea of the current progress, we can run the following commands
41
42
on the log file:
@@ -59,6 +60,46 @@ The procedure is as follows:
59
60
60
61
8. When everything finally builds, get back to CLC with a list of packages affected and patches required.
61
62
63
+
### GHC / Stack snapshot compatibility
64
+
65
+
#### GHC Minor update
66
+
67
+
As nightly changes ghc minor versions (e.g. `9.12.1 -> 9.12.3`), package bounds can change. This can be a problem because `clc-stackage` writes the snapshot's packages' version bounds as exact constraints to the generated `./generated/cabal.project.local`, to ensure we (transitively) build the same package version every time. While we attempt to mitigate such issues (boot packages' exact versions are ignored), it is possible for some to slip through.
68
+
69
+
User mitigations can include:
70
+
71
+
- Adding the package to [./excluded_pkgs.jsonc](excluded_pkgs.jsonc). The package will still be built as long as it is a (transitive) dependency of some other package in the snapshot, but will not have its exact bounds written to `cabal.project.local`.
72
+
73
+
- Manually downloading a snapshot (e.g. `https://www.stackage.org/nightly/cabal.config`), changing / removing the offending package(s), and supplying the file with the `--snapshot-path` param. Like `excluded_pkgs.jsonc`, this only impacts what is actually written to `cabal.project.local`.
74
+
75
+
- Adding constraints to `generated/cabal.project`. Even though we write most package versions as constraints, there is still some room for non-determinancy (hence, errors).
76
+
77
+
Boot packages are not written as exact versions, but it might be useful to write _some_ constraint e.g. `constraints: filepath > 1.5`.
78
+
79
+
We also might need to set some flags e.g. prevent cabal from setting the wrong automatic flag. For instance, depending on the resolver, cabal might try to build `bson` with the `_old-network` flag, which will not work with this package set, hence we disable it with `constraints: bson -_old-network`.
80
+
81
+
#### GHC Major update
82
+
83
+
When a snapshot upgrades the GHC *major* version, there is usually more work involved. In particular,
84
+
85
+
- New system dependencies will need to be added to the `flake.nix`.
86
+
87
+
- New packages will need to be added to `excluded_pkgs.jsonc` because e.g. the system deps are unreasonable or the packages are executables.
88
+
89
+
Until this is done, `clc-stackage` will likely fail. Such failures should hopefully be caught by CI that is run daily, but either way, please open an issue if `clc-stackage` seems out of date with stackage nightly.
90
+
91
+
While that is being resolved, the mitigations from the [previous section](#ghc-minor-update) may be useful.
92
+
93
+
#### Misc
94
+
95
+
The `flake.nix` line:
96
+
97
+
```nix
98
+
compiler = pkgs.haskell.packages.ghc<vers>;
99
+
```
100
+
101
+
can be a useful guide as to which GHC was last tested, as CI uses this ghc to build everything with `--dry-run`, which should report solver errors (e.g. bounds) at the very least.
Copy file name to clipboardExpand all lines: dev.md
+10-14Lines changed: 10 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -75,28 +75,24 @@ The executable that actually runs. This is a very thin wrapper over `runner`, wh
75
75
76
76
## Updating to a new shapshot
77
77
78
-
1.Updateto the desired snapshot:
78
+
`clc-stackage` is based on `nightly`-- which changes automatically -- meaning we do not necessarily have to do anything when a new (minor) snapshot is released. On the other hand, *major* snapshot updates will almost certainly bring in new packages that need to be excluded, so there are some general "update steps" we will want to take:
79
79
80
-
```haskell
81
-
-- CLC.Stackage.Parser.API
82
-
stackageSnapshot::String
83
-
stackageSnapshot ="nightly-yyyy-mm-dd"
84
-
```
80
+
1.Modify [excluded_pkgs.json](excluded_pkgs.json) as needed.That is, updating the snapshot major verison will probably bring in some new packages that we donot want.The update process is essentially trial-and-error i.e. run `clc-stackage` as normal, and later add any failing packages that should be excluded.
85
81
86
-
2.Updatethe `index-state` in [cabal.project](cabal.project) and [generated/cabal.project](generated/cabal.project).
82
+
2.Update`ghc-version` in [.github/workflows/ci.yaml](.github/workflows/ci.yaml).
87
83
88
-
3.Modify [excluded_pkgs.json](excluded_pkgs.json) as needed.That is, updating the snapshot will probably bring in some new packages that we donot want.The update process is essentially trial-and-errori.e.run `clc-stackage` as normal, andlater add any failing packages that should be excluded.
84
+
3.Update functional tests as neededi.e.exact package versions in `*golden` and`test/functional/snapshot.txt`.
89
85
90
-
4.Updatereferences to the current ghc e.g.
86
+
4.Optional:Updatenix:
91
87
92
-
1. `ghc-version` in [.github/workflows/ci.yaml](.github/workflows/ci.yaml).
93
-
2. [README.md](README.md).
88
+
-Inputs (`nix flake update`).
89
+
-GHC:Update the `compiler = pkgs.haskell.packages.ghc<vers>;` line.
90
+
-Add to the `flake.nix`'s `ldDeps`and`deps` as needed to have the `nix`CI job pass.System libs available on nix can be found here: https://search.nixos.org/packages?channel=unstable.
94
91
95
-
5.Update functional tests as needed i.e. exact package versions in `*golden` and `test/functional/snapshot.txt`.
This job builds everything with `--dry-run`, so its success is a useful proxy for `clc-stackage`'s health. In other words, if the nix job fails, there is almost certainly a general issue (i.e. either a package should be excluded or new system dep is required), but if it succeeds, the package set is in pretty good shape (there may still be sporadic issues e.g. a package does not properly declare its system dependencies at config time).
0 commit comments