[vcpkg ci,liburing] Improve license identifier check (#39679)

Co-authored-by: Billy O'Neal <bion@microsoft.com>
This commit is contained in:
Kai Pastor 2024-07-15 20:43:55 +02:00 committed by GitHub
parent 460f9487ff
commit ea46374aa9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 52 additions and 27 deletions

View file

@ -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;
}

View file

@ -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 <https://spdx.org/licenses/Linux-syscall-note.html>.
]]
FILE_LIST
"${SOURCE_PATH}/LICENSE"
"${SOURCE_PATH}/COPYING"
"${SOURCE_PATH}/COPYING.GPL"
)

View file

@ -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)

View file

@ -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"
}

View file

@ -5158,7 +5158,7 @@
},
"liburing": {
"baseline": "2.6",
"port-version": 0
"port-version": 1
},
"libusb": {
"baseline": "1.0.27",

View file

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1eb251967045d5abea90234fe6d22e11516db11c",
"version": "2.6",
"port-version": 1
},
{
"git-tree": "cc1fc9dc65b195c71976c1777a27c4de2b6a7b1e",
"version": "2.6",