gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] branch master updated: convert texinfo checks to proper awk scr


From: gnunet
Subject: [gnunet] branch master updated: convert texinfo checks to proper awk script, add detection for awk/gawk, remove obsolete code.
Date: Mon, 02 Dec 2019 00:23:41 +0100

This is an automated email from the git hooks/post-receive script.

ng0 pushed a commit to branch master
in repository gnunet.

The following commit(s) were added to refs/heads/master by this push:
     new d9132e1cb convert texinfo checks to proper awk script, add detection 
for awk/gawk, remove obsolete code.
d9132e1cb is described below

commit d9132e1cba66b5455a627251f377cd95eb008fc1
Author: ng0 <address@hidden>
AuthorDate: Sun Dec 1 23:19:58 2019 +0000

    convert texinfo checks to proper awk script, add detection for awk/gawk,
    remove obsolete code.
---
 Makefile.am                          | 26 +----------------
 configure.ac                         |  4 +++
 contrib/scripts/.gitignore           |  1 +
 contrib/scripts/Makefile.am          | 12 ++++++--
 contrib/scripts/check-texinfo.awk.in | 55 ++++++++++++++++++++++++++++++++++++
 5 files changed, 70 insertions(+), 28 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index a5b12bad9..aea6c2f6c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -73,28 +73,4 @@ check-python:
 # exception to add: ignore license files.
 # exception to add: uref's can go above 79 chars.
 check-texinfo:
-       printf "Running basic texinfo linters\n"
-       printf "...lines containing tabstops?\n" 2>&1 | tee 
$(top_srcdir)/doc/handbook/texinfo_handbook.log || true
-       printf "...lines containing tabstops?\n" 2>&1 | tee 
$(top_srcdir)/doc/tutorial/texinfo_tutorial.log || true
-       @cd $(top_srcdir)/doc/handbook ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk '/\t/ {print FILENAME":"NR":"$$0}' > 
$(srcdir)/texinfo_handbook.log || true
-       @cd $(top_srcdir)/doc/tutorial ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk '/\t/ {print FILENAME":"NR":"$$0}' > 
$(srcdir)/texinfo_tutorial.log || true
-       printf "...line length over 79 chars?\n" 2>&1 | tee 
$(top_srcdir)/doc/handbook/texinfo_handbook.log || true
-       @cd $(top_srcdir)/doc/handbook ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk 'length>79 {print FILENAME":"NR":"$$0}' > 
$(srcdir)/texinfo_handbook.log || true
-       printf "...line length over 79 chars?\n" 2>&1 | tee 
$(top_srcdir)/doc/tutorial/texinfo_tutorial.log || true
-       @cd $(top_srcdir)/doc/tutorial ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk 'length>79 {print FILENAME":"NR":"$$0}' > 
$(srcdir)/texinfo_tutorial.log || true
-       printf "...lines containing macros incompatible with old makeinfo?\n" 
2>&1 | tee -a $(top_srcdir)/doc/handbook/texinfo_handbook.log || true
-       @cd $(top_srcdir)/doc/handbook ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk '/@geq\{\}/ {print FILENAME":"NR":"$$0}' >> 
$(srcdir)/texinfo_handbook.log || true
-       printf "...lines containing macros incompatible with old makeinfo?\n" 
2>&1 | tee -a $(top_srcdir)/doc/tutorial/texinfo_tutorial.log || true
-       @cd $(top_srcdir)/doc/tutorial ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk '/@geq\{\}/ {print FILENAME":"NR":"$$0}' >> 
$(srcdir)/texinfo_tutorial.log || true
-       printf "...lines containing macros incompatible with texi2mdoc?\n" 2>&1 
| tee -a $(top_srcdir)/doc/handbook/texinfo_handbook.log || true
-       @cd $(top_srcdir)/doc/handbook ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk '/@footnote\{/ {print FILENAME":"NR":"$$0}' >> 
$(srcdir)/texinfo_handbook.log || true
-       printf "...lines containing macros incompatible with texi2mdoc?\n" 2>&1 
| tee -a $(top_srcdir)/doc/tutorial/texinfo_tutorial.log || true
-       @cd $(top_srcdir)/doc/tutorial ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk '/@footnote\{/ {print FILENAME":"NR":"$$0}' >> 
$(srcdir)/texinfo_tutorial.log || true
-       printf "...lines telling us what is left TODO or to fix?\n" 2>&1 | tee 
-a $(top_srcdir)/doc/handbook/texinfo_handbook.log || true
-       @cd $(top_srcdir)/doc/handbook ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk '/TODO/ {print FILENAME":"NR":"$$0}' >> 
$(srcdir)/texinfo_handbook.log || true
-       @cd $(top_srcdir)/doc/handbook ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk '/XXX/ {print FILENAME":"NR":"$$0}' >> 
$(srcdir)/texinfo_handbook.log || true
-       printf "...lines telling us what is left TODO or to fix?\n" 2>&1 | tee 
-a $(top_srcdir)/doc/tutorial/texinfo_tutorial.log || true
-       @cd $(top_srcdir)/doc/tutorial ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk '/TODO/ {print FILENAME":"NR":"$$0}' >> 
$(srcdir)/texinfo_tutorial.log || true
-       @cd $(top_srcdir)/doc/tutorial ; find . -type f ! -path '*/.*' -name 
'*.texi' -print0 | xargs -0 awk '/XXX/ {print FILENAME":"NR":"$$0}' >> 
$(srcdir)/texinfo_tutorial.log || true
-       printf "...lines containing a popular typo\n" 2>&1 | tee -a 
$(top_srcdir)/lint.log || true
-       @cd $(top_srcdir) ; find . -type f ! -path '*/.*' -name '*' -print0 | 
xargs -0 awk '/wether/ {print FILENAME":"NR":"$$0}' >> $(srcdir)/lint.log || 
true
+       @cd $(top_srcdir); find . -type f ! -path '*/.*' -name '*.texi' -print0 
| xargs -0 ./contrib/scripts/check-texinfo.awk > $(srcdir)/texinfo_lint.log || 
true
diff --git a/configure.ac b/configure.ac
index ad59c9231..e8a450b61 100644
--- a/configure.ac
+++ b/configure.ac
@@ -251,6 +251,10 @@ AS_IF([test -x "$PERL"],
   [AC_DEFINE_UNQUOTED([HAVE_PERL], [1], [Path to Perl])],
   [AC_DEFINE_UNQUOTED([HAVE_PERL], [0], [Path to Perl])])
 
