makepkg: merge validate_pkgver into check_pkgver
The check that pkgver is non-empty done in check_pkgver should also be performed after running the pkgver() function. Merge validate_pkgver into check_pkgver and run check_pkgver after updating pkgver. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
c9a7b7e0bf
commit
9302593cfb
|
@ -29,20 +29,16 @@ source "$LIBRARY/util/message.sh"
|
||||||
lint_pkgbuild_functions+=('lint_pkgver')
|
lint_pkgbuild_functions+=('lint_pkgver')
|
||||||
|
|
||||||
|
|
||||||
validate_pkgver() {
|
|
||||||
if [[ $1 = *[[:space:]:-]* ]]; then
|
|
||||||
error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
check_pkgver() {
|
check_pkgver() {
|
||||||
if [[ -z ${pkgver} ]]; then
|
if [[ -z ${pkgver} ]]; then
|
||||||
error "$(gettext "%s is not allowed to be empty.")" "pkgver"
|
error "$(gettext "%s is not allowed to be empty.")" "pkgver"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
validate_pkgver "$pkgver"
|
if [[ $1 = *[[:space:]:-]* ]]; then
|
||||||
|
error "$(gettext "%s is not allowed to contain colons, hyphens or whitespace.")" "pkgver"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
lint_pkgver() {
|
lint_pkgver() {
|
||||||
|
|
|
@ -824,7 +824,7 @@ download_sources() {
|
||||||
# Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver
|
# Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver
|
||||||
update_pkgver() {
|
update_pkgver() {
|
||||||
newpkgver=$(run_function_safe pkgver)
|
newpkgver=$(run_function_safe pkgver)
|
||||||
if ! validate_pkgver "$newpkgver"; then
|
if ! check_pkgver "$newpkgver"; then
|
||||||
error "$(gettext "pkgver() generated an invalid version: %s")" "$newpkgver"
|
error "$(gettext "pkgver() generated an invalid version: %s")" "$newpkgver"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue