From beab7c380d6125895d08a9b7c0c3efecaa7c6541 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Thu, 19 Nov 2020 03:19:37 +0100 Subject: [PATCH] Import the newer scripts from DeforaOS configure --- doc/docbook.sh | 6 ++- tests/fixme.sh | 111 ++++++++++++++++++++++++++++++++++------------- tests/xmllint.sh | 3 ++ 3 files changed, 87 insertions(+), 33 deletions(-) diff --git a/doc/docbook.sh b/doc/docbook.sh index b247959..83bbf54 100755 --- a/doc/docbook.sh +++ b/doc/docbook.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2012-2017 Pierre Pronchery +#Copyright (c) 2012-2020 Pierre Pronchery # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: @@ -25,8 +25,8 @@ #variables +CONFIGSH="${0%/docbook.sh}/../config.sh" PREFIX="/usr/local" -[ -f "../config.sh" ] && . "../config.sh" PROGNAME="docbook.sh" #executables DEBUG="_debug" @@ -37,6 +37,8 @@ RM="rm -f" XMLLINT="xmllint" XSLTPROC="xsltproc --nonet --xinclude" +[ -f "$CONFIGSH" ] && . "$CONFIGSH" + #functions #debug diff --git a/tests/fixme.sh b/tests/fixme.sh index 1db1787..84319cf 100755 --- a/tests/fixme.sh +++ b/tests/fixme.sh @@ -25,17 +25,23 @@ #variables +CONFIGSH="${0%/fixme.sh}/../config.sh" PROGNAME="fixme.sh" PROJECTCONF="../project.conf" +REGEXP_ERROR="FIXME" +REGEXP_WARNING="\\(TODO\|XXX\\)" #executables DATE="date" DEBUG="_debug" FIND="find" GREP="grep" +HEAD="head" MKDIR="mkdir -p" SORT="sort -n" TR="tr" +[ -f "$CONFIGSH" ] && . "$CONFIGSH" + #functions #fixme @@ -64,24 +70,7 @@ _fixme() for subdir in $subdirs; do [ -d "../$subdir" ] || continue for filename in $($FIND "../$subdir" -type f | $SORT); do - callback= - ext=${filename##*/} - ext=${ext%.in} - ext=${ext##*.} - case "$ext" in - asm|S) - callback="_fixme_asm" - ;; - c|cc|cpp|cxx|h|js) - callback="_fixme_c" - ;; - conf|sh) - callback="_fixme_sh" - ;; - htm|html|xml) - callback="_fixme_xml" - ;; - esac + callback=$(_fixme_callback "$filename") [ -n "$callback" ] || continue ($callback "$filename") 2>&1 if [ $? -ne 0 ]; then @@ -93,54 +82,114 @@ _fixme() return $res } -_fixme_asm() +_fixme_callback() +{ + filename="$1" + ext=${filename##*/} + ext=${ext%.in} + ext=${ext##*.} + callback= + + case "$ext" in + asm|S) + echo "_fixme_callback_asm" + return 0 + ;; + c|cc|cpp|cxx|h|js|v) + echo "_fixme_callback_c" + return 0 + ;; + conf|sh) + echo "_fixme_callback_sh" + return 0 + ;; + py) + echo "_fixme_callback_python" + return 0 + ;; + htm|html|xml|xsl) + echo "_fixme_callback_xml" + return 0 + ;; + esac + case $($HEAD -n 1 "$filename") in + "#!/bin/sh"*|"#! /bin/sh"*|\ + "#!/usr/bin/env bash"*|"#! /usr/bin/env bash"*) + echo "_fixme_callback_sh" + return 0 + ;; + "#!/usr/bin/env python"*|"#! /usr/bin/env python"*) + echo "_fixme_callback_python" + return 0 + ;; + "