[pacman-dev] [PATCH] makepkg: treat pkgrel more similarly to pkgver

Luke Shumaker lukeshu at sbcglobal.net
Fri Aug 29 14:07:12 EDT 2014


This is perfectly fine with libalpm; it was only makepkg that was more
strict with pkgrel than pkgver.

Further, the former error message about invalid pkgrel formats claimed that
pkgrel was a "decimal", which would mean that `1.1 == 1.10`.  This was not
the case; alpm parsed pkgrel as a version, not a decimal.  In that light,
enforcing /[0-9]+(\.([0-9]+)?/ on a version spec seems silly.
---
 doc/PKGBUILD.5.txt      |  4 ++--
 scripts/makepkg.sh.in   |  5 +----
 test/util/vercmptest.sh | 18 ++++++++++++++++++
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/doc/PKGBUILD.5.txt b/doc/PKGBUILD.5.txt
index e2389cb..159adbb 100644
--- a/doc/PKGBUILD.5.txt
+++ b/doc/PKGBUILD.5.txt
@@ -48,7 +48,7 @@ similar to `$_basekernver`.
 
 *pkgver*::
 	The version of the software as released from the author (e.g., '2.7.1').
-	The variable is not allowed to contain colons or hyphens.
+	The variable is not allowed to contain colons, hyphens or whitespace.
 +
 The `pkgver` variable can be automatically updated by providing a `pkgver()`
 function in the PKGBUILD that outputs the new package version.
@@ -62,7 +62,7 @@ below).
 	allows package maintainers to make updates to the package's configure
 	flags, for example. This is typically set to '1' for each new upstream
 	software release and incremented for intermediate PKGBUILD updates. The
-	variable is not allowed to contain hyphens.
+	variable is not allowed to contain colons, hyphens or whitespace.
 
 *pkgdesc*::
 	This should be a brief description of the package and its functionality.
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 8e8a64c..552d305 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -2337,10 +2337,7 @@ lint_pkgrel() {
 		return 1
 	fi
 
-	if [[ $pkgrel != +([0-9])?(.+([0-9])) ]]; then
-		error "$(gettext "%s must be a decimal, not %s.")" "pkgrel" "$pkgrel"
-		return 1
-	fi
+	validate_pkgver "$pkgrel"
 }
 
 lint_pkgver() {
diff --git a/test/util/vercmptest.sh b/test/util/vercmptest.sh
index 9032cbf..32fb3e7 100755
--- a/test/util/vercmptest.sh
+++ b/test/util/vercmptest.sh
@@ -142,6 +142,24 @@ runtest 1:1.0    1.0   1
 runtest 1:1.0    1.1   1
 runtest 1:1.1    1.1   1
 
+# complex pkgrel values
+runtest 1-1.5.0    1-1.5.0     0
+runtest 1-1.5.1    1-1.5.0     1
+runtest 1-1.5.1    1-1.5       1
+runtest 1-1.5b     1-1.5      -1
+runtest 1-1.5b     1-1.5.1    -1
+runtest 1-1.0a     1-1.0alpha -1
+runtest 1-1.0alpha 1-1.0b     -1
+runtest 1-1.0b     1-1.0beta  -1
+runtest 1-1.0beta  1-1.0rc    -1
+runtest 1-1.0rc    1-1.0      -1
+runtest 1-1.5.a    1-1.5       1
+runtest 1-1.5.b    1-1.5.a     1
+runtest 1-1.5.1    1-1.5.b     1
+runtest 1-2        1-2.par1    1
+runtest 1-2        1-2.par1    1
+runtest 1-3        1-2.par1   -1
+
 #END TESTS
 
 if [[ $failure -eq 0 ]]; then
-- 
2.1.0


More information about the pacman-dev mailing list