abuild: fix quote handling in check_license

This commit is contained in:
Sertonix 2024-02-12 12:36:20 +01:00
parent 39c2b44c63
commit 4ae1b39910
3 changed files with 14 additions and 5 deletions

View File

@ -1041,12 +1041,12 @@ check_maintainer() {
check_license() {
local ret=0
local license_list=/usr/share/spdx/license.lst
local exclude="AND OR WITH ( )"
if options_has "!spdx" || ! [ -f "$license_list" ]; then
return 0
fi
local IFS="$IFS()"
local i; for i in $license; do
list_has "$i" $exclude && continue
list_has "$i" AND OR WITH && continue
if ! grep -q -x -F "$i" "$license_list"; then
ret=1
warning "\"$i\" is not a known license"

View File

@ -28,6 +28,7 @@ init_tests \
abuild_bigdocs \
abuild_warn_pkgver_patch_version \
abuild_multiline_license \
abuild_license_spdx \
abuild_git_ceiling \
abuild_package_size_zero \
abuild_package_size_nonzero \
@ -499,10 +500,18 @@ abuild_multiline_license_body() {
cp -ra "$testrepo"/test-licenses .
cd test-licenses
abuild rootpkg
atf_check -o match:'^license = MIT AND GPL-3.0-only OR GPL-3.0-or-later AND BSD-Clause-4$' \
atf_check -o match:'^license = MIT AND \(GPL-3.0-only OR GPL-3.0-or-later AND BSD-Clause-4\)$' \
cat pkg/.control.test-licenses/.PKGINFO
}
abuild_license_spdx_body() {
cp -ra "$testrepo"/test-licenses .
cd test-licenses
TESTPKGVER=1.0_p1 atf_check -s exit:0 \
-e not-match:'WARNING' \
abuild sanitycheck
}
abuild_git_ceiling_body() {
init_keys
git init

View File

@ -8,10 +8,10 @@ pkgdesc='Dummy test package that has multi-line licenses'
url='https://gitlab.alpinelinux.org/alpine/aports'
arch='noarch'
license='MIT AND
GPL-3.0-only OR
(GPL-3.0-only OR
GPL-3.0-or-later AND
BSD-Clause-4
BSD-Clause-4)
'
prepare() {