Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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