root/fwknop/tags/fwknop-1.9.2/bump_version.pl

Revision 845, 1.4 kB (checked in by mbr, 1 year ago)

bugfix to properly change perl version vars

  • Property svn:executable set to *
  • Property svn:keywords set to Id
Line 
1 #!/usr/bin/perl -w
2 #
3 #############################################################################
4 #
5 # File: bump_version.pl
6 #
7 # Purpose: Minor script to enforce consistency in fwknop version tags.
8 #
9 #############################################################################
10 #
11 # $Id$
12 #
13
14 use strict;
15
16 my @files = qw(
17     fwknop
18     fwknopd
19     knoptm
20     knopmd.c
21     knopwatchd.c
22     test/fwknop_test.pl
23 );
24
25 my $new_version = $ARGV[0] or die "[*] $0 <new version>";
26
27 open F, '< VERSION' or die "[*] Could not open VERSION file: $!";
28 my $old_version = <F>;
29 close F;
30 chomp $old_version;
31
32 print "[+] Updating software versions...\n";
33 for my $file (@files) {
34     if ($file =~ /\.c/) {
35         ###*  Version: 1.8.4-pre2
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|} .
39             qq{$replace_str|' $file};
40     } else {
41         ### Version: 1.8.4
42         my $search_re   = qr/#\s+Version:\s+$old_version/;
43         my $replace_str = '# Version: ' . $new_version;
44         system qq{perl -p -i -e 's|$search_re|$replace_str|' $file};
45         ### my $version = '1.8.4';
46         $search_re   = qr/^my\s+\x24version\s+=\s+'$old_version';/;
47         $replace_str = q|my \x24version = '| . $new_version . q|';|;
48         system qq{perl -p -i -e "s|$search_re|$replace_str|" $file};
49     }
50 }
51 system qq{perl -p -i -e 's|$old_version|$new_version|' VERSION};
52
53 exit 0;
Note: See TracBrowser for help on using the browser.