mirror of
https://github.com/rfc1036/whois.git
synced 2026-05-03 06:51:09 +00:00
Extract the version number from the changelog
This commit is contained in:
parent
bc35c3c585
commit
d2ee7af1d7
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
*_del.h
|
||||
tld_serv.h
|
||||
servers_charset.h
|
||||
version.h
|
||||
|
||||
Makefile.depend
|
||||
*.o
|
||||
|
||||
3
Makefile
3
Makefile
@ -69,6 +69,9 @@ mkpasswd: $(mkpasswd_OBJECTS)
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(mkpasswd_LDADD) $(LIBS)
|
||||
|
||||
##############################################################################
|
||||
version.h: debian/changelog make_version_h.pl
|
||||
$(PERL) -w make_version_h.pl $< > $@
|
||||
|
||||
as_del.h: as_del_list make_as_del.pl
|
||||
$(PERL) -w make_as_del.pl < $< > $@
|
||||
|
||||
|
||||
3
config.h
3
config.h
@ -1,6 +1,3 @@
|
||||
/* Program version */
|
||||
#define VERSION "5.1.1"
|
||||
|
||||
/* Configurable features */
|
||||
|
||||
/* Always hide legal disclaimers */
|
||||
|
||||
23
make_version_h.pl
Executable file
23
make_version_h.pl
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
my $changelog = $ARGV[0] or die "Usage: $0 debian/changelog\n";
|
||||
|
||||
open(my $fh, '<', $changelog) or die "open($changelog): $!";
|
||||
my $line = <$fh>;
|
||||
close($fh) or die "close($changelog): $!";
|
||||
|
||||
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+ ) $//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.
|
||||
die "Invalid version number in $changelog!\n"
|
||||
unless $ver =~ /^ \d+\.\d+ ( \.\d+ )? $/x;
|
||||
|
||||
print qq|#define VERSION "$ver"\n|;
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
#endif
|
||||
|
||||
/* Application-specific */
|
||||
#include "version.h"
|
||||
#include "utils.h"
|
||||
|
||||
/* Global variables */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user