[pacman-dev] [PATCH 4/6] makepkg: merge validate_pkgver into check_pkgver
Allan McRae
allan at archlinux.org
Tue May 12 14:02:28 UTC 2015
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 at archlinux.org>
---
scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in | 12 ++++--------
scripts/makepkg.sh.in | 2 +-
2 files changed, 5 insertions(+), 9 deletions(-)
diff --git a/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in b/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
index d23f704..3fa4ff7 100644
--- a/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
+++ b/scripts/libmakepkg/lint_pkgbuild/pkgver.sh.in
@@ -29,20 +29,16 @@ source "$LIBRARY/util/message.sh"
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() {
if [[ -z ${pkgver} ]]; then
error "$(gettext "%s is not allowed to be empty.")" "pkgver"
return 1
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() {
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 4885341..11e6459 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -824,7 +824,7 @@ download_sources() {
# Re-sources the PKGBUILD afterwards to allow for other variables that use $pkgver
update_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"
exit 1
fi
--
2.4.0
More information about the pacman-dev
mailing list