Skip to content

Instantly share code, notes, and snippets.

@ecstatic-morse
Last active January 26, 2020 21:06
Show Gist options
  • Save ecstatic-morse/be799bfa4d3b3d6e163fa61a9c30706f to your computer and use it in GitHub Desktop.
Save ecstatic-morse/be799bfa4d3b3d6e163fa61a9c30706f to your computer and use it in GitHub Desktop.
Extract regressed crates from crater's `results.json`
#!/bin/bash
set -euo pipefail
function find_crates {
file=$1
origin=$2
result=$3
case "$origin" in
github)
domain=https://github.com
;;
cratesio)
domain=https://crates.io
;;
*)
echo >2 "Unknown crate origin"
exit 1
esac
jq -r ".crates[] | select(.res == \"$result\") | select(.url | startswith(\"$domain\")) | .url" "$file"
}
find_crates "$1" github regressed | sed -r 's|^https://github.com/([^/]+)/([^/]+)/.*$|\1/\2|'
find_crates "$1" cratesio regressed | sed -r 's|^https://crates.io/crates/([^/]+)/.*$|\1|'
@ecstatic-morse
Copy link
Author

ecstatic-morse commented Oct 17, 2019

Here's the sample output for this results.json.

You can pass a link to the generated text file to craterbot e.g. @craterbot run mode=check-only crates=http://some.site/crate-list.txt. This will create an experiment that runs only on those crates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment