From 173d876c416513e351016be97197cc67fc3e6cf8 Mon Sep 17 00:00:00 2001 From: nscuro Date: Fri, 1 Sep 2023 22:35:17 +0200 Subject: [PATCH] Add script to update SPDX license list Signed-off-by: nscuro --- dev/scripts/update-spdx-license-list.sh | 17 +++++++++++++++++ .../persistence/DefaultObjectGeneratorTest.java | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 dev/scripts/update-spdx-license-list.sh diff --git a/dev/scripts/update-spdx-license-list.sh b/dev/scripts/update-spdx-license-list.sh new file mode 100755 index 0000000000..dfe5f1fba6 --- /dev/null +++ b/dev/scripts/update-spdx-license-list.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euxo pipefail + +SCRIPT_DIR="$(cd -P -- "$(dirname "$0")" && pwd -P)" +LICENSE_LIST_DATA_DIR="$(cd -P -- "${SCRIPT_DIR}/../../src/main/resources/license-list-data" && pwd -P)" +TMP_DOWNLOAD_FILE="$(mktemp)" + +gh -R spdx/license-list-data release download "v$1" \ + --archive tar.gz --clobber --output "${TMP_DOWNLOAD_FILE}" + +rm -rf "${LICENSE_LIST_DATA_DIR}/json" + +tar -xvzf "${TMP_DOWNLOAD_FILE}" \ + --strip-components "1" \ + --directory "${LICENSE_LIST_DATA_DIR}" \ + "license-list-data-$1/json" diff --git a/src/test/java/org/dependencytrack/persistence/DefaultObjectGeneratorTest.java b/src/test/java/org/dependencytrack/persistence/DefaultObjectGeneratorTest.java index e72c52cb74..df297513f1 100644 --- a/src/test/java/org/dependencytrack/persistence/DefaultObjectGeneratorTest.java +++ b/src/test/java/org/dependencytrack/persistence/DefaultObjectGeneratorTest.java @@ -44,7 +44,7 @@ public void testLoadDefaultLicenses() throws Exception { Method method = generator.getClass().getDeclaredMethod("loadDefaultLicenses"); method.setAccessible(true); method.invoke(generator); - Assert.assertEquals(489, qm.getAllLicensesConcise().size()); + Assert.assertEquals(627, qm.getAllLicensesConcise().size()); } @Test