]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
make_xml_documentation: Remove usage of get_sourceable_makeopts
authorGeorge Joseph <gjoseph@digium.com>
Fri, 25 Mar 2022 14:33:30 +0000 (08:33 -0600)
committerKevin Harwell <kharwell@digium.com>
Tue, 29 Mar 2022 17:42:01 +0000 (12:42 -0500)
get_sourceable_makeopts wasn't handling variables with embedded
double quotes in them very well.  One example was the DOWNLOAD
variable when curl was being used instead of wget.  Rather than
trying to fix get_sourceable_makeopts, it's just been removed.

ASTERISK-29986
Reported by: Stefan Ruijsenaars

Change-Id: Idf2a90902228c2558daa5be7a4f8327556099cd2

Makefile
build_tools/get_sourceable_makeopts [deleted file]
build_tools/make_xml_documentation

index 2f6a66e4a24939f9c7c455ba1abd5ee9df21c2c1..666a227cd7b1a099f0899de4c2e1e81c0762b56d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -101,6 +101,11 @@ export TAR
 export PATCH
 export SED
 export NM
+export FIND
+export BASENAME
+export DIRNAME
+export XMLLINT
+export XMLSTARLET
 
 # makeopts is required unless the goal is just {dist{-}}clean
 ifeq ($(MAKECMDGOALS),clean)
diff --git a/build_tools/get_sourceable_makeopts b/build_tools/get_sourceable_makeopts
deleted file mode 100755 (executable)
index fbf4c38..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/sh
-PROGNAME="${0##*/}"
-
-if [ "$1" = "-h"  ] || [ "$1" = "--help" ] ; then
-       cat <<-EOF
-               Usage: ${PROGNAME}: [ <input_file> ] [ <output_file> ]
-
-               This script takes an Asterisk makeopts file, or any file containing
-               "make" style variable assignments, and converts it into a format
-               that can be directly 'sourced' by shell scripts.
-
-               * Any spaces around the equals sign are removed.
-               * The variable value is quoted.
-               * The "make" "or" command is evaluated.
-
-               Both input and output files are optional and will default to
-               stdin and stdout respectively.
-
-               NOTE: This script relies on NO external commands and only POSIX
-               constructs.  It should be runnable by any shell.
-       EOF
-       exit 1
-fi
-
-input_file="/dev/stdin"
-if [ "$1" != "" ] ; then
-       input_file="$1"
-fi
-
-output_file="/dev/stdout"
-if [ "$2" != "" ] ; then
-       output_file="$2"
-fi
-
-# orfunc is a code fragment to be added to the outp[ut file.
-# We don't WANT the variables evaluated.
-# shellcheck disable=SC2016
-orfunc='or (){ before="${1%,*}" ; after="${1#*,}" ; if [ "$before" = "" ] ; then echo "${after}" ; else echo "${before}" ; fi ; }'
-echo "${orfunc}" >"${output_file}"
-
-while read -r LINE ; do
-       var="${LINE%%=*}"
-       if [ "${var}" != "" ] ; then
-               val="${LINE#*=}"
-               if [ "${val}" != "${var}" ] ; then
-                       if [ "${val%% *}" = "" ] ; then
-                               echo "${var% *}=\"${val#* }\""
-                       else
-                               echo "${var% *}=\"${val}\""
-                       fi
-               fi
-       fi
-done <"${input_file}"  >>"${output_file}"
-
index 54144ce8a7437d155aefb416eb67290a1337b4e2..3446fff0c80c00f4715c02fc1bfe7cfe66a79523 100755 (executable)
@@ -1,10 +1,7 @@
 #!/bin/sh
-# The GREP, SED, FIND, etc variables are all set at run time from
-# makeopts.
 # shellcheck disable=SC2154
 
 PROGNAME="${0##*/}"
-PROGDIR="${0%/*}"
 
 # Fail on errors
 set -e
@@ -111,36 +108,25 @@ if [ ! -d "${source_tree}" ] ; then
        exit 1
 fi
 
-if [ ! -f "${source_tree}/Makefile" ] ; then
-       echo "There's no 'Makefile' in '${source_tree}'."
-       exit 1
-fi
-
 if [ ! -f "${source_tree}/makeopts" ] ; then
        echo "There's no 'makeopts' in '${source_tree}'.  Maybe you need to run ./configure?"
        exit 1
 fi
 
-# This will get the paths to the utilities we need, all
-# of which will be in makeopts.  We need to convert the
-# format so it's sourceable.
-tmpname="/tmp/ast_makeopts.$$.env"
-trap 'rm "$tmpname" >/dev/null 2>&1' INT QUIT TERM EXIT
-"${PROGDIR}/get_sourceable_makeopts" "${source_tree}/makeopts" >"${tmpname}"
-# The file to be sourced is generated at run time and can't be checked.
-# shellcheck disable=SC1090
-. "${tmpname}"
-rm "${tmpname}" > /dev/null 2>&1 || :
-trap - INT QUIT TERM EXIT
-
-# Make sure we have everything we need.
-for c in GREP FIND AWK DIRNAME BASENAME SED CAT ; do
-       bin=$(eval "echo \${${c}}")
-       if [ "${bin}" = "" ] ; then
-               echo "The '${c}' utility was not found."
-               exit 1
-       fi
-done
+# This script is normally run from the top-level Makefile which
+# will set the tools variables to actual paths, or ':' if
+# the tool isn't found.  If this script is run from the
+# command line for testing purposes however, we'll need to
+# set some sane defaults.
+if [ "${GREP}" = "" ] ; then GREP="grep" ; fi
+if [ "${FIND}" = "" ] ; then FIND="find" ; fi
+if [ "${AWK}" = "" ] ; then AWK="awk" ; fi
+if [ "${DIRNAME}" = "" ] ; then DIRNAME="dirname" ; fi
+if [ "${BASENAME}" = "" ] ; then BASENAME="basename" ; fi
+if [ "${SED}" = "" ] ; then SED="sed" ; fi
+if [ "${CAT}" = "" ] ; then CAT="cat" ; fi
+if [ "${XMLLINT}" = "" ] ; then XMLLINT="xmllint" ; fi
+if [ "${XMLSTARLET}" = "" ] ; then XMLSTARLET="xmlstarlet" ; fi
 
 if [ "${for_wiki}" -eq "1" ] || [ "${validate}" -eq "1" ]; then
        if [ "${XMLLINT}${XMLSTARLET}" = "::" ] ; then