Fix license headers and update script

Signed-off-by: crueter <swurl@swurl.xyz>
This commit is contained in:
crueter
2025-06-27 13:37:30 -04:00
parent 844dfd5207
commit eda98e1888
4 changed files with 43 additions and 12 deletions

View File

@@ -4,10 +4,13 @@ HEADER="$(cat "$PWD/.ci/license/header.txt")"
echo "Getting branch changes" echo "Getting branch changes"
BRANCH=`git rev-parse --abbrev-ref HEAD` # I created this cursed POSIX abomination only to discover a better solution
COMMITS=`git log ${BRANCH} --not master --pretty=format:"%h"` #BRANCH=`git rev-parse --abbrev-ref HEAD`
RANGE="${COMMITS[${#COMMITS[@]}-1]}^..${COMMITS[0]}" #COMMITS=`git log ${BRANCH} --not master --pretty=format:"%h"`
FILES=`git diff-tree --no-commit-id --name-only ${RANGE} -r` #RANGE="${COMMITS[${#COMMITS[@]}-1]}^..${COMMITS[0]}"
#FILES=`git diff-tree --no-commit-id --name-only ${RANGE} -r`
FILES=$(git diff --name-only master)
echo "Done" echo "Done"
@@ -24,28 +27,39 @@ for file in $FILES; do
esac esac
done done
if [ "$BAD_FILES" = "" ]; then
echo
echo "All good."
exit
fi
echo "The following files have incorrect license headers:" echo "The following files have incorrect license headers:"
echo
for file in $BAD_FILES; do echo $file; done for file in $BAD_FILES; do echo $file; done
cat << EOF cat << EOF
The following license header should be added to the start of all offending files: The following license header should be added to the start of all offending files:
=== BEGIN === === BEGIN ===
$HEADER $HEADER
=== END === === END ===
If some of the code in this PR is not being contributed by the original author, the files which have been exclusively changed by that code can be ignored. If some of the code in this PR is not being contributed by the original author,
the files which have been exclusively changed by that code can be ignored.
If this happens, this PR requirement can be bypassed once all other files are addressed. If this happens, this PR requirement can be bypassed once all other files are addressed.
EOF EOF
if [ "$COMMIT" = "true" ]; then if [ "$FIX" = "true" ]; then
echo "COMMIT set to true. Fixing headers and committing." echo
echo "FIX set to true. Fixing headers."
echo
for file in $BAD_FILES; do for file in $BAD_FILES; do
cat $file > $file.bak cat $file > $file.bak
echo $file
cat .ci/license/header.txt > $file cat .ci/license/header.txt > $file
echo >> $file echo >> $file
cat $file.bak >> $file cat $file.bak >> $file
@@ -55,9 +69,17 @@ if [ "$COMMIT" = "true" ]; then
git add $file git add $file
done done
git commit -m "Fixed license headers" echo "License headers fixed."
fi
echo "License headers fixed. You may now push." if [ "$COMMIT" = "true" ]; then
echo
echo "COMMIT set to true. Committing changes."
echo
git commit -m "Fix license headers"
echo "Changes committed. You may now push."
fi fi
exit exit

View File

@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later

View File

@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later

View File

@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: 2014 Citra Emulator Project // SPDX-FileCopyrightText: 2014 Citra Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later