diff options
| author | crueter <crueter@eden-emu.dev> | 2025-10-21 21:00:26 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2025-10-21 21:00:26 +0200 |
| commit | f1debdbac5227d21b124bd79069926b8e627a786 (patch) | |
| tree | e022ed3a63ed00293bc83bd48ea4f53126e4628c /.ci | |
| parent | f08f4cccdcc86ba7b0deb073d9a6c74d2112a101 (diff) | |
[license-header] make it actually work with posix shells (#2797)
grep doesn't support -P in POSIX, so to get around this we just replace
\n with space and match that with a POSIX basic expression
Signed-off-by: crueter <crueter@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2797
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Diffstat (limited to '.ci')
| -rwxr-xr-x | .ci/license-header.sh | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/.ci/license-header.sh b/.ci/license-header.sh index 986b364845..874f29aa45 100755 --- a/.ci/license-header.sh +++ b/.ci/license-header.sh @@ -66,20 +66,18 @@ header_line2() { echo "$1 SPDX-License-Identifier: $LICENSE" } -# PCRE header string -pcre_header() { - begin="$1" - echo "(?s)$(header_line1 "$begin").*$(header_line2 "$begin")" -} - check_header() { begin="$1" file="$2" - content="$(head -n5 < "$2")" - header="$(pcre_header "$begin")" + # separate things out as spaces to make our lives 100000000x easier + content="$(head -n5 < "$2" | tr '\n' ' ')" + + line1="$(header_line1 "$begin")" + line2="$(header_line2 "$begin")" - if ! echo "$content" | grep -Pzo "$header" > /dev/null; then + # perl and awk are actually awful, so to avoid this problem we avoid it by avoiding it + if ! echo "$content" | grep -o "$line1 $line2" >/dev/null; then # SRC_FILES is Kotlin/C++ # OTHER_FILES is sh, CMake case "$begin" in |
