aboutsummaryrefslogtreecommitdiff
path: root/contrib/scripts
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-12-01 23:19:58 +0000
committerng0 <ng0@n0.is>2019-12-01 23:19:58 +0000
commitd9132e1cba66b5455a627251f377cd95eb008fc1 (patch)
treed826c9e7793e6c0161d40bc56b577448f22c653c /contrib/scripts
parent93330d9c6d8d5c599a2f12d641c5029aab91d3ad (diff)
downloadgnunet-d9132e1cba66b5455a627251f377cd95eb008fc1.tar.gz
gnunet-d9132e1cba66b5455a627251f377cd95eb008fc1.zip
convert texinfo checks to proper awk script, add detection for awk/gawk,
remove obsolete code.
Diffstat (limited to 'contrib/scripts')
-rw-r--r--contrib/scripts/.gitignore1
-rw-r--r--contrib/scripts/Makefile.am12
-rwxr-xr-xcontrib/scripts/check-texinfo.awk.in55
3 files changed, 65 insertions, 3 deletions
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 @@
1gnunet-chk.py 1gnunet-chk.py
2removetrailingwhitespace.py 2removetrailingwhitespace.py
3check-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
14bin_SCRIPTS = \ 15bin_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
29CLEANFILES = \ 31CLEANFILES = \
30 $(noinst_SCRIPTS) 32 $(noinst_SCRIPTS)
31 33
32do_subst = $(AWK) -v py="$(PYTHON)" '{gsub("@PYTHONEXE@",py); print $$0}' 34do_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
52check-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
6BEGIN {
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}