<p>Kevin Harwell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18290">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">make_xml_documentation: Remove usage of get_sourceable_makeopts<br><br>get_sourceable_makeopts wasn't handling variables with embedded<br>double quotes in them very well.  One example was the DOWNLOAD<br>variable when curl was being used instead of wget.  Rather than<br>trying to fix get_sourceable_makeopts, it's just been removed.<br><br>ASTERISK-29986<br>Reported by: Stefan Ruijsenaars<br><br>Change-Id: Idf2a90902228c2558daa5be7a4f8327556099cd2<br>---<br>M Makefile<br>D build_tools/get_sourceable_makeopts<br>M build_tools/make_xml_documentation<br>3 files changed, 19 insertions(+), 82 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/90/18290/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/Makefile b/Makefile</span><br><span>index 539aee2..3ff5869 100644</span><br><span>--- a/Makefile</span><br><span>+++ b/Makefile</span><br><span>@@ -101,6 +101,11 @@</span><br><span> export PATCH</span><br><span> export SED</span><br><span> export NM</span><br><span style="color: hsl(120, 100%, 40%);">+export FIND</span><br><span style="color: hsl(120, 100%, 40%);">+export BASENAME</span><br><span style="color: hsl(120, 100%, 40%);">+export DIRNAME</span><br><span style="color: hsl(120, 100%, 40%);">+export XMLLINT</span><br><span style="color: hsl(120, 100%, 40%);">+export XMLSTARLET</span><br><span> </span><br><span> # makeopts is required unless the goal is just {dist{-}}clean</span><br><span> ifeq ($(MAKECMDGOALS),clean)</span><br><span>diff --git a/build_tools/get_sourceable_makeopts b/build_tools/get_sourceable_makeopts</span><br><span>deleted file mode 100755</span><br><span>index fbf4c38..0000000</span><br><span>--- a/build_tools/get_sourceable_makeopts</span><br><span>+++ /dev/null</span><br><span>@@ -1,54 +0,0 @@</span><br><span style="color: hsl(0, 100%, 40%);">-#!/bin/sh</span><br><span style="color: hsl(0, 100%, 40%);">-PROGNAME="${0##*/}"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-if [ "$1" = "-h"  ] || [ "$1" = "--help" ] ; then</span><br><span style="color: hsl(0, 100%, 40%);">-     cat <<-EOF</span><br><span style="color: hsl(0, 100%, 40%);">-                Usage: ${PROGNAME}: [ <input_file> ] [ <output_file> ]</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-              This script takes an Asterisk makeopts file, or any file containing</span><br><span style="color: hsl(0, 100%, 40%);">-             "make" style variable assignments, and converts it into a format</span><br><span style="color: hsl(0, 100%, 40%);">-              that can be directly 'sourced' by shell scripts.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-                * Any spaces around the equals sign are removed.</span><br><span style="color: hsl(0, 100%, 40%);">-                * The variable value is quoted.</span><br><span style="color: hsl(0, 100%, 40%);">-         * The "make" "or" command is evaluated.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-             Both input and output files are optional and will default to</span><br><span style="color: hsl(0, 100%, 40%);">-            stdin and stdout respectively.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-          NOTE: This script relies on NO external commands and only POSIX</span><br><span style="color: hsl(0, 100%, 40%);">-         constructs.  It should be runnable by any shell.</span><br><span style="color: hsl(0, 100%, 40%);">-        EOF</span><br><span style="color: hsl(0, 100%, 40%);">-     exit 1</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-input_file="/dev/stdin"</span><br><span style="color: hsl(0, 100%, 40%);">-if [ "$1" != "" ] ; then</span><br><span style="color: hsl(0, 100%, 40%);">-   input_file="$1"</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-output_file="/dev/stdout"</span><br><span style="color: hsl(0, 100%, 40%);">-if [ "$2" != "" ] ; then</span><br><span style="color: hsl(0, 100%, 40%);">-      output_file="$2"</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# orfunc is a code fragment to be added to the outp[ut file.</span><br><span style="color: hsl(0, 100%, 40%);">-# We don't WANT the variables evaluated.</span><br><span style="color: hsl(0, 100%, 40%);">-# shellcheck disable=SC2016</span><br><span style="color: hsl(0, 100%, 40%);">-orfunc='or (){ before="${1%,*}" ; after="${1#*,}" ; if [ "$before" = "" ] ; then echo "${after}" ; else echo "${before}" ; fi ; }'</span><br><span style="color: hsl(0, 100%, 40%);">-echo "${orfunc}" >"${output_file}"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-while read -r LINE ; do</span><br><span style="color: hsl(0, 100%, 40%);">-   var="${LINE%%=*}"</span><br><span style="color: hsl(0, 100%, 40%);">-     if [ "${var}" != "" ] ; then</span><br><span style="color: hsl(0, 100%, 40%);">-                val="${LINE#*=}"</span><br><span style="color: hsl(0, 100%, 40%);">-              if [ "${val}" != "${var}" ] ; then</span><br><span style="color: hsl(0, 100%, 40%);">-                  if [ "${val%% *}" = "" ] ; then</span><br><span style="color: hsl(0, 100%, 40%);">-                             echo "${var% *}=\"${val#* }\""</span><br><span style="color: hsl(0, 100%, 40%);">-                      else</span><br><span style="color: hsl(0, 100%, 40%);">-                            echo "${var% *}=\"${val}\""</span><br><span style="color: hsl(0, 100%, 40%);">-                 fi</span><br><span style="color: hsl(0, 100%, 40%);">-              fi</span><br><span style="color: hsl(0, 100%, 40%);">-      fi</span><br><span style="color: hsl(0, 100%, 40%);">-done <"${input_file}"  >>"${output_file}"</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>diff --git a/build_tools/make_xml_documentation b/build_tools/make_xml_documentation</span><br><span>index 54144ce..3446fff 100755</span><br><span>--- a/build_tools/make_xml_documentation</span><br><span>+++ b/build_tools/make_xml_documentation</span><br><span>@@ -1,10 +1,7 @@</span><br><span> #!/bin/sh</span><br><span style="color: hsl(0, 100%, 40%);">-# The GREP, SED, FIND, etc variables are all set at run time from</span><br><span style="color: hsl(0, 100%, 40%);">-# makeopts.</span><br><span> # shellcheck disable=SC2154</span><br><span> </span><br><span> PROGNAME="${0##*/}"</span><br><span style="color: hsl(0, 100%, 40%);">-PROGDIR="${0%/*}"</span><br><span> </span><br><span> # Fail on errors</span><br><span> set -e</span><br><span>@@ -111,36 +108,25 @@</span><br><span>   exit 1</span><br><span> fi</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-if [ ! -f "${source_tree}/Makefile" ] ; then</span><br><span style="color: hsl(0, 100%, 40%);">-  echo "There's no 'Makefile' in '${source_tree}'."</span><br><span style="color: hsl(0, 100%, 40%);">- exit 1</span><br><span style="color: hsl(0, 100%, 40%);">-fi</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> if [ ! -f "${source_tree}/makeopts" ] ; then</span><br><span>   echo "There's no 'makeopts' in '${source_tree}'.  Maybe you need to run ./configure?"</span><br><span>  exit 1</span><br><span> fi</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-# This will get the paths to the utilities we need, all</span><br><span style="color: hsl(0, 100%, 40%);">-# of which will be in makeopts.  We need to convert the</span><br><span style="color: hsl(0, 100%, 40%);">-# format so it's sourceable.</span><br><span style="color: hsl(0, 100%, 40%);">-tmpname="/tmp/ast_makeopts.$$.env"</span><br><span style="color: hsl(0, 100%, 40%);">-trap 'rm "$tmpname" >/dev/null 2>&1' INT QUIT TERM EXIT</span><br><span style="color: hsl(0, 100%, 40%);">-"${PROGDIR}/get_sourceable_makeopts" "${source_tree}/makeopts" >"${tmpname}"</span><br><span style="color: hsl(0, 100%, 40%);">-# The file to be sourced is generated at run time and can't be checked.</span><br><span style="color: hsl(0, 100%, 40%);">-# shellcheck disable=SC1090</span><br><span style="color: hsl(0, 100%, 40%);">-. "${tmpname}"</span><br><span style="color: hsl(0, 100%, 40%);">-rm "${tmpname}" > /dev/null 2>&1 || :</span><br><span style="color: hsl(0, 100%, 40%);">-trap - INT QUIT TERM EXIT</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-# Make sure we have everything we need.</span><br><span style="color: hsl(0, 100%, 40%);">-for c in GREP FIND AWK DIRNAME BASENAME SED CAT ; do</span><br><span style="color: hsl(0, 100%, 40%);">-   bin=$(eval "echo \${${c}}")</span><br><span style="color: hsl(0, 100%, 40%);">-   if [ "${bin}" = "" ] ; then</span><br><span style="color: hsl(0, 100%, 40%);">-         echo "The '${c}' utility was not found."</span><br><span style="color: hsl(0, 100%, 40%);">-              exit 1</span><br><span style="color: hsl(0, 100%, 40%);">-  fi</span><br><span style="color: hsl(0, 100%, 40%);">-done</span><br><span style="color: hsl(120, 100%, 40%);">+# This script is normally run from the top-level Makefile which</span><br><span style="color: hsl(120, 100%, 40%);">+# will set the tools variables to actual paths, or ':' if</span><br><span style="color: hsl(120, 100%, 40%);">+# the tool isn't found.  If this script is run from the</span><br><span style="color: hsl(120, 100%, 40%);">+# command line for testing purposes however, we'll need to</span><br><span style="color: hsl(120, 100%, 40%);">+# set some sane defaults.</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "${GREP}" = "" ] ; then GREP="grep" ; fi</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "${FIND}" = "" ] ; then FIND="find" ; fi</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "${AWK}" = "" ] ; then AWK="awk" ; fi</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "${DIRNAME}" = "" ] ; then DIRNAME="dirname" ; fi</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "${BASENAME}" = "" ] ; then BASENAME="basename" ; fi</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "${SED}" = "" ] ; then SED="sed" ; fi</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "${CAT}" = "" ] ; then CAT="cat" ; fi</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "${XMLLINT}" = "" ] ; then XMLLINT="xmllint" ; fi</span><br><span style="color: hsl(120, 100%, 40%);">+if [ "${XMLSTARLET}" = "" ] ; then XMLSTARLET="xmlstarlet" ; fi</span><br><span> </span><br><span> if [ "${for_wiki}" -eq "1" ] || [ "${validate}" -eq "1" ]; then</span><br><span>        if [ "${XMLLINT}${XMLSTARLET}" = "::" ] ; then</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18290">change 18290</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18290"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16.25 </div>
<div style="display:none"> Gerrit-Change-Id: Idf2a90902228c2558daa5be7a4f8327556099cd2 </div>
<div style="display:none"> Gerrit-Change-Number: 18290 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-CC: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>