diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:11:53 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:11:53 +0000 |
commit | 655cb1b8222b0a587bbdd5c1357d55682332c665 (patch) | |
tree | 65a83d3c36e6d4c4d57cec63f63d2019b2dfc93b /make_version_h.pl | |
parent | Initial commit. (diff) | |
download | whois-655cb1b8222b0a587bbdd5c1357d55682332c665.tar.xz whois-655cb1b8222b0a587bbdd5c1357d55682332c665.zip |
Adding upstream version 5.5.21.upstream/5.5.21
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'make_version_h.pl')
-rwxr-xr-x | make_version_h.pl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/make_version_h.pl b/make_version_h.pl new file mode 100755 index 0000000..705d8a8 --- /dev/null +++ b/make_version_h.pl @@ -0,0 +1,30 @@ +#!/usr/bin/perl +# SPDX-License-Identifier: GPL-2.0-or-later + +use warnings; +use strict; +use autodie; + +my $changelog = $ARGV[0] or die "Usage: $0 debian/changelog\n"; + +open(my $fh, '<', $changelog); +my $line = <$fh>; +close($fh); + +my ($ver) = $line =~ /^whois \s+ \( ( [^\)]+ ) \) \s+ \S+/x; +die "Version number not found in $changelog!\n" if not $ver; + +$ver =~ s/ ( ~bpo\d+\+\d+ | \+b\d+ | ~deb\d+.* | ubuntu\d+ | build\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|; + |