manage_variants 742 Bytes
Newer Older
gsell's avatar
gsell committed
1 2 3 4 5 6 7 8
#!/bin/bash

declare buildblock=$1
declare variants=$2


declare -r OS=$(uname -s)

gsell's avatar
gsell committed
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
# File format example
# 1.10.2	Linux,Darwin	unstable	gcc/4.8.5
declare -a toks=()
declare version=''
declare oss=''
declare release=''
declare -a dependencies=()

while read -a toks; do
	# skip comment and empty line
	(( ${#toks[@]} == 0 )) && continue
	[[ "${toks[0]:0:1}" == "#" ]] && continue
	version=${toks[0]}
	oss=${toks[1]}
	release=${toks[2]}
	dependencies=( ${toks[@]:3} )

	[[ "${oss}" =~ "${OS}" ]] || continue
	"${buildblock}"  "${version}" --release=${release} "${dependencies[@]/#/--with=}"
28 29 30 31
	if [[ $? != 0 ]]; then
		echo "Failed building:  ${version} --release=${release} ${dependencies[@]/#/--with=}" 1>&2
		exit 42
	fi
gsell's avatar
gsell committed
32
done < "${variants}"