From ea46374aa9759d7b906d3b4eae14a837b439b224 Mon Sep 17 00:00:00 2001 From: Kai Pastor Date: Mon, 15 Jul 2024 20:43:55 +0200 Subject: [PATCH] [vcpkg ci,liburing] Improve license identifier check (#39679) Co-authored-by: Billy O'Neal --- .github/workflows/untrustedPR.yml | 46 +++++++++++++++++++++---------- ports/liburing/portfile.cmake | 17 +++++++++--- ports/liburing/usage | 6 ---- ports/liburing/vcpkg.json | 3 +- versions/baseline.json | 2 +- versions/l-/liburing.json | 5 ++++ 6 files changed, 52 insertions(+), 27 deletions(-) delete mode 100644 ports/liburing/usage diff --git a/.github/workflows/untrustedPR.yml b/.github/workflows/untrustedPR.yml index 0fba0c3202..a4d7d04c3e 100644 --- a/.github/workflows/untrustedPR.yml +++ b/.github/workflows/untrustedPR.yml @@ -31,7 +31,15 @@ jobs: if [ -s .github-pr.changed-portfiles ]; then (grep -n -H -E '(vcpkg_install_cmake|vcpkg_build_cmake|vcpkg_configure_cmake|vcpkg_fixup_cmake_targets)' $(cat .github-pr.changed-portfiles) || true) > .github-pr.deprecated-cmake; else touch .github-pr.deprecated-cmake; fi git diff --name-status --merge-base HEAD^ HEAD --diff-filter=MAR -- '*vcpkg.json' | sed 's/[MAR]\t*//' > .github-pr.changed-manifest-files cat .github-pr.changed-manifest-files | while read filename; do grep -q -E '"license": ' "$filename" || echo "$filename" || true; done > .github-pr.missing-license - cat .github-pr.changed-manifest-files | while read filename; do match=$(grep -oiP '"license": ".*\K(AGPL-1\.0|AGPL-3\.0|BSD-2-Clause-FreeBSD|BSD-2-Clause-NetBSD|bzip2-1\.0\.5|eCos-2\.0|GFDL-1\.1|GFDL-1\.2|GFDL-1\.3|GPL-1\.0|GPL-1\.0\+|GPL-2\.0|GPL-2\.0\+|GPL-2\.0-with-autoconf-exception|GPL-2\.0-with-bison-exception|GPL-2\.0-with-classpath-exception|GPL-2\.0-with-font-exception|GPL-2\.0-with-GCC-exception|GPL-3\.0|GPL-3\.0\+|GPL-3\.0-with-autoconf-exception|GPL-3\.0-with-GCC-exception|LGPL-2\.0|LGPL-2\.0\+|LGPL-2\.1|LGPL-2\.1\+|LGPL-3\.0|LGPL-3\.0\+|Nunit|StandardML-NJ|wxWindows)(?=[ "])' "$filename" || true); if [ ! -z "$match" ]; then echo "$filename (has deprecated license \"$match\")" ; fi ; done > .github-pr.deprecated-license + cat .github-pr.changed-manifest-files | while read filename; do grep -n -H '"license": "' "$filename" || true; done > .github-pr.all-licenses + cat .github-pr.all-licenses | while read license; do \ + location=$(echo $license | grep -oP '^.*?:[0-9]+:'); \ + echo $license | \ + grep -oiP '(AGPL-1\.0|AGPL-3\.0|BSD-2-Clause-FreeBSD|BSD-2-Clause-NetBSD|bzip2-1\.0\.5|eCos-2\.0|GFDL-1\.1|GFDL-1\.2|GFDL-1\.3|GPL-1\.0|GPL-1\.0\+|GPL-2\.0|GPL-2\.0\+|GPL-2\.0-with-autoconf-exception|GPL-2\.0-with-bison-exception|GPL-2\.0-with-classpath-exception|GPL-2\.0-with-font-exception|GPL-2\.0-with-GCC-exception|GPL-3\.0|GPL-3\.0\+|GPL-3\.0-with-autoconf-exception|GPL-3\.0-with-GCC-exception|LGPL-2\.0|LGPL-2\.0\+|LGPL-2\.1|LGPL-2\.1\+|LGPL-3\.0|LGPL-3\.0\+|Nunit|StandardML-NJ|wxWindows)(?=[ ")&|,])' | \ + while read id; do \ + echo "$location$id"; \ + done || true; \ + done > .github-pr.deprecated-license ./vcpkg format-manifest --all --convert-control git diff > .github-pr.format-manifest git add -u @@ -57,7 +65,7 @@ jobs: const deprecated_function = (await fs.readFile('.github-pr.deprecated-function', 'utf8')).split('\n').filter(s => s.length > 0) const deprecated_cmake = (await fs.readFile('.github-pr.deprecated-cmake', 'utf8')).split('\n').filter(s => s.length > 0) const missing_license = (await fs.readFile('.github-pr.missing-license', 'utf8')).trim() - const deprecated_license = (await fs.readFile('.github-pr.deprecated-license', 'utf8')).trim() + const deprecated_license = (await fs.readFile('.github-pr.deprecated-license', 'utf8')).split('\n').filter(s => s.length > 0) let approve = true; if (format !== "") { @@ -149,23 +157,31 @@ jobs: } } - if (missing_license !== "" || deprecated_license !== "") { - var license_output = ''; - license_output += 'You have modified or added at least one vcpkg.json where you should check the \"license\" field.\n' - if (missing_license !== "") { - license_output += 'If you feel able to do so, please consider adding a "license" field to the following files:\n' - license_output += missing_license - license_output += "\n\nValid values for the license field can be found at https://learn.microsoft.com/en-us/vcpkg/reference/vcpkg-json#license\n\n" - } - if (deprecated_license !== "") { - license_output += 'If you feel able to do so, please consider replacing the deprecated license identifiers in the following files:\n' - license_output += deprecated_license - license_output += "\n\nDeprecated and non deprecated license identifiers can be found at https://spdx.org/licenses/#deprecated\n" - } + if (missing_license !== "" || deprecated_license.length > 0) { + core.summary.addRaw('You have modified or added at least one vcpkg.json where you should check the \"license\" field.'); + core.summary.addEOL(); + } + + if (missing_license !== "") { + license_output = 'If you feel able to do so, please consider adding a "license" field to the following files:\n' + license_output += missing_license + license_output += "\n\nValid values for the license field can be found at https://learn.microsoft.com/vcpkg/reference/vcpkg-json#license\n\n" core.warning(license_output); } + for (let line of deprecated_license) { + [file, line_number, match] = line.split(':'); + var license_output = `SPDX deprecated license identifier ${match}.`; + license_output += "\nIf you feel able to do so, please consider replacing it." + license_output += "\nUpdated license identifiers can be found at https://spdx.org/licenses/." + + + core.notice(license_output, {file, startLine: line_number}); + } + + core.summary.write(); + if (!approve) { process.exitCode = 1; } diff --git a/ports/liburing/portfile.cmake b/ports/liburing/portfile.cmake index 4745858910..608f1caf95 100644 --- a/ports/liburing/portfile.cmake +++ b/ports/liburing/portfile.cmake @@ -19,10 +19,6 @@ vcpkg_configure_make( vcpkg_install_make() vcpkg_fixup_pkgconfig() -vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") -file(INSTALL "${CURRENT_PORT_DIR}/usage" - DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") - # note: {SOURCE_PATH}/src/Makefile makes liburing.so from liburing.a. # For dynamic, remove intermediate file liburing.a when install is finished. if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") @@ -34,3 +30,16 @@ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/man") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/${PORT}/man2") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/${PORT}/man3") file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/share/${PORT}/man7") + +# Cf. README +vcpkg_install_copyright(COMMENT [[ +All software contained from liburing is dual licensed LGPL and MIT, see +COPYING and LICENSE, except for a header coming from the kernel which is +dual licensed GPL with a Linux-syscall-note exception and MIT, see +COPYING.GPL and . +]] + FILE_LIST + "${SOURCE_PATH}/LICENSE" + "${SOURCE_PATH}/COPYING" + "${SOURCE_PATH}/COPYING.GPL" +) diff --git a/ports/liburing/usage b/ports/liburing/usage deleted file mode 100644 index bbfbaafbf2..0000000000 --- a/ports/liburing/usage +++ /dev/null @@ -1,6 +0,0 @@ -The package liburing can be imported via CMake FindPkgConfig module: - - find_package(PkgConfig) - pkg_check_modules(liburing REQUIRED IMPORTED_TARGET GLOBAL liburing>=2.0) - - target_link_libraries(main PRIVATE PkgConfig::liburing) diff --git a/ports/liburing/vcpkg.json b/ports/liburing/vcpkg.json index fd998566f9..9195f0b8bb 100644 --- a/ports/liburing/vcpkg.json +++ b/ports/liburing/vcpkg.json @@ -1,8 +1,9 @@ { "name": "liburing", "version": "2.6", + "port-version": 1, "description": "Linux-native io_uring I/O access library", "homepage": "https://github.com/axboe/liburing", - "license": "MIT OR LGPL-2.1 OR GPL-2.0", + "license": "(MIT OR LGPL-2.1) AND (MIT OR (GPL-2.0 WITH Linux-syscall-note))", "supports": "linux" } diff --git a/versions/baseline.json b/versions/baseline.json index 87562dd1e0..e908d161c2 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5158,7 +5158,7 @@ }, "liburing": { "baseline": "2.6", - "port-version": 0 + "port-version": 1 }, "libusb": { "baseline": "1.0.27", diff --git a/versions/l-/liburing.json b/versions/l-/liburing.json index 329c657ef9..198be299e7 100644 --- a/versions/l-/liburing.json +++ b/versions/l-/liburing.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "1eb251967045d5abea90234fe6d22e11516db11c", + "version": "2.6", + "port-version": 1 + }, { "git-tree": "cc1fc9dc65b195c71976c1777a27c4de2b6a7b1e", "version": "2.6",