"Fossies" - the Fresh Open Source Software Archive

Member "whois/make_version_h.pl" (19 Jul 2019, 868 Bytes) of package /linux/privat/whois_5.5.9.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "make_version_h.pl" see the Fossies "Dox" file reference documentation.

    1 #!/usr/bin/perl
    2 
    3 use warnings;
    4 use strict;
    5 use autodie;
    6 
    7 my $changelog = $ARGV[0] or die "Usage: $0 debian/changelog\n";
    8 
    9 open(my $fh, '<', $changelog);
   10 my $line = <$fh>;
   11 close($fh);
   12 
   13 my ($ver) = $line =~ /^whois \s+ \( ( [^\)]+ ) \) \s+ \S+/x;
   14 die "Version number not found in $changelog!\n" if not $ver;
   15 
   16 $ver =~ s/ ( ~bpo\d+\+\d+ | \+b\d+ | ~deb\d+.* | ubuntu\d+ | \+dyson\d+ ) $//x;
   17 
   18 # The version number must not deviate from this format or the -V option
   19 # to RIPE-like servers will break. If needed, update the previous regexp.
   20 # This may not be true anymore in 2019.
   21 die "Invalid version number in $changelog!\n"
   22     unless $ver =~ /^ \d+\.\d+ ( \.\d+ )? $/x;
   23 
   24 # This is the version number used in the help messages.
   25 print qq|#define VERSION "$ver"\n|;
   26 
   27 # This is the string sent to RIPE-like servers as the argument of -V.
   28 print qq|#define IDSTRING "Md$ver"\n|;
   29