mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
check the "configure" option list against the INSTALL-WMAKER documentation
In order to ease the job of keeping the documentation aligned against the sources, this patch adds a check of the list of options returned by "configure --help" against the options that are listed in the INSTALL-WMAKER file. The check is ran as part of "make check", which also implies it will break a "make distcheck" operation when not in line. Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
committed by
Carlos R. Mafra
parent
1ba9a8bcf5
commit
0c09d1f40d
14
Makefile.am
14
Makefile.am
@@ -85,3 +85,17 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: update-lang
|
.PHONY: update-lang
|
||||||
|
|
||||||
|
# Create a 'silent-rule' for our make check the same way automake does
|
||||||
|
AM_V_CHKOPTS = $(am__v_CHKOPTS_$(V))
|
||||||
|
am__v_CHKOPTS_ = $(am__v_CHKOPTS_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
am__v_CHKOPTS_0 = @echo " CHK $@" ;
|
||||||
|
am__v_CHKOPTS_1 =
|
||||||
|
|
||||||
|
check-local: configure-documentation
|
||||||
|
|
||||||
|
configure-documentation:
|
||||||
|
$(AM_V_CHKOPTS)$(top_srcdir)/script/check-cmdline-options-doc.sh \
|
||||||
|
--program "$(top_srcdir)/configure" --text-doc "$(top_srcdir)/INSTALL-WMAKER"
|
||||||
|
|
||||||
|
.PHONY: configure-documentation
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ print_help() {
|
|||||||
echo "valid options are:"
|
echo "valid options are:"
|
||||||
echo " --man-page file : program's documentation file, in man format"
|
echo " --man-page file : program's documentation file, in man format"
|
||||||
echo " --program name : name of the program to run with '--help'"
|
echo " --program name : name of the program to run with '--help'"
|
||||||
|
echo " --text-doc file : program's documentation file, in plain text format"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +62,7 @@ while [ $# -gt 0 ]; do
|
|||||||
case $1 in
|
case $1 in
|
||||||
--man-page)
|
--man-page)
|
||||||
shift
|
shift
|
||||||
[ -z "$man_page" ] || arg_error "only 1 documentation file can be used (option: --man-page)"
|
[ -z "$man_page$text_doc" ] || arg_error "only 1 documentation file can be used (option: --man-page)"
|
||||||
man_page="$1"
|
man_page="$1"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -71,6 +72,12 @@ while [ $# -gt 0 ]; do
|
|||||||
prog_name="$1"
|
prog_name="$1"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
--text-doc)
|
||||||
|
shift
|
||||||
|
[ -z "$man_page$text_doc" ] || arg_error "only 1 documentation file can be used (option: --text-doc)"
|
||||||
|
text_doc="$1"
|
||||||
|
;;
|
||||||
|
|
||||||
-h|-help|--help) print_help ;;
|
-h|-help|--help) print_help ;;
|
||||||
-*) arg_error "unknow option '$1'" ;;
|
-*) arg_error "unknow option '$1'" ;;
|
||||||
|
|
||||||
@@ -83,9 +90,10 @@ done
|
|||||||
|
|
||||||
# Check consistency of command-line
|
# Check consistency of command-line
|
||||||
[ -z "$prog_name" ] && arg_error "no program given (option: --program)"
|
[ -z "$prog_name" ] && arg_error "no program given (option: --program)"
|
||||||
[ -z "$man_page" ] && arg_error "no documentation given"
|
[ -z "$man_page$text_doc" ] && arg_error "no documentation given"
|
||||||
|
|
||||||
[ -z "$man_page" ] || [ -r "$man_page" ] || arg_error "man page file '$man_page' is not readable (option: --man-page)"
|
[ -z "$man_page" ] || [ -r "$man_page" ] || arg_error "man page file '$man_page' is not readable (option: --man-page)"
|
||||||
|
[ -z "$text_doc" ] || [ -r "$text_doc" ] || arg_error "text file '$text_doc' is not readable (option: --text-doc)"
|
||||||
|
|
||||||
# Make sure the program will not be searched in $PATH
|
# Make sure the program will not be searched in $PATH
|
||||||
if ! echo "$prog_name" | grep '/' > /dev/null ; then
|
if ! echo "$prog_name" | grep '/' > /dev/null ; then
|
||||||
@@ -125,11 +133,40 @@ fi
|
|||||||
# If no problem is found, we will exit with status OK
|
# If no problem is found, we will exit with status OK
|
||||||
exit_status=0
|
exit_status=0
|
||||||
|
|
||||||
|
|
||||||
|
if [ -n "$text_doc" ]; then
|
||||||
|
# In the plain-text format, there is no specific identification for the options,
|
||||||
|
# as they may be described anywhere in the document. So we first try to get
|
||||||
|
# everything that looks like a long option:
|
||||||
|
sed_script=':restart
|
||||||
|
/^\(.*[^-A-Za-z_0-9]\)*--[A-Za-z0-9]/ {
|
||||||
|
h
|
||||||
|
s/^.*--/--/
|
||||||
|
s/[^-A-Z_a-z0-9].*$//
|
||||||
|
p
|
||||||
|
|
||||||
|
g
|
||||||
|
s/^\(.*\)--[A-Za-z0-9][-A-Z_a-z0-9]*/\1/
|
||||||
|
b restart
|
||||||
|
}'
|
||||||
|
doc_options=`sed -n "$sed_script" "$text_doc" `
|
||||||
|
|
||||||
|
# then we also explicitely search for the short options we got from the program
|
||||||
|
for opt in `echo "$prog_options" | grep '^-[^-]' `
|
||||||
|
do
|
||||||
|
if grep "^\\(.*[^-A-Za-z_0-9]\\)*$opt\\([^-A-Za-z_0-9].*\\)\$" "$text_doc" > /dev/null ; then
|
||||||
|
doc_options="$doc_options
|
||||||
|
$opt"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Check that all program options are documented
|
# Check that all program options are documented
|
||||||
for opt in $prog_options
|
for opt in $prog_options
|
||||||
do
|
do
|
||||||
if ! echo "$doc_options" | grep "^$opt\$" > /dev/null ; then
|
if ! echo "$doc_options" | grep "^$opt\$" > /dev/null ; then
|
||||||
echo "Error: program option '$opt' is not in the documentation '$man_page'"
|
echo "Error: program option '$opt' is not in the documentation '$man_page$text_doc'"
|
||||||
exit_status=1
|
exit_status=1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user