summaryrefslogtreecommitdiffstats
path: root/package/libldns/0003-let-doxyparse-output-manpage-generation-issues.patch
blob: 223ebe98b33bbabc2ad2ca439bf3f039a8cdaa8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
From d8a3da12be085fbc92e3d4d4d084c328fc37485a Mon Sep 17 00:00:00 2001
From: Willem Toorop <willem@nlnetlabs.nl>
Date: Thu, 27 Nov 2014 16:21:54 +0100
Subject: [PATCH] let doxyparse output manpage generation issues

[Backport from upstream commit
168ee09a4bf184947798c3ee3ac99b6651470d64, fixes the build with Perl
5.22.]
Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
---
 doc/doxyparse.pl | 45 ++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 38 insertions(+), 7 deletions(-)

diff --git a/doc/doxyparse.pl b/doc/doxyparse.pl
index 96a1732..a09b2e8 100755
--- a/doc/doxyparse.pl
+++ b/doc/doxyparse.pl
@@ -57,10 +57,15 @@ This manpage was automaticly generated from the ldns source code by
 use of Doxygen and some perl.
 ";
 
-getopts("m:",\%options);
+getopts("em:",\%options);
 # if -m manpage file is given process that file
 # parse the file which tells us what manpages go together
 my $functions, $see_also;
+my $i = -1;
+my $report_errors = defined $options{'e'};
+my $errors = 0;
+my %unique;
+
 if (defined $options{'m'}) {
 	# process
 	open(MAN, "<$options{'m'}") or die "Cannot open $options{'m'}";
@@ -68,18 +73,35 @@ if (defined $options{'m'}) {
 		# func1, func2, .. | see_also1, see_also2, ...
 		while(<MAN>) {
 			chomp;
+			$i += 1;
 			if (/^#/) { next; }
 			if (/^$/) { next; }
-			($functions, $see_also) = split /[\t ]*\|[\t ]*/, $_;
-			#print "{$functions}\n";
-			#print "{$see_also}\n";
+			my @parts = split /[\t ]*\|[\t ]*/, $_;
+			$functions = shift @parts;
+			$see_also = join ', ', @parts;
+			print "{$functions}\n";
+			print "{$see_also}\n";
 			my @funcs = split /[\t ]*,[\t ]*/, $functions;
 			my @also = split /[\t ]*,[\t ]*/, $see_also;
 			$manpages{$funcs[0]} = \@funcs;
 			$see_also{$funcs[0]} = \@also;
+			foreach (@funcs) {
+				if ($unique{$_}) {
+					push $unique{$_}, ($i,);
+				} else {
+					$unique{$_} = [$i];
+				}
+			}
 			#print "[", $funcs[0], "]\n";
 		}
 	close(MAN);
+	while (($func, $lines) = each %unique ) {
+		if (scalar @$lines > 1) {
+			print STDERR "$func in function_manpages on lines: "
+			    . join(", ",@$lines) . "\n" if $report_errors;
+			$errors += 1;
+		}
+	}
 } else {
 	print "Need -m file to process the .h files\n";
 	exit 1;
@@ -95,7 +117,7 @@ mkdir "doc/man";
 mkdir "doc/man/man$MAN_SECTION";
 
 $state = 0;
-my $i;
+$i = 0;
 my @lines = <STDIN>;
 my $max = @lines;
 
@@ -273,7 +295,7 @@ foreach (keys %manpages) {
 
 	print MAN $MAN_MIDDLE;
 
-	if (defined(@$also)) {
+	if (@$also) {
 		print MAN "\n.SH SEE ALSO\n\\fI";
 		print MAN join "\\fR, \\fI", @$also;
 		print MAN "\\fR.\nAnd ";
@@ -290,7 +312,7 @@ foreach (keys %manpages) {
 	# create symlinks
 	chdir("$BASE/man$MAN_SECTION");
 	foreach (@$name) {
-		print STDERR $_,"\n";
+		print STDOUT $_,"\n";
 		my $new_file = $_ . "." . $MAN_SECTION;
 		if ($new_file eq $symlink_file) {
 			next;
@@ -301,3 +323,12 @@ foreach (keys %manpages) {
 	chdir("../../.."); # and back, tricky and fragile...
 	close(MAN);
 }
+foreach (keys %api) {
+	next if (/ / || /^$/);
+	if (not $unique{$_}) {
+		print STDERR "no man page for $_\n" if $report_errors;
+		$errors += 1;
+	}
+}
+
+exit ($report_errors and $errors != 0);
-- 
2.6.4

OpenPOWER on IntegriCloud