[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Make `check-docs` work from out-of-tree builds.



commit eeb753e87115a7b19cc7de83c061fa5e599acb81
Author: cypherpunks <cypherpunks@xxxxxxxxxxxxxx>
Date:   Wed Mar 11 10:47:13 2015 +0100

    Make `check-docs` work from out-of-tree builds.
---
 Makefile.am                         |    4 +-
 configure.ac                        |    3 ++
 scripts/maint/checkOptionDocs.pl    |   71 -----------------------------------
 scripts/maint/checkOptionDocs.pl.in |   69 ++++++++++++++++++++++++++++++++++
 4 files changed, 74 insertions(+), 73 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 56a1a01..4527dd1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -109,8 +109,8 @@ check-spaces:
 		$(top_srcdir)/src/tools/*.[ch] \
 		$(top_srcdir)/src/tools/tor-fw-helper/*.[ch]
 
-check-docs:
-	$(top_srcdir)/scripts/maint/checkOptionDocs.pl
+check-docs: all
+	$(PERL) $(top_builddir)/scripts/maint/checkOptionDocs.pl
 
 check-logs:
 	$(top_srcdir)/scripts/maint/checkLogs.pl \
diff --git a/configure.ac b/configure.ac
index 1109a4b..3ba6868 100644
--- a/configure.ac
+++ b/configure.ac
@@ -215,6 +215,8 @@ AC_PROG_CPP
 AC_PROG_MAKE_SET
 AC_PROG_RANLIB
 
+AC_PATH_PROG([PERL], [perl])
+
 dnl autoconf 2.59 appears not to support AC_PROG_SED
 AC_CHECK_PROG([SED],[sed],[sed],[/bin/false])
 
@@ -1661,6 +1663,7 @@ AC_CONFIG_FILES([
         contrib/dist/tor.service
         src/config/torrc.sample
         src/config/torrc.minimal
+        scripts/maint/checkOptionDocs.pl
 ])
 
 if test x$asciidoc = xtrue && test "$ASCIIDOC" = "none" ; then
diff --git a/scripts/maint/checkOptionDocs.pl b/scripts/maint/checkOptionDocs.pl
deleted file mode 100755
index 94307c6..0000000
--- a/scripts/maint/checkOptionDocs.pl
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/usr/bin/perl -w
-use strict;
-
-my %options = ();
-my %descOptions = ();
-my %torrcSampleOptions = ();
-my %manPageOptions = ();
-
-# Load the canonical list as actually accepted by Tor.
-open(F, "./src/or/tor --list-torrc-options |") or die;
-while (<F>) {
-    next if m!\[notice\] Tor v0\.!;
-    if (m!^([A-Za-z0-9_]+)!) {
-        $options{$1} = 1;
-    } else {
-        print "Unrecognized output> ";
-        print;
-    }
-}
-close F;
-
-# Load the contents of torrc.sample
-sub loadTorrc {
-    my ($fname, $options) = @_;
-    local *F;
-    open(F, "$fname") or die;
-    while (<F>) {
-        next if (m!##+!);
-        if (m!#([A-Za-z0-9_]+)!) {
-            $options->{$1} = 1;
-        }
-    }
-    close F;
-    0;
-}
-
-loadTorrc("./src/config/torrc.sample.in", \%torrcSampleOptions);
-
-# Try to figure out what's in the man page.
-
-my $considerNextLine = 0;
-open(F, "./doc/tor.1.txt") or die;
-while (<F>) {
-    if (m!^(?:\[\[([A-za-z0-9_]+)\]\] *)?\*\*([A-Za-z0-9_]+)\*\*!) {
-        $manPageOptions{$2} = 1;
-	print "Missing an anchor: $2\n" unless (defined $1 or $2 eq 'tor');
-    }
-}
-close F;
-
-# Now, display differences:
-
-sub subtractHashes {
-    my ($s, $a, $b) = @_;
-    my @lst = ();
-    for my $k (keys %$a) {
-        push @lst, $k unless (exists $b->{$k});
-    }
-    print "$s: ", join(' ', sort @lst), "\n\n";
-    0;
-}
-
-# subtractHashes("No online docs", \%options, \%descOptions);
-# subtractHashes("Orphaned online docs", \%descOptions, \%options);
-
-subtractHashes("Orphaned in torrc.sample.in", \%torrcSampleOptions, \%options);
-
-subtractHashes("Not in man page", \%options, \%manPageOptions);
-subtractHashes("Orphaned in man page", \%manPageOptions, \%options);
-
-
diff --git a/scripts/maint/checkOptionDocs.pl.in b/scripts/maint/checkOptionDocs.pl.in
new file mode 100644
index 0000000..1f53adf
--- /dev/null
+++ b/scripts/maint/checkOptionDocs.pl.in
@@ -0,0 +1,69 @@
+#!/usr/bin/perl -w
+use strict;
+
+my %options = ();
+my %descOptions = ();
+my %torrcSampleOptions = ();
+my %manPageOptions = ();
+
+# Load the canonical list as actually accepted by Tor.
+open(F, "@abs_top_builddir@/src/or/tor --list-torrc-options |") or die;
+while (<F>) {
+    next if m!\[notice\] Tor v0\.!;
+    if (m!^([A-Za-z0-9_]+)!) {
+        $options{$1} = 1;
+    } else {
+        print "Unrecognized output> ";
+        print;
+    }
+}
+close F;
+
+# Load the contents of torrc.sample
+sub loadTorrc {
+    my ($fname, $options) = @_;
+    local *F;
+    open(F, "$fname") or die;
+    while (<F>) {
+        next if (m!##+!);
+        if (m!#([A-Za-z0-9_]+)!) {
+            $options->{$1} = 1;
+        }
+    }
+    close F;
+    0;
+}
+
+loadTorrc("@abs_top_srcdir@/src/config/torrc.sample.in", \%torrcSampleOptions);
+
+# Try to figure out what's in the man page.
+
+my $considerNextLine = 0;
+open(F, "@abs_top_srcdir@/doc/tor.1.txt") or die;
+while (<F>) {
+    if (m!^(?:\[\[([A-za-z0-9_]+)\]\] *)?\*\*([A-Za-z0-9_]+)\*\*!) {
+        $manPageOptions{$2} = 1;
+	print "Missing an anchor: $2\n" unless (defined $1 or $2 eq 'tor');
+    }
+}
+close F;
+
+# Now, display differences:
+
+sub subtractHashes {
+    my ($s, $a, $b) = @_;
+    my @lst = ();
+    for my $k (keys %$a) {
+        push @lst, $k unless (exists $b->{$k});
+    }
+    print "$s: ", join(' ', sort @lst), "\n\n";
+    0;
+}
+
+# subtractHashes("No online docs", \%options, \%descOptions);
+# subtractHashes("Orphaned online docs", \%descOptions, \%options);
+
+subtractHashes("Orphaned in torrc.sample.in", \%torrcSampleOptions, \%options);
+
+subtractHashes("Not in man page", \%options, \%manPageOptions);
+subtractHashes("Orphaned in man page", \%manPageOptions, \%options);



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits