@@ -4,20 +4,19 @@
44# Example how to work with the `lib.maintainers` attrset.
55# Can be used to check whether all user handles are still valid.
66
7−set -e
8−
9−# nixpkgs='<nixpkgs>'
10−# if [ -n "$1" ]; then
7+set -o errexit -o noclobber -o nounset -o pipefail
8+shopt -s failglob inherit_errexit
119
1210function checkCommits {
13− local user="$1"
14− local tmp=$(mktemp)
11+ local ret status tmp user
12+ user="$1"
13+ tmp=$(mktemp)
1514 curl --silent -w "%{http_code}" \
1615 "https://github.com/NixOS/nixpkgs/commits?author=$user" \
1716 > "$tmp"
1817 # the last line of tmp contains the http status
19− local status=$(tail -n1 "$tmp")
20− local ret=
18+ status=$(tail -n1 "$tmp")
19+ ret=
2120 case $status in
2221 200) if <"$tmp" grep -i "no commits found" > /dev/null; then
2322 ret=1
@@ -31,7 +30,7 @@ function checkCommits {
3130 checkCommits "$user"
3231 ret=$?
3332 ;;
34− *) printf "BAD STATUS: $(tail -n1 $tmp) for %s\n" "$user"; ret=1
33+ *) printf "BAD STATUS: $(tail -n1 "$tmp") for %s\n" "$user"; ret=1
3534 ret=1
3635 ;;
3736 esac
@@ -63,4 +62,5 @@ nix-instantiate -A lib.maintainers --eval --strict --json \
6362 | jq -r '.[]|.github|select(.)' \
6463 | parallel -j5 checkUser
6564
65+# To check some arbitrary users:
6666# parallel -j100 checkUser ::: "eelco" "profpatsch" "Profpatsch" "a"