diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:26:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 15:26:00 +0000 |
commit | 830407e88f9d40d954356c3754f2647f91d5c06a (patch) | |
tree | d6a0ece6feea91f3c656166dbaa884ef8a29740e /scripts/update-authors.sh | |
parent | Initial commit. (diff) | |
download | knot-resolver-830407e88f9d40d954356c3754f2647f91d5c06a.tar.xz knot-resolver-830407e88f9d40d954356c3754f2647f91d5c06a.zip |
Adding upstream version 5.6.0.upstream/5.6.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/update-authors.sh')
-rwxr-xr-x | scripts/update-authors.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/scripts/update-authors.sh b/scripts/update-authors.sh new file mode 100755 index 0000000..fe1d857 --- /dev/null +++ b/scripts/update-authors.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-3.0-or-later +set -o nounset -o xtrace + +function spdx_originator_to_authors { + # $1 = Person/Organization + find -name '*.spdx' | xargs grep --no-filename "^PackageOriginator: $1: " \ + | cut -d : -f 3 | sed -e 's/^ *//' -e 's/(/</' -e 's/)/>/' | sort -u +} + +cd "$(git rev-parse --show-toplevel)" +AUTHORS_FILE=AUTHORS +TEMP_FILE="$(mktemp AUTHORS.XXXXXXXXXX)" + +# drop all names from the current file +sed '/^People who contributed commits to our Git repo are/q' "${AUTHORS_FILE}" > "${TEMP_FILE}" +# append to the new file +git log --format="%aN <%aE>" | sort -u | git check-mailmap --stdin | sort -u >> "${TEMP_FILE}" + +echo '' >> "${TEMP_FILE}" +echo 'Knot Resolver source tree also bundles code and content published by:' >> "${TEMP_FILE}" +spdx_originator_to_authors "Person" >> "${TEMP_FILE}" +spdx_originator_to_authors "Organization" >> "${TEMP_FILE}" + +echo '' >> "${TEMP_FILE}" +echo 'Thanks to everyone who knowingly or unknowingly contributed!' >> "${TEMP_FILE}" + +# check for changes +diff "${AUTHORS_FILE}" "${TEMP_FILE}" +CHANGED=$? + +if [ $CHANGED -ne 0 ]; then + # update + mv "${TEMP_FILE}" "${AUTHORS_FILE}" +fi + +# cleanup +rm -f "${TEMP_FILE}" + +# signal change with exit code +exit $CHANGED |