diff options
author | ng0 <ng0@n0.is> | 2019-12-01 23:19:58 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-12-01 23:19:58 +0000 |
commit | d9132e1cba66b5455a627251f377cd95eb008fc1 (patch) | |
tree | d826c9e7793e6c0161d40bc56b577448f22c653c | |
parent | 93330d9c6d8d5c599a2f12d641c5029aab91d3ad (diff) | |
download | gnunet-d9132e1cba66b5455a627251f377cd95eb008fc1.tar.gz gnunet-d9132e1cba66b5455a627251f377cd95eb008fc1.zip |
convert texinfo checks to proper awk script, add detection for awk/gawk,
remove obsolete code.
-rw-r--r-- | Makefile.am | 26 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | contrib/scripts/.gitignore | 1 | ||||
-rw-r--r-- | contrib/scripts/Makefile.am | 12 | ||||
-rwxr-xr-x | 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: | |||
73 | # exception to add: ignore license files. | 73 | # exception to add: ignore license files. |
74 | # exception to add: uref's can go above 79 chars. | 74 | # exception to add: uref's can go above 79 chars. |
75 | check-texinfo: | 75 | check-texinfo: |
76 | printf "Running basic texinfo linters\n" | 76 | @cd $(top_srcdir); find . -type f ! -path '*/.*' -name '*.texi' -print0 | xargs -0 ./contrib/scripts/check-texinfo.awk > $(srcdir)/texinfo_lint.log || true |
77 | printf "...lines containing tabstops?\n" 2>&1 | tee $(top_srcdir)/doc/handbook/texinfo_handbook.log || true | ||
78 | printf "...lines containing tabstops?\n" 2>&1 | tee $(top_srcdir)/doc/tutorial/texinfo_tutorial.log || true | ||
79 | @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 | ||
80 | @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 | ||
81 | printf "...line length over 79 chars?\n" 2>&1 | tee $(top_srcdir)/doc/handbook/texinfo_handbook.log || true | ||
82 | @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 | ||
83 | printf "...line length over 79 chars?\n" 2>&1 | tee $(top_srcdir)/doc/tutorial/texinfo_tutorial.log || true | ||
84 | @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 | ||
85 | printf "...lines containing macros incompatible with old makeinfo?\n" 2>&1 | tee -a $(top_srcdir)/doc/handbook/texinfo_handbook.log || true | ||
86 | @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 | ||
87 | printf "...lines containing macros incompatible with old makeinfo?\n" 2>&1 | tee -a $(top_srcdir)/doc/tutorial/texinfo_tutorial.log || true | ||
88 | @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 | ||
89 | printf "...lines containing macros incompatible with texi2mdoc?\n" 2>&1 | tee -a $(top_srcdir)/doc/handbook/texinfo_handbook.log || true | ||
90 | @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 | ||
91 | printf "...lines containing macros incompatible with texi2mdoc?\n" 2>&1 | tee -a $(top_srcdir)/doc/tutorial/texinfo_tutorial.log || true | ||
92 | @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 | ||
93 | printf "...lines telling us what is left TODO or to fix?\n" 2>&1 | tee -a $(top_srcdir)/doc/handbook/texinfo_handbook.log || true | ||
94 | @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 | ||
95 | @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 | ||
96 | printf "...lines telling us what is left TODO or to fix?\n" 2>&1 | tee -a $(top_srcdir)/doc/tutorial/texinfo_tutorial.log || true | ||
97 | @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 | ||
98 | @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 | ||
99 | printf "...lines containing a popular typo\n" 2>&1 | tee -a $(top_srcdir)/lint.log || true | ||
100 | @cd $(top_srcdir) ; find . -type f ! -path '*/.*' -name '*' -print0 | xargs -0 awk '/wether/ {print FILENAME":"NR":"$$0}' >> $(srcdir)/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"], | |||
251 | [AC_DEFINE_UNQUOTED([HAVE_PERL], [1], [Path to Perl])], | 251 | [AC_DEFINE_UNQUOTED([HAVE_PERL], [1], [Path to Perl])], |
252 | [AC_DEFINE_UNQUOTED([HAVE_PERL], [0], [Path to Perl])]) | 252 | [AC_DEFINE_UNQUOTED([HAVE_PERL], [0], [Path to Perl])]) |
253 | 253 | ||
254 | # awk | ||
255 | AC_PATH_PROGS( AWK_BINARY, [awk gawk], ,$PATH:/usr/bin/:/usr/local/bin ) | ||
256 | AC_SUBST([AWK_BINARY]) | ||
257 | |||
254 | # should we install gnunet-logread? | 258 | # should we install gnunet-logread? |
255 | AC_MSG_CHECKING(whether to install gnunet-logread) | 259 | AC_MSG_CHECKING(whether to install gnunet-logread) |
256 | AC_ARG_WITH([gnunet-logread], | 260 | 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 @@ | |||
1 | gnunet-chk.py | 1 | gnunet-chk.py |
2 | removetrailingwhitespace.py | 2 | removetrailingwhitespace.py |
3 | 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 = \ | |||
9 | removetrailingwhitespace.py \ | 9 | removetrailingwhitespace.py \ |
10 | gnunet_pyexpect.py \ | 10 | gnunet_pyexpect.py \ |
11 | gnunet_janitor.py \ | 11 | gnunet_janitor.py \ |
12 | gnunet-chk.py | 12 | gnunet-chk.py \ |
13 | check-texinfo.awk | ||
13 | 14 | ||
14 | bin_SCRIPTS = \ | 15 | bin_SCRIPTS = \ |
15 | gnunet-bugreport \ | 16 | gnunet-bugreport \ |
@@ -24,12 +25,13 @@ EXTRA_DIST = \ | |||
24 | $(SCRIPTS) \ | 25 | $(SCRIPTS) \ |
25 | removetrailingwhitespace.py.in \ | 26 | removetrailingwhitespace.py.in \ |
26 | pydiffer.py.in \ | 27 | pydiffer.py.in \ |
27 | gnunet-suidfix | 28 | gnunet-suidfix \ |
29 | check-texinfo.awk.in | ||
28 | 30 | ||
29 | CLEANFILES = \ | 31 | CLEANFILES = \ |
30 | $(noinst_SCRIPTS) | 32 | $(noinst_SCRIPTS) |
31 | 33 | ||
32 | do_subst = $(AWK) -v py="$(PYTHON)" '{gsub("@PYTHONEXE@",py); print $$0}' | 34 | do_subst = $(AWK) -v py="$(PYTHON)" -v awkay="$(AWK_BINARY)" '{if (/@AWKEXE@/) { gsub("@AWKEXE@",awkay)}; gsub("@PYTHONEXE@",py); print $$0}' |
33 | 35 | ||
34 | # Use SUFFIX Extension rules, they are more portable for every | 36 | # Use SUFFIX Extension rules, they are more portable for every |
35 | # implementation of 'make'. | 37 | # implementation of 'make'. |
@@ -46,3 +48,7 @@ SUFFIXES = .py.in .py | |||
46 | .py.in.py: | 48 | .py.in.py: |
47 | $(do_subst) < $< > $@ | 49 | $(do_subst) < $< > $@ |
48 | chmod +x $@ | 50 | chmod +x $@ |
51 | |||
52 | check-texinfo.awk: check-texinfo.awk.in Makefile | ||
53 | $(do_subst) < $(srcdir)/check-texinfo.awk.in > check-texinfo.awk | ||
54 | 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 @@ | |||
1 | #!@AWKEXE@ -f | ||
2 | |||
3 | # Dedicated to the Public Domain. | ||
4 | # SPDX-License-Identifier: 0BSD | ||
5 | |||
6 | BEGIN { | ||
7 | printf "Running basic texinfo linters\n" ; | ||
8 | } | ||
9 | |||
10 | { | ||
11 | if(/\t/) { | ||
12 | printf "...lines containing tabstops?\n" ; | ||
13 | print FILENAME":"NR":"$0 ; | ||
14 | } | ||
15 | } | ||
16 | |||
17 | { | ||
18 | if(length>79) { | ||
19 | printf "...line length over 79 chars?\n" ; | ||
20 | print FILENAME":"NR":"$0 ; | ||
21 | } | ||
22 | } | ||
23 | |||
24 | { | ||
25 | if(/@geq\{\}/) { | ||
26 | printf "...lines containing macros incompatible with old makeinfo?\n" ; | ||
27 | print FILENAME":"NR":"$0 ; | ||
28 | } | ||
29 | } | ||
30 | |||
31 | { | ||
32 | if (/@footnote\{/) { | ||
33 | printf "...lines containing macros incompatible with texi2mdoc?\n" ; | ||
34 | print FILENAME":"NR":"$0 ; | ||
35 | } | ||
36 | } | ||
37 | |||
38 | { | ||
39 | if (/TODO/) { | ||
40 | printf "...lines telling us what is left TODO?\n" ; | ||
41 | print FILENAME":"NR":"$0 ; | ||
42 | } | ||
43 | |||
44 | if (/XXX/) { | ||
45 | printf "...lines telling us what is left to fix?\n" ; | ||
46 | print FILENAME":"NR":"$0 ; | ||
47 | } | ||
48 | } | ||
49 | |||
50 | { | ||
51 | if (/wether/) { | ||
52 | printf "...lines containing a popular typo\n" ; | ||
53 | print FILENAME":"NR":"$0 ; | ||
54 | } | ||
55 | } | ||