]> git.sthu.org Git - pgp-tools.git/blob - gpgdir/bump_version.pl
Checked for policy 3.8.1, no changes necessary.
[pgp-tools.git] / gpgdir / bump_version.pl
1 #!/usr/bin/perl -w
2 #
3 #############################################################################
4 #
5 # File: bump_version.pl
6 #
7 # Purpose: Minor script to enforce consistency in gpgdir version tags.
8 #
9 #############################################################################
10 #
11 # $Id: bump_version.pl 1055 2008-05-21 02:57:17Z mbr $
12 #
13
14 use strict;
15
16 my @files = qw(
17 gpgdir
18 test/gpgdir_test.pl
19 );
20
21 my $new_version = $ARGV[0] or die "[*] $0 <new version>";
22
23 open F, '< VERSION' or die "[*] Could not open VERSION file: $!";
24 my $old_version = <F>;
25 close F;
26 chomp $old_version;
27
28 print "[+] Updating software versions...\n";
29 for my $file (@files) {
30 if ($file =~ /\.c/) {
31 ###* Version: 1.8.4-pre2
32 my $search_re = qr/^\*\s+Version:\s+$old_version/;
33 my $replace_str = '* Version: ' . $new_version;
34 system qq{perl -p -i -e 's|$search_re|} .
35 qq{$replace_str|' $file};
36 } else {
37 ### Version: 1.8.4
38 my $search_re = qr/#\s+Version:\s+$old_version/;
39 my $replace_str = '# Version: ' . $new_version;
40 system qq{perl -p -i -e 's|$search_re|$replace_str|' $file};
41 ### my $version = '1.8.4';
42 $search_re = qr/^my\s+\x24version\s+=\s+'$old_version';/;
43 $replace_str = q|my \x24version = '| . $new_version . q|';|;
44 system qq{perl -p -i -e "s|$search_re|$replace_str|" $file};
45 }
46 }
47 system qq{perl -p -i -e 's|$old_version|$new_version|' VERSION};
48
49 exit 0;