From 0545ac0b2fdf796a09cc105e9ebc79eb3df8223b Mon Sep 17 00:00:00 2001 From: Philip Cook Date: Tue, 12 Jul 2022 15:48:25 -0400 Subject: [PATCH 1/3] BUG: Parse version numbers with more than one digit --- Utilities/tagRelease.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/tagRelease.pl b/Utilities/tagRelease.pl index 5aaa1728e..7b2680199 100755 --- a/Utilities/tagRelease.pl +++ b/Utilities/tagRelease.pl @@ -24,7 +24,7 @@ my $tag = $ARGV[0]; -if (!($tag =~ m/^v[0-9]\.[0-9]\.[0-9]/) ) { +if (!($tag =~ m/^v[0-9]+\.[0-9]+\.[0-9]+/) ) { print "Tags for release should be in the format vX.Y.Z where X,Y,Z are integers\n"; exit(1); } @@ -58,7 +58,7 @@ my $versionDotCmake = do { local $/; <$inFH> }; close($inFH); -my ($tagVersionMajor,$tagVersionMinor,$tagVersionPatch) = ($tag =~ m/^v([0-9])\.([0-9])\.([0-9])/); +my ($tagVersionMajor,$tagVersionMinor,$tagVersionPatch) = ($tag =~ m/^v([0-9]+)\.([0-9]+)\.([0-9]+)/); $versionDotCmake =~ s/set\(\$\{PROJECT_NAME\}_VERSION_MAJOR "[0-9]+"\)/set\(\$\{PROJECT_NAME\}_VERSION_MAJOR "${tagVersionMajor}"\)/ or die("Cannot find version information in Version.cmake"); From 82a6c0a15fe9a3e4628ead116986f946e27b3124 Mon Sep 17 00:00:00 2001 From: Philip Cook Date: Tue, 12 Jul 2022 16:09:10 -0400 Subject: [PATCH 2/3] ENH: Prevent duplicate tags causing any changes in version info --- Utilities/tagRelease.pl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Utilities/tagRelease.pl b/Utilities/tagRelease.pl index 7b2680199..6ac09beea 100755 --- a/Utilities/tagRelease.pl +++ b/Utilities/tagRelease.pl @@ -53,6 +53,14 @@ exit(1); } +# Also don't allow a duplicate tag. I think git will stop this, but less messy to check here +my $allTags = `git tag`; + +if ($allTags =~ m/^${tag}$/) { + print "The tag $tag already exists. Exiting \n"; + exit(1); +} + # Check tag matches Version.cmake open(my $inFH, "<", "Version.cmake"); my $versionDotCmake = do { local $/; <$inFH> }; From a8027a53d709e7b0c839dd1bf585f2a89065a786 Mon Sep 17 00:00:00 2001 From: Philip Cook Date: Tue, 12 Jul 2022 16:14:14 -0400 Subject: [PATCH 3/3] ENH: Check for duplicate tags --- Utilities/tagRelease.pl | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Utilities/tagRelease.pl b/Utilities/tagRelease.pl index 6ac09beea..666675168 100755 --- a/Utilities/tagRelease.pl +++ b/Utilities/tagRelease.pl @@ -53,12 +53,16 @@ exit(1); } -# Also don't allow a duplicate tag. I think git will stop this, but less messy to check here -my $allTags = `git tag`; +# Also don't allow a duplicate tag. git will stop this later, but less messy to check here +my @allTags = `git tag`; -if ($allTags =~ m/^${tag}$/) { - print "The tag $tag already exists. Exiting \n"; - exit(1); +chomp(@allTags); + +foreach my $repoTag (@allTags) { + if ($repoTag == ${tag}) { + print "The tag $tag already exists. Exiting \n"; + exit(1); + } } # Check tag matches Version.cmake