<p>George Joseph <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6241">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
George Joseph: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Fix downloader not working with curl<br><br>The codec/dpma downloader wasn't handling curl correctly. The logic<br>that transforms makeopts into a bash-sourceable file wasn't<br>handling the make 'or' command in DOWNLOAD_TIMEOUT so bash was<br>looking for an 'or' command.<br><br>That logic has been eliminated. Instead of trying to transform<br>and source makeopts, the downloader now calls a make scriptlet<br>to print the value of a specific variable. This way, make handles<br>the ors (or any other make construct that happens to creep into<br>that file).<br><br>ASTERISK-27202<br>Reported by: Sean McCord<br><br>Change-Id: Iadfb6693528e4d4da7b8bb201fa66da2c71c7f99<br>---<br>M build_tools/download_externals<br>M build_tools/list_valid_installed_externals<br>2 files changed, 35 insertions(+), 16 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/build_tools/download_externals b/build_tools/download_externals<br>index f6cc523..efeb6c5 100755<br>--- a/build_tools/download_externals<br>+++ b/build_tools/download_externals<br>@@ -5,7 +5,24 @@<br> fi<br> set -e<br> <br>+<br> ASTTOPDIR=${ASTTOPDIR:-.}<br>+export make=`sed -n -r -e "s/^MAKE\s*=\s*//gp" ${ASTTOPDIR}/makeopts`<br>+<br>+getvar() {<br>+ $make --quiet --no-print-directory -f- <<EOF<br>+include ${ASTTOPDIR}/makeopts<br>+all:<br>+ @echo "\$($1)"<br>+EOF<br>+}<br>+<br>+XMLSTARLET=`getvar XMLSTARLET`<br>+ASTMODDIR=`getvar ASTMODDIR`<br>+cache_dir=`getvar EXTERNALS_CACHE_DIR`<br>+DOWNLOAD_TO_STDOUT=`getvar DOWNLOAD_TO_STDOUT`<br>+HOST_CPU=`getvar HOST_CPU`<br>+INSTALL=`getvar INSTALL`<br> <br> module_name=${1%%-*}<br> variant=${1##*-}<br>@@ -26,24 +43,16 @@<br> fi<br> trap "rm -rf ${tmpdir}" EXIT<br> <br>-# We have to pre-process the makeopts file so it will be parsable by bash<br>-# Surround values with double quotes<br>-# Convert make $(or) functions to bash ${name:-value}<br>-sed -r -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" \<br>- -e 's/^([^ =]+)="\$\(or ([^,]*),([^)]+)\)"/_tmp="\2"\n\1="${_tmp:-\3}"/g' ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts<br>-source ${tmpdir}/makeopts<br> if [[ -z "${ASTMODDIR}" ]] ; then<br> echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."<br> exit 1<br> fi<br> <br>-XMLSTARLET=${XMLSTARLET:-xmlstarlet}<br> if [[ "${XMLSTARLET}" = ":" ]] ; then<br> echo "${module_name}: The externals downloader requires xmlstarlet to be installed."<br> exit 1<br> fi<br> <br>-cache_dir="${EXTERNALS_CACHE_DIR}"<br> if [[ -z ${cache_dir} ]] ; then<br> cache_dir=${tmpdir}<br> fi<br>@@ -191,7 +200,7 @@<br> fi<br> <br> if [[ ${need_download} = 1 ]] ; then<br>- echo "${full_name}: Downloading ${remote_url}/${tarball}"<br>+ echo "${full_name}: Downloading ${remote_url}/${tarball} to ${cache_dir}/${tarball}"<br> ${DOWNLOAD_TO_STDOUT} ${remote_url}/${tarball} > ${cache_dir}/${tarball} || {<br> echo "${full_name}: Unable to fetch ${remote_url}/${tarball}"<br> exit 1<br>diff --git a/build_tools/list_valid_installed_externals b/build_tools/list_valid_installed_externals<br>index 194801c..ed36274 100755<br>--- a/build_tools/list_valid_installed_externals<br>+++ b/build_tools/list_valid_installed_externals<br>@@ -6,6 +6,23 @@<br> set -e<br> <br> ASTTOPDIR=${ASTTOPDIR:-.}<br>+export make=`sed -n -r -e "s/^MAKE\s*=\s*//gp" ${ASTTOPDIR}/makeopts`<br>+<br>+getvar() {<br>+ $make --quiet --no-print-directory -f- <<EOF<br>+include ${ASTTOPDIR}/makeopts<br>+all:<br>+ @echo "\$($1)"<br>+EOF<br>+}<br>+<br>+<br>+XMLSTARLET=`getvar XMLSTARLET`<br>+ASTMODDIR=`getvar ASTMODDIR`<br>+cache_dir=`getvar EXTERNALS_CACHE_DIR`<br>+DOWNLOAD_TO_STDOUT=`getvar DOWNLOAD_TO_STDOUT`<br>+HOST_CPU=`getvar HOST_CPU`<br>+INSTALL=`getvar INSTALL`<br> <br> tmpdir=$(mktemp -d)<br> if [[ -z "${tmpdir}" ]] ; then<br>@@ -14,18 +31,11 @@<br> fi<br> trap "rm -rf ${tmpdir}" EXIT<br> <br>-# We have to pre-process the makeopts file so it will be parsable by bash<br>-# Surround values with double quotes<br>-# Convert make $(or) functions to bash ${name:-value}<br>-sed -r -e "s/^([^ =]+)\s*=\s*(.*)$/\1=\"\2\"/g" \<br>- -e 's/^([^ =]+)="\$\(or ([^,]*),([^)]+)\)"/_tmp="\2"\n\1="${_tmp:-\3}"/g' ${ASTTOPDIR}/makeopts >${tmpdir}/makeopts<br>-source ${tmpdir}/makeopts<br> if [[ -z "${ASTMODDIR}" ]] ; then<br> echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."<br> exit 1<br> fi<br> <br>-XMLSTARLET=${XMLSTARLET:-xmlstarlet}<br> if [[ "${XMLSTARLET}" = ":" ]] ; then<br> echo "${module_name}: The externals downloader requires xmlstarlet to be installed."<br> exit 1<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6241">change 6241</a>. To unsubscribe, 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/6241"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15.0 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Iadfb6693528e4d4da7b8bb201fa66da2c71c7f99 </div>
<div style="display:none"> Gerrit-Change-Number: 6241 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>