From eda98e18886158c4a65813dc4958ac909cf8cb84 Mon Sep 17 00:00:00 2001 From: crueter Date: Fri, 27 Jun 2025 13:37:30 -0400 Subject: [PATCH] Fix license headers and update script Signed-off-by: crueter --- .ci/license-header.sh | 46 +++++++++++++++++++++++-------- src/core/hle/api_version.h | 3 ++ src/core/hle/kernel/svc_version.h | 3 ++ src/yuzu/main.h | 3 ++ 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/.ci/license-header.sh b/.ci/license-header.sh index 2dbb0864d5..64db98132f 100755 --- a/.ci/license-header.sh +++ b/.ci/license-header.sh @@ -4,10 +4,13 @@ HEADER="$(cat "$PWD/.ci/license/header.txt")" echo "Getting branch changes" -BRANCH=`git rev-parse --abbrev-ref HEAD` -COMMITS=`git log ${BRANCH} --not master --pretty=format:"%h"` -RANGE="${COMMITS[${#COMMITS[@]}-1]}^..${COMMITS[0]}" -FILES=`git diff-tree --no-commit-id --name-only ${RANGE} -r` +# I created this cursed POSIX abomination only to discover a better solution +#BRANCH=`git rev-parse --abbrev-ref HEAD` +#COMMITS=`git log ${BRANCH} --not master --pretty=format:"%h"` +#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" @@ -24,28 +27,39 @@ for file in $FILES; do esac done +if [ "$BAD_FILES" = "" ]; then + echo + echo "All good." + + exit +fi + echo "The following files have incorrect license headers:" +echo for file in $BAD_FILES; do echo $file; done cat << EOF + The following license header should be added to the start of all offending files: + === BEGIN === $HEADER === 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. - EOF -if [ "$COMMIT" = "true" ]; then - echo "COMMIT set to true. Fixing headers and committing." +if [ "$FIX" = "true" ]; then + echo + echo "FIX set to true. Fixing headers." + echo + for file in $BAD_FILES; do cat $file > $file.bak - echo $file - cat .ci/license/header.txt > $file echo >> $file cat $file.bak >> $file @@ -55,9 +69,17 @@ if [ "$COMMIT" = "true" ]; then git add $file 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 exit diff --git a/src/core/hle/api_version.h b/src/core/hle/api_version.h index 2f601a3ace..e18397cc04 100644 --- a/src/core/hle/api_version.h +++ b/src/core/hle/api_version.h @@ -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-License-Identifier: GPL-2.0-or-later diff --git a/src/core/hle/kernel/svc_version.h b/src/core/hle/kernel/svc_version.h index 77c1d1b75c..b47874dcde 100644 --- a/src/core/hle/kernel/svc_version.h +++ b/src/core/hle/kernel/svc_version.h @@ -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-License-Identifier: GPL-2.0-or-later diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 93956a0489..84588f641a 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h @@ -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-License-Identifier: GPL-2.0-or-later