[interchange] Make get_dist_version() smarter about which future version numbers might be

David Christensen interchange-cvs at icdevgroup.org
Fri Nov 3 17:23:49 UTC 2017


commit 93bbfd8e856001b81f14fdf80e7966b4547b582d
Author: David Christensen <david at endpoint.com>
Date:   Fri Nov 3 11:47:19 2017 -0500

    Make get_dist_version() smarter about which future version numbers might be

 Makefile.PL |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)
---
diff --git a/Makefile.PL b/Makefile.PL
index 3828838..babd088 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -719,26 +719,25 @@ EOF
 
 sub get_dist_version {
 	my $vers = $VERSION;
+	my $is_stable;
+
 	if (-d "./.git") {
 		$vers = qx(git describe --tags);
 		chomp $vers;
+		my $branch = qx(git rev-parse --abbrev-ref HEAD);
+		chomp $branch;
+		$is_stable = $branch =~ /^STABLE_/ ? 1 : 0;
 	}
-	# standardize/handle old tagged REL tags
-	if ($vers =~ /^REL_(\d+)_(\d+)_(\d+)(-(\d+)-g(\w+))/) {
+	# standardize tagged releases; 2 valid formats here: REL_5_X_X and 5.X.X
+	if ($vers =~ /^REL_(\d+)_(\d+)_(\d+)(-(\d+)-g(\w+))?/ || /^(\d+)\.(\d+)\.(\d+)(-(\d+)-g(\w+))?/ ) {
 		if ($4) {
-			$vers = sprintf '%d.%d.%d', $1, $2 + 1, 0;
-			$vers .= '-devel-' . $6 if $4;
+			$vers = sprintf '%d.%d.%d-devel-%s', $1, $2 + ($is_stable ? 0 : 1), ($is_stable ? $3 + 1 : 0), $6;
 		}
 		else {
 			$vers = "$1.$2.$3";
 		}
 	}
-	elsif ($vers =~ /^(\d+)\.(\d+)\.(\d+)(-(\d+)-g(\w+))/) {
-		$vers = sprintf '%d.%d.%d-devel-%s', $1, $2 + 1, 0, $6;
-	}
-	else {
-		# assuming this is \d+.\d+.\d+ for new tagging scenario
-	}
+	# assuming we're a pure tag here
 	$vers;
 }
 



More information about the interchange-cvs mailing list