Subject: | [PATCH] version numbers no longer get confused by trailing commas |
When parsing versions from a Makefile.PL, the current script gets
slightly confused when a value is given without quotes. I.e.
VERSION => 1.34,
is parsed as '1.34,"'. Notice the trailing ','. This patch updates the
regexes to explicitly disallow the ',' in version numbers.
Subject: | 0001-when-parsing-version-numbers-I-no-longer-get-confuse.patch |
From 30669bdd5a88d7461d726486894fd454bdf7f9b3 Mon Sep 17 00:00:00 2001
From: Dima Kogan <dima@secretsauce.net>
Date: Sun, 25 Sep 2011 20:08:58 -0700
Subject: [PATCH] when parsing version numbers, I no longer get confused by
trailing commas
---
lib/DhMakePerl/Command/Packaging.pm | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/DhMakePerl/Command/Packaging.pm b/lib/DhMakePerl/Command/Packaging.pm
index 5abed96..d91d1ed 100644
--- a/lib/DhMakePerl/Command/Packaging.pm
+++ b/lib/DhMakePerl/Command/Packaging.pm
@@ -410,16 +410,16 @@ sub extract_name_ver_from_build {
$ver = $self->cfg->version;
}
- elsif ( $file =~ /([\'\"]?)\sdist_version\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s ) {
+ elsif ( $file =~ /([\'\"]?)\sdist_version\1\s*(=>|,)\s*([\'\"]?)([^\s,]*)\3/s ) {
$ver = $4;
# Where is the version taken from?
$vfrom = $4
if $file
- =~ /([\'\"]?)dist_version_from\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s;
+ =~ /([\'\"]?)dist_version_from\1\s*(=>|,)\s*([\'\"]?)([^\s,]*)\3/s;
}
- elsif ( $file =~ /([\'\"]?)dist_version_from\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s )
+ elsif ( $file =~ /([\'\"]?)dist_version_from\1\s*(=>|,)\s*([\'\"]?)([^\s,]*)\3/s )
{
$vfrom = $4;
@@ -553,7 +553,7 @@ sub extract_name_ver_from_makefile {
$ver = $self->cfg->version;
}
- elsif ( $file =~ /([\'\"]?)\bVERSION\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s ) {
+ elsif ( $file =~ /([\'\"]?)\bVERSION\1\s*(=>|,)\s*([\'\"]?)([^\s,]*)\3/s ) {
# Regular MakeMaker
$ver = $4;
@@ -561,10 +561,10 @@ sub extract_name_ver_from_makefile {
# Where is the version taken from?
$vfrom = $4
if $file
- =~ /([\'\"]?)VERSION_FROM\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s;
+ =~ /([\'\"]?)VERSION_FROM\1\s*(=>|,)\s*([\'\"]?)([^\s,]*)\3/s;
}
- elsif ( $file =~ /([\'\"]?)VERSION_FROM\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s )
+ elsif ( $file =~ /([\'\"]?)VERSION_FROM\1\s*(=>|,)\s*([\'\"]?)([^\s,]*)\3/s )
{
# Regular MakeMaker pointing to where the version is taken from
--
1.7.5.4