Package: pkg-php-tools
Version: 1.11~bpo70~dabe1
Severity: normal
Tags: patch

This is kind of a follow-up of bug #729452 that added initial support
for ALPHA and other WIP releases.


As of pkg-php-tools 1.11 dh_phpcomposer is not able to deal with uppercase
ALPHA, RC and other WIP releases. I came across this while trying to use
dh_phpcomposer to generate substvars for symfony/intl (v2.3.16), which has
the following in its composer.json:

"require": {
        "php": ">=5.3.3",
        "symfony/icu": "~1.0-RC"
},

dh_phpcomposer can not deal with the uppercase 'RC' (but it would support a
lowercase rc). The same is with alpha vs. ALPHA, beta vs. BETA, etc.

The attached patch simply makes the match added in #729452 case insensitive and
lowercases the use of the match in the Debian version later on.
diff --git a/lib/scripts/phppkginfo b/lib/scripts/phppkginfo
index 59cad76..2f3d3ed 100755
--- a/lib/scripts/phppkginfo
+++ b/lib/scripts/phppkginfo
@@ -365,7 +365,7 @@ function composerDebianVersion($pkg, $version, $link) {
 			'(>|>=|<|<=|!=|~)?'. # Operator
 			'\s*'. # Optional spaces
 			'v?(([\d*]+)(\.[\d*]+)?(\.[\d*]+)?(\.[\d*]+)?)'. # version
-			'-?(alpha\d*|a\d*|beta\d*|b\d*|rc\d*)?'. # wip
+			'-?((?i)alpha\d*|a\d*|beta\d*|b\d*|rc\d*(?-i))?'. # wip
 			'(@(stable|RC|beta|alpha|dev))?'. # stability
 			'(\s+as +([^,\s]+))?$/', # "as ..."
 			$version, $match)
@@ -373,7 +373,7 @@ function composerDebianVersion($pkg, $version, $link) {
 		$operator = isset($match[1]) ? $match[1] : NULL;
 		$short_version = isset($match[2]) ? $match[2] : NULL;
 		if (strpos($short_version, '*') === false) {
-			$short_version .= isset($match[7]) ? '~'.$match[7] : NULL;
+			$short_version .= isset($match[7]) ? '~'.strtolower($match[7]) : NULL;
 		}
 		$short_version_array = explode('.', $short_version);
 		$stability = isset($match[8]) ? $match[8] : NULL;

Reply via email to