Merge pull request #6411 from commercialhaskell/commenter-setup-help

commenter: ./commenter help script, no need to install the binary
This commit is contained in:
Adam Bergmark 2022-01-23 13:53:56 +01:00 committed by GitHub
commit 2ec6a53ebb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 17 deletions

View File

@ -422,20 +422,16 @@ errors for builds, tests and benchmarks.
### Large scale enabling/disabling of packages ### Large scale enabling/disabling of packages
`etc/commenter` is a binary that mostly automates the translation of `etc/commenter` is a binary that automates `build-constraints.yaml` workflows.
`./check` errors into lines that go into `build-constraints.yaml`. It
can only handle bounds issues, compilation issues still need to be
handled manually.
It disables all offending packages/test suites/benchmarks, so it is
only meant to be used when we close bounds issues and want to disable
packages, and when upgrading GHC.
#### Setup #### Setup
This is currently a rust program, You can install the rust toolchain This is currently a rust program, You can install the rust toolchain
by using [rustup](https://rustup.rs/). by using [rustup](https://rustup.rs/).
Then `cargo install --locked --path etc/commenter` For some commands you also need etc/commenter/latest-version installed.
```
stack install --stack-yaml etc/commenter/latest-version/stack.yaml
```
#### Example usage #### Example usage
@ -456,7 +452,7 @@ testing-feat (GHC 9 bounds issues, Grandfathered dependencies) (not present) dep
Now run: Now run:
``` ```
./check 2>&1 >/dev/null | commenter add ./check 2>&1 >/dev/null | ./commenter add
``` ```
You will get this output: You will get this output:
@ -483,8 +479,8 @@ Re-run this command until no more packages are disabled.
We 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. We 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.
``` ```
commenter clear ./commenter clear
./check 2>&1 >/dev/null | commenter add ./check 2>&1 >/dev/null | ./commenter add
``` ```
Repeat the second command until no updates are made to build-constraints.yaml. Repeat 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.
Run `stack update` before doing this. Run `stack update` before doing this.
`commenter outdated` looks through all bounds issues and library `./commenter outdated` looks through all bounds issues and library
compilation failures and compares the marked version with the latest hackage release. Example output is compilation failures and compares the marked version with the latest hackage release. Example output is
``` ```
@ -504,7 +500,7 @@ aeson mismatch, auto: 1.5.6.0, hackage: 2.0.2.0
where "manual" means the bound was added manually by a curator, where "manual" means the bound was added manually by a curator,
perhaps due to a compilation failure so we could try re-enabling the perhaps due to a compilation failure so we could try re-enabling the
package. "auto" means it's part of the sections generated by package. "auto" means it's part of the sections generated by
`commenter`, to update that run the `Re-enabling` step as documented `./commenter`, to update that run the `Re-enabling` step as documented
above. above.
`outdated` only finds packages that are in the auto generated `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
in a snapshot you can run: in a snapshot you can run:
``` ```
commenter diff-snapshot <old-snapshot.yaml> <new-snapshot.yaml> ./commenter diff-snapshot <old-snapshot.yaml> <new-snapshot.yaml>
``` ```
Existing 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: Existing 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
#### Finding disabled packages with lots of dependents #### Finding disabled packages with lots of dependents
`commenter disabled` prints the number of transitive dependents a disabled package has. Low hanging fruit to get a lot of packages included again. `./commenter disabled` prints the number of transitive dependents a disabled package has. Low hanging fruit to get a lot of packages included again.
Example output: Example output:
``` ```

20
commenter Executable file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
if ! command -v cargo
then
echo "Rust doesn't seem to be installed. https://rustup.rs/"
exit 1
fi
if [ "$1" = "outdated" ];
then
if ! command -v latest-version &> /dev/null
then
echo "This command requires latest-version in your PATH"
echo "Install it with: "
echo "stack install --stack-yaml etc/commenter/latest-version/stack.yaml"
exit 1
fi
fi
cargo run -q --release --manifest-path etc/commenter/Cargo.toml $@

View File

@ -164,7 +164,7 @@ fn latest_version(packages: impl Iterator<Item = Package>) -> BTreeMap<Package,
Command::new("latest-version") Command::new("latest-version")
.args(packages.map(|p| p.0)) .args(packages.map(|p| p.0))
.output() .output()
.unwrap() .expect("Could not find latest-version in PATH")
.stdout, .stdout,
) )
.unwrap() .unwrap()