+# awk
+AC_PATH_PROGS( AWK_BINARY, [awk gawk], ,$PATH:/usr/bin/:/usr/local/bin )
+AC_SUBST([AWK_BINARY])
+
 # should we install gnunet-logread?
 AC_MSG_CHECKING(whether to install gnunet-logread)
 AC_ARG_WITH([gnunet-logread],
diff --git a/contrib/scripts/.gitignore b/contrib/scripts/.gitignore
index 547c89185..3b34b9b69 100644
--- a/contrib/scripts/.gitignore
+++ b/contrib/scripts/.gitignore
@@ -1,2 +1,3 @@
 gnunet-chk.py
 removetrailingwhitespace.py
+check-texinfo.awk
diff --git a/contrib/scripts/Makefile.am b/contrib/scripts/Makefile.am
index 367e5c4c9..b76e57db7 100644
--- a/contrib/scripts/Makefile.am
+++ b/contrib/scripts/Makefile.am
@@ -9,7 +9,8 @@ noinst_SCRIPTS = \
  removetrailingwhitespace.py \
  gnunet_pyexpect.py \
  gnunet_janitor.py \
- gnunet-chk.py
+ gnunet-chk.py \
+ check-texinfo.awk
 
 bin_SCRIPTS = \
  gnunet-bugreport \
@@ -24,12 +25,13 @@ EXTRA_DIST = \
  $(SCRIPTS) \
  removetrailingwhitespace.py.in \
  pydiffer.py.in \
- gnunet-suidfix
+ gnunet-suidfix \
+ check-texinfo.awk.in
 
 CLEANFILES = \
   $(noinst_SCRIPTS)
 
-do_subst = $(AWK) -v py="$(PYTHON)" '{gsub("@PYTHONEXE@",py); print $$0}'
+do_subst = $(AWK) -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" '{if (/@AWKEXE@/) 
{ gsub("@AWKEXE@",awkay)}; gsub("@PYTHONEXE@",py); print $$0}'
 
 # Use SUFFIX Extension rules, they are more portable for every
 # implementation of 'make'.
@@ -46,3 +48,7 @@ SUFFIXES = .py.in .py
 .py.in.py:
        $(do_subst) < $< > $@
        chmod +x $@
+
+check-texinfo.awk: check-texinfo.awk.in Makefile
+       $(do_subst) < $(srcdir)/check-texinfo.awk.in > check-texinfo.awk
+       chmod +x check-texinfo.awk
diff --git a/contrib/scripts/check-texinfo.awk.in 
b/contrib/scripts/check-texinfo.awk.in
new file mode 100755
index 000000000..12f71b5d2
--- /dev/null
+++ b/contrib/scripts/check-texinfo.awk.in
@@ -0,0 +1,55 @@
+#!@AWKEXE@ -f
+
+# Dedicated to the Public Domain.
+# SPDX-License-Identifier: 0BSD
+
+BEGIN {
+  printf "Running basic texinfo linters\n" ;
+}
+
+{
+    if(/\t/) {
+      printf "...lines containing tabstops?\n" ;
+      print FILENAME":"NR":"$0 ;
+    }
+}
+
+{
+    if(length>79) {
+      printf "...line length over 79 chars?\n" ;
+      print FILENAME":"NR":"$0 ;
+    }
+}
+
+{
+  if(/@geq\{\}/) {
+    printf "...lines containing macros incompatible with old makeinfo?\n" ;
+    print FILENAME":"NR":"$0 ;
+  }
+}
+
+{
+  if (/@footnote\{/) {
+    printf "...lines containing macros incompatible with texi2mdoc?\n" ;
+    print FILENAME":"NR":"$0 ;
+  }
+}
+
+{
+  if (/TODO/) {
+    printf "...lines telling us what is left TODO?\n" ;
+    print FILENAME":"NR":"$0 ;
+  }
+
+  if (/XXX/) {
+    printf "...lines telling us what is left to fix?\n" ;
+    print FILENAME":"NR":"$0 ;
+  }
+}
+
+{
+  if (/wether/) {
+    printf "...lines containing a popular typo\n" ;
+    print FILENAME":"NR":"$0 ;
+  }
+}

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]