mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-26 22:52:34 +02:00

This adds a build-time option to automatically generate a list of authors from git history, and includes it in the documentation by reading the output from git in a Sphinx extension. When git isn't available or the project source doesn't appear to be a git checkout, the list is not generated and gracefully replaced with a message explaining its absence. Change-Id: I1e9634a90e84262aafd80590deba9875f4b71a3c Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/86350 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Anastasia Klimchuk <aklm@chromium.org>
40 lines
898 B
Bash
40 lines
898 B
Bash
#!/bin/sh
|
|
|
|
if [ $# -ne 3 ]
|
|
then
|
|
echo "Wrong number of arguments. Usage: $0 [authors|reviewers] outfile git_dir" >&2
|
|
exit 1
|
|
fi
|
|
|
|
case "$1" in
|
|
authors)
|
|
GROUP_ARGS="--group=author --group=trailer:Co-Authored-by --group=trailer:Co-Developed-by"
|
|
;;
|
|
reviewers)
|
|
GROUP_ARGS="--group=trailer:Reviewed-by"
|
|
;;
|
|
*)
|
|
echo "Unknown contributor kind: \"$1\"" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
OUTFILE="$2"
|
|
# GIT_DIR is passed explicitly so we never need to guess where
|
|
# the source directory is. It may be somewhere entirely different
|
|
# from where meson is running us.
|
|
GIT_DIR="$3"
|
|
|
|
if ! command -v git >/dev/null
|
|
then
|
|
echo "git not available" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ ! -d "$GIT_DIR" ]
|
|
then
|
|
echo "GIT_DIR ($GIT_DIR) does not exist" >&2
|
|
exit 1
|
|
fi
|
|
|
|
git --no-pager --git-dir="$GIT_DIR" shortlog --summary --numbered $GROUP_ARGS HEAD > "$OUTFILE"
|