summaryrefslogtreecommitdiff
path: root/make_version_h.pl
diff options
context:
space:
mode:
Diffstat (limited to 'make_version_h.pl')
-rwxr-xr-xmake_version_h.pl12
1 files changed, 9 insertions, 3 deletions
diff --git a/make_version_h.pl b/make_version_h.pl
index ae9956a..51a8f76 100755
--- a/make_version_h.pl
+++ b/make_version_h.pl
@@ -2,22 +2,28 @@
use warnings;
use strict;
+use autodie;
my $changelog = $ARGV[0] or die "Usage: $0 debian/changelog\n";
-open(my $fh, '<', $changelog) or die "open($changelog): $!";
+open(my $fh, '<', $changelog);
my $line = <$fh>;
-close($fh) or die "close($changelog): $!";
+close($fh);
my ($ver) = $line =~ /^whois \s+ \( ( [^\)]+ ) \) \s+ \S+/x;
die "Version number not found in $changelog!\n" if not $ver;
-$ver =~ s/ ( ~deb\d+.* | ubuntu\d+ | \+dyson\d+ ) $//x;
+$ver =~ s/ ( ~bpo\d+\+\d+ | \+b\d+ | ~deb\d+.* | ubuntu\d+ | \+dyson\d+ ) $//x;
# The version number must not deviate from this format or the -V option
# to RIPE-like servers will break. If needed, update the previous regexp.
+# This may not be true anymore in 2019.
die "Invalid version number in $changelog!\n"
unless $ver =~ /^ \d+\.\d+ ( \.\d+ )? $/x;
+# This is the version number used in the help messages.
print qq|#define VERSION "$ver"\n|;
+# This is the string sent to RIPE-like servers as the argument of -V.
+print qq|#define IDSTRING "Md$ver"\n|;
+