2014-02-07 11:37:16 +08:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
# This script will bump the version number in any files listed in the below
|
|
|
|
# @files array. It can only bump versions up, and does so by use of sed.
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
use warnings;
|
|
|
|
use Getopt::Long;
|
|
|
|
|
|
|
|
my @files = (
|
|
|
|
"../version",
|
2014-02-07 11:39:12 +08:00
|
|
|
"../configure.ac",
|
|
|
|
"../CMakeLists.txt"
|
2014-02-07 11:37:16 +08:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
my ($new, $current);
|
|
|
|
|
|
|
|
open my $file, "../version" or die $!;
|
|
|
|
chomp($current = <$file>);
|
|
|
|
close $file;
|
|
|
|
|
|
|
|
sub usage {
|
|
|
|
print "Usage: bump-version.sh -n <new-version>\n";
|
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub bump_version {
|
|
|
|
foreach my $file (@files) {
|
|
|
|
system("sed -i \"s/$current/$new/g\" $file");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GetOptions ("n=s" => \$new) or usage;
|
|
|
|
usage if ! $new;
|
|
|
|
die("New version ($new) is not greater than old version ($current)!") if ( $new le $current);
|
|
|
|
|
|
|
|
bump_version;
|