mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-01-02 20:42:43 +00:00
abuild: error on digit+letter+digit version format
This commit is contained in:
parent
f0051d2658
commit
1804361f61
17
abuild.in
17
abuild.in
@ -188,7 +188,7 @@ verify_pkgname() {
|
||||
|
||||
# check if apkbuild is basically sane
|
||||
default_sanitycheck() {
|
||||
local i= j= suggestion=
|
||||
local i= j=
|
||||
msg "Checking sanity of $APKBUILD..."
|
||||
[ -z "$pkgver" ] && die "Missing pkgver in APKBUILD"
|
||||
$APK version --check --quiet -- "$pkgver"-r0 || \
|
||||
@ -197,16 +197,13 @@ 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"
|
||||
# digit+letter+digit passes the apk2 version check
|
||||
case $pkgver in
|
||||
*[0-9][a-z][0-9]*)
|
||||
die "the digit+letter+digit version format is invalid. Use suffixes instead"
|
||||
;;
|
||||
esac
|
||||
|
||||
# warn when <letter><digit> should be <suffix><digit>
|
||||
# eg p1 -> _p1, a5 -> _alpha5 and b10 -> _beta10
|
||||
suggestion=$(echo "$pkgver" | sed -E \
|
||||
-e 's/(.*[0-9])a([0-9]+)$/\1_alpha\2/' \
|
||||
-e 's/(.*[0-9])b([0-9]+)$/\1_beta\2/' \
|
||||
-e 's/(.*[0-9])p([0-9]+)$/\1_p\2/')
|
||||
if [ "$pkgver" != "$suggestion" ]; then
|
||||
warning "Did you mean 'pkgver=$suggestion'?"
|
||||
fi
|
||||
[ -z "$pkgdesc" ] && die "Missing pkgdesc in APKBUILD"
|
||||
[ -z "$url" ] && die "Missing url in APKBUILD"
|
||||
[ -z "$license" ] && die "Missing license in APKBUILD"
|
||||
|
@ -26,7 +26,7 @@ init_tests \
|
||||
abuild_subpackage_arch \
|
||||
abuild_large_doc_subpackage \
|
||||
abuild_bigdocs \
|
||||
abuild_warn_pkgver_suffix \
|
||||
abuild_pkgver_digit_letter_digit \
|
||||
abuild_multiline_license \
|
||||
abuild_license_spdx \
|
||||
abuild_git_ceiling \
|
||||
@ -495,20 +495,11 @@ abuild_bigdocs_body() {
|
||||
abuild all
|
||||
}
|
||||
|
||||
abuild_warn_pkgver_suffix_body() {
|
||||
abuild_pkgver_digit_letter_digit_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
|
||||
TESTPKGVER=1.0a1 atf_check -s exit:0 \
|
||||
-e match:'WARNING.*1.0_alpha1' \
|
||||
abuild sanitycheck
|
||||
TESTPKGVER=1.0b10 atf_check -s exit:0 \
|
||||
-e match:'WARNING.*1.0_beta10' \
|
||||
TESTPKGVER=1.0p1 atf_check -s exit:1 \
|
||||
-e match:'ERROR.*version' \
|
||||
abuild sanitycheck
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user