#! /usr/bin/perl use warnings; use strict; use integer; use FindBin; use lib $FindBin::RealBin; use Def; # This helper script automatically updates debram's version number in # several files (the files are named in the following block). At the # top of debian/changelog, it begins a new template entry. Example # usage: # # $ update-ver 0.6.2 # # See helper/update-date for further notes. # # our $pat_ver = qr/(?"; $changelog_entry = <; my @fh = ; my @dl =
; my @cl = ; close DT; close FH; close DL; close CL; $dt[8] =~ s/^(Version )$pat_ver(,)/$1$ver$2/ or warn "$warn_msg${Def::debram_txt}\n"; { my $i = 0; ++$i until $i > $#fh || $fh[$i] =~ s/^(#define VERSION\s+")$pat_ver(")/$1$ver$2/; $i <= $#fh or warn "$warn_msg${Def::def_h}\n"; } { my $i = 0; ++$i until $i > $#dl || $dl[$i] =~ /^DATA\s*$/; ++$i until $i > $#dl || $dl[$i] =~ /^The version number is\s*$/; $i += 2; $i <= $#dl && $dl[$i] =~ s/^( )(\S(?:.*?\S)??)\s*$/$1$ver\n/ or warn "$warn_msg${Def::descloc}\n"; } unshift @cl, $changelog_entry; open DT, '>', ${Def::debram_txt}; open FH, '>', ${Def::def_h}; open DL, '>', ${Def::descloc}; open CL, '>', ${Def::changelog}; print DT @dt; print FH @fh; print DL @dl; print CL @cl; close DT; close FH; close DL; close CL;