on master help sign in
Merge pull request #6411 from commercialhaskell/commenter-setup-help

commenter: ./commenter help script, no need to install the binary

commit2ec6a53ebbc49ccaeab0e6c421e43cacb647d733 authorAdam Bergmark <adam@bergmark.nl> dateSun 23 Jan 2022, 13:53 (5 years ago) parentf3bebb7f3fa1b4
3 files changed+33−17
CURATORS.md+12−16 commenter+20 etc/commenter/src/lib.rs+1−1
CURATORS.md+12−16
@@ -422,20 +422,16 @@ errors for builds, tests and benchmarks.
422422
423423### Large scale enabling/disabling of packages
424424
425−`etc/commenter` is a binary that mostly automates the translation of
426−`./check` errors into lines that go into `build-constraints.yaml`. It
427−can only handle bounds issues, compilation issues still need to be
428−handled manually.
429−
430−It disables all offending packages/test suites/benchmarks, so it is
431−only meant to be used when we close bounds issues and want to disable
432−packages, and when upgrading GHC.
425+`etc/commenter` is a binary that automates `build-constraints.yaml` workflows.
433426
434427#### Setup
435428This is currently a rust program, You can install the rust toolchain
436429by using [rustup](https://rustup.rs/).
437430
438−Then `cargo install --locked --path etc/commenter`
431+For some commands you also need etc/commenter/latest-version installed.
432+```
433+stack install --stack-yaml etc/commenter/latest-version/stack.yaml
434+```
439435
440436#### Example usage
441437
@@ -456,7 +452,7 @@ testing-feat (GHC 9 bounds issues, Grandfathered dependencies) (not present) dep
456452
457453Now run:
458454```
459−./check 2>&1 >/dev/null | commenter add
455+./check 2>&1 >/dev/null | ./commenter add
460456```
461457
462458You will get this output:
@@ -483,8 +479,8 @@ Re-run this command until no more packages are disabled.
483479We can periodically remove all packages under the bounds sections and then re-run the disabling flow above until we get a clean plan. This will automatically pick up packages that have been fixed.
484480
485481```
486−commenter clear
487−./check 2>&1 >/dev/null | commenter add
482+./commenter clear
483+./check 2>&1 >/dev/null | ./commenter add
488484```
489485
490486Repeat the second command until no updates are made to build-constraints.yaml.
@@ -493,7 +489,7 @@ Repeat the second command until no updates are made to build-constraints.yaml.
493489
494490Run `stack update` before doing this.
495491
496−`commenter outdated` looks through all bounds issues and library
492+`./commenter outdated` looks through all bounds issues and library
497493compilation failures and compares the marked version with the latest hackage release. Example output is
498494
499495```
@@ -504,7 +500,7 @@ aeson mismatch, auto: 1.5.6.0, hackage: 2.0.2.0
504500where "manual" means the bound was added manually by a curator,
505501perhaps due to a compilation failure so we could try re-enabling the
506502package. "auto" means it's part of the sections generated by
507−`commenter`, to update that run the `Re-enabling` step as documented
503+`./commenter`, to update that run the `Re-enabling` step as documented
508504above.
509505
510506`outdated` only finds packages that are in the auto generated
@@ -520,7 +516,7 @@ To diff existing snapshots, or to evaluate changes before they end up
520516in a snapshot you can run:
521517
522518```
523−commenter diff-snapshot <old-snapshot.yaml> <new-snapshot.yaml>
519+./commenter diff-snapshot <old-snapshot.yaml> <new-snapshot.yaml>
524520```
525521
526522Existing snapshots can be retrieved from https://github.com/commercialhaskell/stackage-snapshots. Preliminary snapshots can be generated by running relevant parts of `automated/build.sh`, at the time of writing:
@@ -535,7 +531,7 @@ TARGET=nightly-2021-01-14 \ # the date doesn't matter
535531
536532#### Finding disabled packages with lots of dependents
537533
538−`commenter disabled` prints the number of transitive dependents a disabled package has. Low hanging fruit to get a lot of packages included again.
534+`./commenter disabled` prints the number of transitive dependents a disabled package has. Low hanging fruit to get a lot of packages included again.
539535
540536Example output:
541537```
commenternew file+20
@@ -0,0 +1,20 @@
1+#!/usr/bin/env bash
2+
3+if ! command -v cargo
4+then
5+ echo "Rust doesn't seem to be installed. https://rustup.rs/"
6+ exit 1
7+fi
8+
9+if [ "$1" = "outdated" ];
10+then
11+ if ! command -v latest-version &> /dev/null
12+ then
13+ echo "This command requires latest-version in your PATH"
14+ echo "Install it with: "
15+ echo "stack install --stack-yaml etc/commenter/latest-version/stack.yaml"
16+ exit 1
17+ fi
18+fi
19+
20+cargo run -q --release --manifest-path etc/commenter/Cargo.toml $@
etc/commenter/src/lib.rs+1−1
@@ -164,7 +164,7 @@ fn latest_version(packages: impl Iterator<Item = Package>) -> BTreeMap<Package,
164164 Command::new("latest-version")
165165 .args(packages.map(|p| p.0))
166166 .output()
167− .unwrap()
167+ .expect("Could not find latest-version in PATH")
168168 .stdout,
169169 )
170170 .unwrap()