[interchange] Make get_dist_version() smarter about which future version numbers might be
David Christensen <[email protected]> Fri, 03 Nov 2017 17:23:49 +0000
| Newsgroups | gmane.comp.web.interchange.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit 93bbfd8e856001b81f14fdf80e7966b4547b582d Author: David Christensen <[email protected]> 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; }