abuild: Do not store whitespaces in license field

Currently, abuild stores the license variable ad-verbatim in the PKGINFO
file. This causes many downstream systems to fail. For example, `apk
info` won't show anything after the newline, our webview that lists
licenses do not show these either.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
This commit is contained in:
Olliver Schinagl 2022-05-19 13:43:27 +02:00 committed by Natanael Copa
parent 0ab9d5b621
commit f5d6e5e34b
3 changed files with 38 additions and 1 deletions

View File

@ -1135,7 +1135,7 @@ prepare_metafiles() {
echo "provider_priority = $provider_priority" >> "$pkginfo"
fi
echo "license = $license" >> "$pkginfo"
echo "license = $(echo $license)" >> "$pkginfo"
for i in $replaces; do
echo "replaces = $i" >> "$pkginfo"
done

View File

@ -239,3 +239,9 @@ setup() {
! TESTDEPVER="1.0-0" $ABUILD all
}
@test "abuild: check multi-line licenses" {
cd 'testrepo/test-licenses'
$ABUILD rootpkg
grep '^license = MIT AND GPL-3.0-only OR GPL-3.0-or-later AND BSD-Clause-4$' \
"${APORTSDIR}/test-licenses/pkg/.control.test-licenses/.PKGINFO"
}

View File

@ -0,0 +1,31 @@
# Maintainer: Olliver Schinagl <oliver@schinagl.nl>
# test package
pkgname="${TESTNAME-test-licenses}"
pkgver="1.0"
pkgrel=0
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-or-later AND
BSD-Clause-4
'
prepare() {
mkdir -p "${builddir}"
}
build() {
touch foo
}
check() {
true
}
package() {
mkdir -p "${pkgdir}"
}