From da4669c546bad3a47d6a12e2ac4bf6ceb0eac6e5 Mon Sep 17 00:00:00 2001 From: Mike Ovsiannikov Date: Sat, 18 Oct 2025 17:39:00 -0700 Subject: [PATCH] Apache RAT update: * Update to use version 0.17 * Reformat / cleanup RAT script. * Do not use deprecated RAT flags. * Update .ratignore to exclude generated files. * Remove RAT output awk filter, use --output-style unapproved-licenses option instead. --- .ratignore | 12 +++++++++--- scripts/rat.sh | 28 +++++++++------------------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/.ratignore b/.ratignore index 2824b1612..dbc439940 100644 --- a/.ratignore +++ b/.ratignore @@ -4,11 +4,17 @@ README.md CHANGELOG.md tags -Version.cc sorttable.js - # Directories ext wiki build -go.sum + +# Generated/auto-generated files +src/cc/common/Version.cc +src/go/go.sum +src/go/README.md + +# Specific gitignore files +src/cc/common/.gitignore +webui/.gitignore diff --git a/scripts/rat.sh b/scripts/rat.sh index f016bc65a..e2498665f 100755 --- a/scripts/rat.sh +++ b/scripts/rat.sh @@ -23,13 +23,13 @@ if [ $# -ne 1 ]; then exit 1 fi -SRC="`cd "$1" > /dev/null && pwd`" +SRC="$(cd "$1" >/dev/null && pwd)" -MYRAT_VERS=0.16.1 +MYRAT_VERS=0.17 MYURL="https://downloads.apache.org/creadur/apache-rat-${MYRAT_VERS}/apache-rat-${MYRAT_VERS}-bin.tar.gz" MYSHAURL="https://dlcdn.apache.org/creadur/apache-rat-${MYRAT_VERS}/apache-rat-${MYRAT_VERS}-bin.tar.gz.sha512" -MYTAR="`basename "$MYURL"`" -MYNAME="`basename "$MYTAR" -bin.tar.gz`" +MYTAR=$(basename "$MYURL") +MYNAME=$(basename "$MYTAR" -bin.tar.gz) MYJAR="$MYNAME/$MYNAME.jar" if [ -f "$MYJAR" ]; then @@ -37,9 +37,9 @@ if [ -f "$MYJAR" ]; then else rm -f "$MYTAR" if curl --retry 3 -Ss -o "$MYTAR" "$MYURL"; then - MYTARSHA="`curl --retry 3 -Ss "$MYSHAURL" \ - | sed -e 's/^.*://' | tr -d ' \n' | tr ABCDEF abcdef`" - MYACTSHA="`openssl sha512 < "$MYTAR" | sed -e 's/^.*)= *//'`" + MYTARSHA=$(curl --retry 3 -Ss "$MYSHAURL" | + sed -e 's/^.*://' | tr -d ' \n' | tr ABCDEF abcdef) + MYACTSHA=$(openssl sha512 <"$MYTAR" | sed -e 's/^.*)= *//') if [ x"$MYACTSHA" = x"$MYTARSHA" ]; then true else @@ -60,15 +60,5 @@ else fi fi -java -jar "$MYJAR" --dir "$SRC" -E "$SRC/.ratignore" \ -| awk ' - BEGIN { ret = 1; } - /Unknown Licenses/ { - if (0 == $1) { - ret = 0 - } - print; - } - /^==/{ print; } - END { exit ret; } -' +java -jar "$MYJAR" --output-style unapproved-licenses \ + --input-exclude-file "$SRC/.ratignore" -- "$SRC"