2011-01-22 09:33:16 +01:00
|
|
|
#!/usr/bin/perl
|
2010-06-05 02:30:03 +02:00
|
|
|
|
2017-03-05 22:33:31 +01:00
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2010-06-05 02:30:03 +02:00
|
|
|
use warnings;
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use POSIX qw(strftime);
|
|
|
|
|
2014-12-30 08:04:35 +01:00
|
|
|
# my $svn_info = `svn info -r head` or die "Couldn't get revision: $!";
|
|
|
|
# my ($rev) = $svn_info =~ /Last Changed Rev: (\d+)/;
|
|
|
|
|
|
|
|
my $rev = `git rev-list --count HEAD`;
|
2010-06-05 02:30:03 +02:00
|
|
|
my $date = strftime "%Y-%m-%d", localtime;
|
|
|
|
|
|
|
|
$rev++;
|
|
|
|
|
|
|
|
print "New version: $rev $date\n";
|
|
|
|
|
2020-02-16 17:41:45 +01:00
|
|
|
open my $in, '<', "PBot/VERSION.pm" or die "Couldn't open VERSION.pm for reading: $!";
|
2010-06-05 02:30:03 +02:00
|
|
|
my @lines = <$in>;
|
|
|
|
close $in;
|
|
|
|
|
2020-02-16 17:41:45 +01:00
|
|
|
open my $out, '>', "PBot/VERSION.pm" or die "Couldn't open VERSION.pm for writing: $!";
|
2010-06-05 02:30:03 +02:00
|
|
|
|
|
|
|
foreach my $text (@lines) {
|
|
|
|
$text =~ s/BUILD_NAME\s+=> ".*",/BUILD_NAME => "PBot",/;
|
|
|
|
$text =~ s/BUILD_REVISION\s+=> \d+,/BUILD_REVISION => $rev,/;
|
|
|
|
$text =~ s/BUILD_DATE\s+=> ".*",/BUILD_DATE => "$date",/;
|
|
|
|
|
|
|
|
print $out $text;
|
|
|
|
}
|
|
|
|
|
|
|
|
close $out;
|