diff --git a/abuild.in b/abuild.in index a901ca4..849d938 100755 --- a/abuild.in +++ b/abuild.in @@ -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" diff --git a/tests/abuild_test b/tests/abuild_test index 8aa5ec2..2378bca 100755 --- a/tests/abuild_test +++ b/tests/abuild_test @@ -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 diff --git a/tests/testrepo/test-pkgname/APKBUILD b/tests/testrepo/test-pkgname/APKBUILD index 369b5e5..0bca3d4 100644 --- a/tests/testrepo/test-pkgname/APKBUILD +++ b/tests/testrepo/test-pkgname/APKBUILD @@ -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"