Skip to content

Commit

Permalink
scripts: keyring validate: print some more information
Browse files Browse the repository at this point in the history
Add a little bit more diagnostic information to "make validate-keyring".

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
  • Loading branch information
cyphar committed Apr 25, 2023
1 parent 6a806d4 commit b0fae8c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions script/keyring_validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ trap 'rm -r "$tmp_gpgdir"' EXIT

# Get the set of MAINTAINERS.
readarray -t maintainers < <(sed -E 's|.* <.*> \(@?(.*)\)$|\1|' <"$root/MAINTAINERS")
echo "------------------------------------------------------------"
echo "$project maintainers:"
printf " %s\n" "${maintainers[@]}"
printf " * %s\n" "${maintainers[@]}"
echo "------------------------------------------------------------"

# Create a dummy gpg keyring from the set of MAINTAINERS.
while IFS="" read -r username || [ -n "$username" ]; do
Expand All @@ -59,6 +61,14 @@ awk <"$root/$project.keyring" '
}
'

echo "------------------------------------------------------------"
echo "$project release managers:"
sed -En "s|^Comment:.* github=(\w+).*| * \1|p" <"$root/$project.keyring" | sort -u
echo "------------------------------------------------------------"
gpg --no-default-keyring --keyring="$tmp_gpgdir/keyring" \
--import --import-options=show-only <"$root/$project.keyring"
echo "------------------------------------------------------------"

# Check that each entry in the kering is actually a maintainer's key.
while IFS="" read -d $'\0' -r block || [ -n "$block" ]; do
username="$(sed -En "s|^Comment:.* github=(\w+).*|\1|p" <<<"$block")"
Expand Down Expand Up @@ -91,7 +101,7 @@ while IFS="" read -d $'\0' -r block || [ -n "$block" ]; do
done < <(gpg --no-default-keyring \
--import --import-options=show-only --with-colons <<<"$block" |
grep "^$fprfield:" | cut -d: -f10)
done < <(awk <"$project.keyring" '
done < <(awk <"$root/$project.keyring" '
/^-----BEGIN PGP PUBLIC KEY BLOCK-----$/ { in_block=1 }
in_block { print }
/^-----END PGP PUBLIC KEY BLOCK-----$/ { in_block=0; printf("\0"); }
Expand Down

0 comments on commit b0fae8c

Please sign in to comment.