From ac4dcb64a8f6c07dfe50e9005dc4246f21ebf84e Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 6 Sep 2014 00:39:14 -0400 Subject: Split hackers.yml into users/#{uid}.yml --- bin/meta-check | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 bin/meta-check (limited to 'bin/meta-check') diff --git a/bin/meta-check b/bin/meta-check new file mode 100755 index 0000000..3eeb4c1 --- /dev/null +++ b/bin/meta-check @@ -0,0 +1,38 @@ +#!/bin/bash +# TODO: update to the split YAML files + +###################################################################### + +. libremessages + +file=$cfg_hackers +ret=0 + +norm=$(mktemp --tmpdir) +trap "rm -f -- $(printf '%q' "$norm")" EXIT +"$(dirname "$0")/meta-normalize-stdio" < "$file" > "$norm" || exit 1 + +usernames=($(<"$norm" sed -n 's/^[ -] username: //p' | sort)) + +dups=($(printf '%s\n' "${usernames[@]}" | uniq -d)) +if (( ${#dups[@]} )); then + error 'Duplicate usernames:' + plain '%s' "${dups[@]}" + ret=1 +fi + +illegal=($(printf '%s\n' "${usernames[@]}" | grep -v '^[a-z][a-z0-9]*$')) +if (( ${#illegal[@]} )); then + error 'Illegal usernames:' + plain '%s' "${illegal[@]}" + ret=1 +fi + +if "$(dirname "$0")/list-pgp-keyids" | grep -Ev '^(trusted|secondary|revoked)/[a-z][a-z0-9]* [0-9A-F]{40}$'; then + error 'Bad pgp keys ^^^' + ret=1 +fi + +colordiff -u "$file" "$norm" || ret=$? + +exit $ret -- cgit v1.2.2 From a129362daeaafb0288e4d75f816973a46a7c9d16 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 19 Dec 2014 23:18:02 -0500 Subject: bin/meta-check: update --- bin/meta-check | 71 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 37 insertions(+), 34 deletions(-) (limited to 'bin/meta-check') diff --git a/bin/meta-check b/bin/meta-check index 3eeb4c1..eb4f8c7 100755 --- a/bin/meta-check +++ b/bin/meta-check @@ -1,38 +1,41 @@ #!/bin/bash -# TODO: update to the split YAML files - -###################################################################### . libremessages -file=$cfg_hackers -ret=0 - -norm=$(mktemp --tmpdir) -trap "rm -f -- $(printf '%q' "$norm")" EXIT -"$(dirname "$0")/meta-normalize-stdio" < "$file" > "$norm" || exit 1 - -usernames=($(<"$norm" sed -n 's/^[ -] username: //p' | sort)) - -dups=($(printf '%s\n' "${usernames[@]}" | uniq -d)) -if (( ${#dups[@]} )); then - error 'Duplicate usernames:' - plain '%s' "${dups[@]}" - ret=1 -fi - -illegal=($(printf '%s\n' "${usernames[@]}" | grep -v '^[a-z][a-z0-9]*$')) -if (( ${#illegal[@]} )); then - error 'Illegal usernames:' - plain '%s' "${illegal[@]}" - ret=1 -fi - -if "$(dirname "$0")/list-pgp-keyids" | grep -Ev '^(trusted|secondary|revoked)/[a-z][a-z0-9]* [0-9A-F]{40}$'; then - error 'Bad pgp keys ^^^' - ret=1 -fi - -colordiff -u "$file" "$norm" || ret=$? - -exit $ret +PATH="$(dirname "$0"):$PATH" + +check-yaml() { + file=$1 + msg 'Inspecting %q' "$file" + norm=$(mktemp --tmpdir) + trap "rm -f -- $(printf '%q' "$norm")" RETURN + meta-normalize-stdio < "$file" > "$norm" || return $? + colordiff -u "$file" "$norm" || return $? +} + +main() { + declare -i ret=0 + + # Check the user YAML files + for file in users/*.yml; do + check-yaml "$file" || ret=$? + done + + # Make sure there are no duplicate usernames + dups=($(sed -n 's/^username: //p' -- users/*.yml| sort | uniq -d)) + if (( ${#dups[@]} )); then + error 'Duplicate usernames:' + plain '%s' "${dups[@]}" + ret=1 + fi + + # Check to make sure the pgp keys are OK + if pgp-list-keyids | grep -Ev '^(trusted|secondary|revoked)/[a-z][a-z0-9]* [0-9A-F]{40}$'; then + error 'Bad pgp keys ^^^' + ret=1 + fi + + return $ret +} + +main "$@" -- cgit v1.2.2 From 324e5028926dcac8a2fe794955cc092332e3828c Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Fri, 19 Dec 2014 23:38:00 -0500 Subject: add more output about what meta-check is doing --- bin/meta-check | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bin/meta-check') diff --git a/bin/meta-check b/bin/meta-check index eb4f8c7..6a611a9 100755 --- a/bin/meta-check +++ b/bin/meta-check @@ -21,7 +21,7 @@ main() { check-yaml "$file" || ret=$? done - # Make sure there are no duplicate usernames + msg 'Checking for duplicate usernames' dups=($(sed -n 's/^username: //p' -- users/*.yml| sort | uniq -d)) if (( ${#dups[@]} )); then error 'Duplicate usernames:' @@ -29,7 +29,7 @@ main() { ret=1 fi - # Check to make sure the pgp keys are OK + msg 'Checking PGP keys' if pgp-list-keyids | grep -Ev '^(trusted|secondary|revoked)/[a-z][a-z0-9]* [0-9A-F]{40}$'; then error 'Bad pgp keys ^^^' ret=1 -- cgit v1.2.2 From dfad631beec07d6a630611fa0597439c8de2e71b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?coadde=20=5BM=C3=A1rcio=20Alexandre=20Silva=20Delgado=5D?= Date: Thu, 25 Jun 2015 15:39:31 -0300 Subject: fixing meta-check for add "-" username digit support --- bin/meta-check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bin/meta-check') diff --git a/bin/meta-check b/bin/meta-check index 6a611a9..16994ce 100755 --- a/bin/meta-check +++ b/bin/meta-check @@ -30,7 +30,7 @@ main() { fi msg 'Checking PGP keys' - if pgp-list-keyids | grep -Ev '^(trusted|secondary|revoked)/[a-z][a-z0-9]* [0-9A-F]{40}$'; then + if pgp-list-keyids | grep -Ev '^(trusted|secondary|revoked)/[a-z][a-z0-9-]* [0-9A-F]{40}$'; then error 'Bad pgp keys ^^^' ret=1 fi -- cgit v1.2.2 From 61fc766d07e5252b9618c6548ea714649ab54a54 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 15 Jun 2016 13:03:50 -0400 Subject: Pull tool configuration into a hackers-git.yml --- bin/meta-check | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'bin/meta-check') diff --git a/bin/meta-check b/bin/meta-check index 16994ce..4a2981e 100755 --- a/bin/meta-check +++ b/bin/meta-check @@ -2,7 +2,8 @@ . libremessages -PATH="$(dirname "$0"):$PATH" +mydir="$(dirname "$0")" +PATH="$mydir:$PATH" check-yaml() { file=$1 @@ -16,13 +17,15 @@ check-yaml() { main() { declare -i ret=0 + yamldir="$(ruby -e "load '$mydir/common.rb'; print cfg['yamldir']")" + # Check the user YAML files - for file in users/*.yml; do + for file in "$yamldir"/*.yml; do check-yaml "$file" || ret=$? done msg 'Checking for duplicate usernames' - dups=($(sed -n 's/^username: //p' -- users/*.yml| sort | uniq -d)) + dups=($(sed -n 's/^username: //p' -- "$yamldir"/*.yml| sort | uniq -d)) if (( ${#dups[@]} )); then error 'Duplicate usernames:' plain '%s' "${dups[@]}" -- cgit v1.2.2