[pacman-dev] [PATCH] makepkg: detect incorrect unsage of >= in provides

Allan McRae allan at archlinux.org
Thu Jan 1 13:16:39 EST 2009


Using >= in the provides array is stupid so make it cause an error.
Fixes FS#12540.

Also, use bash substitution rather than spawning new processes where
possible in the error checking.  Move split package detection to a
better position.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/makepkg.sh.in |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 66aaa5e..634ee4e 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1574,6 +1574,10 @@ if [ "$GENINTEG" = "1" ]; then
 	exit 0 # $E_OK
 fi
 
+if [ "${#pkgname[@]}" -gt "1" ]; then
+	SPLITPKG=1
+fi
+
 # check for no-no's in the build script
 if [ -z "$pkgname" ]; then
 	error "$(gettext "%s is not allowed to be empty.")" "pkgname"
@@ -1587,19 +1591,15 @@ if [ -z "$pkgrel" ]; then
 	error "$(gettext "%s is not allowed to be empty.")" "pkgrel"
 	exit 1
 fi
-if [ $(echo "$pkgver" | grep '-') ]; then
+if [ $pkgver != ${pkgver//-/} ]; then
 	error "$(gettext "%s is not allowed to contain hyphens.")" "pkgver"
 	exit 1
 fi
-if [ $(echo "$pkgrel" | grep '-') ]; then
+if [ $pkgrel != ${pkgrel//-/} ]; then
 	error "$(gettext "%s is not allowed to contain hyphens.")" "pkgrel"
 	exit 1
 fi
 
-if [ "${#pkgname[@]}" -gt "1" ]; then
-	SPLITPKG=1
-fi
-
 if [ "$arch" = 'any' ]; then
 	CARCH='any'
 fi
@@ -1613,6 +1613,10 @@ if ! in_array $CARCH ${arch[@]}; then
 	fi
 fi
 
+if [ $(echo "${provides[@]" | grep ">=") ]; then
+	error "$(gettext "%s is not allowed to contain >= provisions.")" "provides"
+fi
+
 if [ "$install" -a ! -f "$install" ]; then
 	error "$(gettext "Install scriptlet (%s) does not exist.")" "$install"
 	exit 1
-- 
1.6.1



More information about the pacman-dev mailing list