Repository: lucy-clownfish Updated Branches: refs/heads/0.4 0a905080e -> 643c53027
Add support for CPAN developer releases Now the "update_version" script can be used to set CPAN developer versions containing an underscore. Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/c5031630 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/c5031630 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/c5031630 Branch: refs/heads/0.4 Commit: c5031630c66770c90f5e8ce9afbc07090704f129 Parents: 0a90508 Author: Nick Wellnhofer <[email protected]> Authored: Thu Jan 21 18:21:48 2016 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Tue Jan 26 13:02:16 2016 +0100 ---------------------------------------------------------------------- devel/bin/update_version | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/c5031630/devel/bin/update_version ---------------------------------------------------------------------- diff --git a/devel/bin/update_version b/devel/bin/update_version index dc01d4b..6df810d 100755 --- a/devel/bin/update_version +++ b/devel/bin/update_version @@ -26,18 +26,29 @@ my $usage = "$0 version\n"; my $version = shift(@ARGV) or die $usage; # standardize version strings -my ( $x, $y, $z ); +my ( $x, $y, $z, $dev ); if ( $version =~ m/^(\d+)\.(\d+)\.(\d+)$/ ) { ( $x, $y, $z ) = ( $1, $2, $3 ); } +elsif ( $version =~ m/^(\d+)\.(\d+)\.(\d+)_(\d+)$/ ) { + ( $x, $y, $z, $dev ) = ( $1, $2, $3, $4 ); +} elsif ( $version =~ m/^(\d+)\.(\d\d\d)(\d\d\d)$/ ) { ( $x, $y, $z ) = ( int($1), int($2), int($3) ); } +elsif ( $version =~ m/^(\d+)\.(\d\d\d)(\d\d\d)_(\d\d\d)$/ ) { + ( $x, $y, $z, $dev ) = ( int($1), int($2), int($3), int($4) ); +} else { die "Unknown version syntax. Try X.Y.Z or X.YYYZZZ\n"; } -my $x_y_z_version = sprintf( "%d.%d.%d", $x, $y, $z ); -my $x_yyyzzz_version = sprintf( "%d.%03d%03d", $x, $y, $z ); +my $x_y_z_version = sprintf( "%d.%d.%d", $x, $y, $z ); +my $x_y_z_d_version = $dev + ? sprintf( "%d.%d.%d_%d", $x, $y, $z, $dev ) + : sprintf( "%d.%d.%d", $x, $y, $z ); +my $x_yyyzzz_version = $dev + ? sprintf( "%d.%03d%03d_%03d", $x, $y, $z, $dev ) + : sprintf( "%d.%03d%03d", $x, $y, $z ); print "Using version: $x_y_z_version ( $x_yyyzzz_version )\n"; @@ -57,7 +68,7 @@ for my $path ('runtime/common/charmonizer.c', 'runtime/common/charmonizer.main') $buf = read_file('compiler/perl/lib/Clownfish/CFC.pm'); $buf =~ s/(our \$VERSION\ +=\ +)'.+?'/$1'$x_yyyzzz_version'/g or die "no match"; -$buf =~ s/XSLoader::load\( 'Clownfish::CFC', '(.+?)'/XSLoader::load\( 'Clownfish::CFC', '$x_y_z_version'/ +$buf =~ s/XSLoader::load\( 'Clownfish::CFC', '(.+?)'/XSLoader::load\( 'Clownfish::CFC', '$x_y_z_d_version'/ or die "no match"; write_file( 'compiler/perl/lib/Clownfish/CFC.pm', $buf ); @@ -65,27 +76,27 @@ write_file( 'compiler/perl/lib/Clownfish/CFC.pm', $buf ); $buf = read_file('runtime/perl/lib/Clownfish.pm'); $buf =~ s/(our \$VERSION\ +=\ +)'.+?'/$1'$x_yyyzzz_version'/g or die "no match"; -$buf =~ s/(bootstrap Clownfish ')(.+?)'/$1$x_y_z_version'/ +$buf =~ s/(bootstrap Clownfish ')(.+?)'/$1$x_y_z_d_version'/ or die "no match"; -$buf =~ s/^\d+\.\d+\.\d+\b$/$x_y_z_version/m +$buf =~ s/^\d+\.\d+\.\d+(_\d+)?\b$/$x_y_z_d_version/m or die "no match"; write_file( 'runtime/perl/lib/Clownfish.pm', $buf ); # Update Clownfish.pod. $buf = read_file('runtime/perl/lib/Clownfish.pod'); -$buf =~ s/(^=head1\s+VERSION\s+)([\d.]+)/$1$x_y_z_version/m +$buf =~ s/(^=head1\s+VERSION\s+)([\d._]+)/$1$x_y_z_d_version/m or die "no match"; write_file( 'runtime/perl/lib/Clownfish.pod', $buf ); # Update compiler Build.PL $buf = read_file('compiler/perl/Build.PL'); -$buf =~ s/(dist_version\ +=>\ +)'.+?'/$1'$x_y_z_version'/ +$buf =~ s/(dist_version\ +=>\ +)'.+?'/$1'$x_y_z_d_version'/ or die "no match"; write_file( 'compiler/perl/Build.PL', $buf ); # Update runtime Build.PL $buf = read_file('runtime/perl/Build.PL'); -$buf =~ s/(dist_version\ +=>\ +)'.+?'/$1'$x_y_z_version'/ +$buf =~ s/(dist_version\ +=>\ +)'.+?'/$1'$x_y_z_d_version'/ or die "no match"; $buf =~ s/(Clownfish::CFC::Perl::Build'\s*=>\s*)(.*?),/$1$x_yyyzzz_version,/g or die "no match"; @@ -180,7 +191,9 @@ depending on the file format and type. I<version> may be specified in either format: X.Y.Z + X.Y.Z_D (CPAN developer release) X.YYYZZZ + X.YYYZZZ_DDD (CPAN developer release) and update_version will convert the specified string into the correct format for each relevant file.
