Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 48 lines (41 sloc) 1.392 kb
8a03887 @mrash added bump_version.pl script from the fwknop project
authored
1 #!/usr/bin/perl -w
2 #
3 #############################################################################
4 #
5 # File: bump_version.pl
6 #
7 # Purpose: Minor script to enforce consistency in psad version tags.
8 #
9 #############################################################################
10 #
11
12 use strict;
13
14 my @files = qw(
15 psad
16 nf2csv
17 );
18
19 my $new_version = $ARGV[0] or die "[*] $0 <new version>";
20
21 open F, '< VERSION' or die "[*] Could not open VERSION file: $!";
22 my $old_version = <F>;
23 close F;
24 chomp $old_version;
25
26 print "[+] Updating software versions...\n";
27 for my $file (@files) {
28 if ($file =~ /\.c/) {
29 ###* Version: 1.8.4-pre2
30 my $search_re = qr/^\*\s+Version:\s+$old_version/;
31 my $replace_str = '* Version: ' . $new_version;
32 system qq{perl -p -i -e 's|$search_re|} .
33 qq{$replace_str|' $file};
34 } else {
35 ### Version: 1.8.4
36 my $search_re = qr/#\s+Version:\s+$old_version/;
37 my $replace_str = '# Version: ' . $new_version;
38 system qq{perl -p -i -e 's|$search_re|$replace_str|' $file};
39 ### my $version = '1.8.4';
40 $search_re = qr/^my\s+\x24version\s+=\s+'$old_version';/;
41 $replace_str = q|my \x24version = '| . $new_version . q|';|;
42 system qq{perl -p -i -e "s|$search_re|$replace_str|" $file};
43 }
44 }
45 system qq{perl -p -i -e 's|$old_version|$new_version|' VERSION};
46
47 exit 0;
Something went wrong with that request. Please try again.