Skip to content

Commit

Permalink
[vcpkg ci,liburing] Improve license identifier check (#39679)
Browse files Browse the repository at this point in the history
Co-authored-by: Billy O'Neal <[email protected]>
  • Loading branch information
dg0yt and BillyONeal authored Jul 15, 2024
1 parent 460f948 commit ea46374
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 27 deletions.
46 changes: 31 additions & 15 deletions .github/workflows/untrustedPR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 !== "") {
Expand Down Expand Up @@ -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;
}
17 changes: 13 additions & 4 deletions ports/liburing/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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"
)
6 changes: 0 additions & 6 deletions ports/liburing/usage

This file was deleted.

3 changes: 2 additions & 1 deletion ports/liburing/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -5158,7 +5158,7 @@
},
"liburing": {
"baseline": "2.6",
"port-version": 0
"port-version": 1
},
"libusb": {
"baseline": "1.0.27",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/liburing.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "1eb251967045d5abea90234fe6d22e11516db11c",
"version": "2.6",
"port-version": 1
},
{
"git-tree": "cc1fc9dc65b195c71976c1777a27c4de2b6a7b1e",
"version": "2.6",
Expand Down

1 comment on commit ea46374

@FarzanehF14
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to download the v2rayng application for Windows. I couldn't find it on the site please help me with that.

thank you

Please sign in to comment.