[pacman-dev] [PATCH] makepkg: extend test for hyphen prefixes to pkgbase and all pkgnames

Cedric Staniewski cedric at gmx.ca
Mon Oct 26 07:32:29 EDT 2009


Since commit fb97d32, which brought in this test, support for split
PKGBUILDs was added, and therefore, all values of pkgname and also
pkgbase have to be checked now.

Signed-off-by: Cedric Staniewski <cedric at gmx.ca>
---

Last patch before the big freeze...

 scripts/makepkg.sh.in |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 9cd7f2e..c451a36 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1139,8 +1139,8 @@ check_sanity() {
 		error "$(gettext "%s is not allowed to be empty.")" "pkgrel"
 		return 1
 	fi
-	if [ "${pkgname:0:1}" == "-" ]; then
-		error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
+	if [[ ${pkgbase:0:1} = "-" ]]; then
+		error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgbase"
 		return 1
 	fi
 	if [ "$pkgver" != "${pkgver//-/}" ]; then
@@ -1152,6 +1152,14 @@ check_sanity() {
 		return 1
 	fi
 
+	local name
+	for name in "${pkgname[@]}"; do
+		if [[ ${name:0:1} = "-" ]]; then
+			error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
+			return 1
+		fi
+	done
+
 	if [ "$arch" != 'any' ]; then
 		if ! in_array $CARCH ${arch[@]}; then
 			if [ "$IGNOREARCH" -eq 0 ]; then
-- 
1.6.5.1



More information about the pacman-dev mailing list