Skip to content

Commit

Permalink
BUG: Parse Release numbers > 9 properly (#1391)
Browse files Browse the repository at this point in the history
* ENH: Prevent duplicate tags causing any changes in version info
  • Loading branch information
cookpa authored Jul 12, 2022
1 parent 11284b7 commit 38e77a9
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Utilities/tagRelease.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -53,12 +53,24 @@
exit(1);
}

# Also don't allow a duplicate tag. git will stop this later, but less messy to check here
my @allTags = `git tag`;

chomp(@allTags);

foreach my $repoTag (@allTags) {
if ($repoTag == ${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> };
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");
Expand Down

0 comments on commit 38e77a9

Please sign in to comment.