File replace-version.pl of Package zeek-rc
#!/usr/bin/env perl
use 5.14.1;
use strict;
use warnings;
use Carp;
my $fullversion;
my $version;
my $release;
{
open(my $fh, '<', 'VERSION') or die ("Could not open VERSION");
local $/ = undef;
my $file = <$fh>;
close $fh;
unless ( $file =~ m#^(\d+\.\d+(\.\d)?)(-(\d+))?# ) {
croak "Cannot parse version $file";
}
$fullversion = $file;
$version = $1;
$release = $4;
$release //= 0;
}
chomp($fullversion);
while ( my $line = <> ) {
$line =~ s/%FULLVERSION%/$fullversion/g;
$line =~ s/%VERSION%/$version/g;
$line =~ s/%RELEASE%/$release/g;
$line =~ s/%KIND%/-rc/g;
$line =~ s/%PATHPOSTFIX%/-rc/g;
if ( $line =~ m#^%DEBIANCONFLICTS# ) {
next;
} elsif ( $line =~ m#^%RPMCONFLICTS# ) {
next;
}
print $line;
}