abuild: warn when p in pkgver should be _p

we have for example had sudo 1.9.5p2 which should have been
1.9.5_p2. Show a warning to avoid this in the future.
This commit is contained in:
Natanael Copa 2023-03-16 13:22:19 +01:00
parent 28bba53928
commit 16febc41a2
3 changed files with 17 additions and 1 deletions

View File

@ -197,6 +197,10 @@ default_sanitycheck() {
# give 0 as it is always valid and give the pkgrel
$APK version --check --quiet 0-r"$pkgrel" || \
die "$pkgrel is not a valid pkgrel"
# warn when p1 should be _p1
case "$pkgver" in
*[0-9]p[0-9]) warning "pkgver should probably be $(echo "$pkgver" | sed -E -e 's/(.*[0-9])p([0-9])/\1_p\2/')";;
esac
[ -z "$pkgdesc" ] && die "Missing pkgdesc in APKBUILD"
[ -z "$url" ] && die "Missing url in APKBUILD"
[ -z "$license" ] && die "Missing license in APKBUILD"

View File

@ -21,6 +21,7 @@ init_tests \
abuild_invalid_pkgnames \
abuild_invalid_subpkgnames \
abuild_invalid_subpkg_version \
abuild_warn_pkgver_patch_version \
abuild_multiline_license \
abuild_git_ceiling \
abuild_package_size_zero \
@ -414,6 +415,17 @@ abuild_invalid_subpkg_version_body() {
abuild all
}
abuild_warn_pkgver_patch_version_body() {
cp -ra "$testrepo"/test-pkgname .
cd test-pkgname
TESTPKGVER=1.0_p1 atf_check -s exit:0 \
-e not-match:'WARNING' \
abuild sanitycheck
TESTPKGVER=1.0p1 atf_check -s exit:0 \
-e match:'WARNING.*1.0_p1' \
abuild sanitycheck
}
abuild_multiline_license_body() {
cp -ra "$testrepo"/test-licenses .
cd test-licenses

View File

@ -2,7 +2,7 @@
# test package
pkgname=${TESTNAME-test-pkgname}
pkgver="1.0"
pkgver="${TESTPKGVER-1.0}"
pkgrel=0
pkgdesc="Dummy test package that fails to build"
url="https://gitlab.alpinelinux.org/alpine/aports"