mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 18:55:19 +00:00 
			
		
		
		
	The codec/dpma downloader wasn't handling curl correctly. The logic that transforms makeopts into a bash-sourceable file wasn't handling the make 'or' command in DOWNLOAD_TIMEOUT so bash was looking for an 'or' command. That logic has been eliminated. Instead of trying to transform and source makeopts, the downloader now calls a make scriptlet to print the value of a specific variable. This way, make handles the ors (or any other make construct that happens to creep into that file). ASTERISK-27202 Reported by: Sean McCord Change-Id: Iadfb6693528e4d4da7b8bb201fa66da2c71c7f99
		
			
				
	
	
		
			70 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			70 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/usr/bin/env bash
 | |
| 
 | |
| if [[ ( ${BASH_VERSINFO[0]} == 4 && ${BASH_VERSINFO[1]} > 1 ) || ${BASH_VERSINFO[0]} > 4 ]] ; then
 | |
| 	shopt -s compat41
 | |
| fi
 | |
| set -e
 | |
| 
 | |
| ASTTOPDIR=${ASTTOPDIR:-.}
 | |
| export make=`sed -n -r -e "s/^MAKE\s*=\s*//gp" ${ASTTOPDIR}/makeopts`
 | |
| 
 | |
| getvar() {
 | |
| 	$make --quiet --no-print-directory -f- <<EOF
 | |
| include ${ASTTOPDIR}/makeopts
 | |
| all:
 | |
| 	@echo "\$($1)"
 | |
| EOF
 | |
| }
 | |
| 
 | |
| 
 | |
| XMLSTARLET=`getvar XMLSTARLET`
 | |
| ASTMODDIR=`getvar ASTMODDIR`
 | |
| cache_dir=`getvar EXTERNALS_CACHE_DIR`
 | |
| DOWNLOAD_TO_STDOUT=`getvar DOWNLOAD_TO_STDOUT`
 | |
| HOST_CPU=`getvar HOST_CPU`
 | |
| INSTALL=`getvar INSTALL`
 | |
| 
 | |
| tmpdir=$(mktemp -d)
 | |
| if [[ -z "${tmpdir}" ]] ; then
 | |
| 	echo "${module_name}: Unable to create temporary directory."
 | |
| 	exit 1
 | |
| fi
 | |
| trap "rm -rf ${tmpdir}" EXIT
 | |
| 
 | |
| if [[ -z "${ASTMODDIR}" ]] ; then
 | |
| 	echo "${module_name}: Unable to parse ${ASTTOPDIR}/makeopts."
 | |
| 	exit 1
 | |
| fi
 | |
| 
 | |
| if [[ "${XMLSTARLET}" = ":" ]] ; then
 | |
| 	echo "${module_name}: The externals downloader requires xmlstarlet to be installed."
 | |
| 	exit 1
 | |
| fi
 | |
| 
 | |
| version=$(${ASTTOPDIR}/build_tools/make_version ${ASTTOPDIR})
 | |
| if [[ ! ${version} =~ ^(GIT-)?([^.-]+)[.-].* ]] ; then
 | |
| 	echo "${module_name}: Couldn't parse version ${version}"
 | |
| 	exit 1
 | |
| fi
 | |
| major_version=${BASH_REMATCH[2]}.0
 | |
| 
 | |
| if [[ "${HOST_CPU}" = "x86_64" ]] ; then
 | |
| 	host_bits=64
 | |
| else
 | |
| 	host_bits=32
 | |
| fi
 | |
| 
 | |
| names=""
 | |
| for manifest in ${DESTDIR}${ASTMODDIR}/*.manifest.xml ; do
 | |
| 	if [ ! -f "$manifest" ] ; then
 | |
| 		break
 | |
| 	fi
 | |
| 	package_version=$(${XMLSTARLET} sel -t -v "/package/@version" ${manifest})
 | |
| 	package_major_version=${package_version%_*}
 | |
| 	package_arch=$(${XMLSTARLET} sel -t -v "/package/@arch" ${manifest})
 | |
| 	if [[ "$package_major_version" = "$major_version" && "${package_arch}" = "x86_${host_bits}" ]] ; then
 | |
| 		names+=$(${XMLSTARLET} sel -t -m "//file[@executable = 'yes']" -v "concat(@name, ' ')" ${manifest})
 | |
| 	fi
 | |
| done
 | |
| echo $names
 |