diff --git a/autodist-upstream-updates b/autodist-upstream-updates index f0aa938..56be4b9 100755 --- a/autodist-upstream-updates +++ b/autodist-upstream-updates @@ -52,18 +52,14 @@ function usage() get_job_vector() { local JNAME=$1 + local JNAME_ESCAPED=`echo $JNAME | tr - _ | tr . _ | tr @ _` # resolve JOB_NAME from distdb - # note: if JOB_NAME contains a "-" it can't be a distdb JOB, so skip it - if [ "${JNAME/-/}" = "${JNAME}" ]; then - local jobtmpfile=`tempfile` - # hack to get an array variable named as $j assigned to the JOB array - echo "echo \${$JNAME[*]}" > $jobtmpfile - JOB=(`. $jobtmpfile`) - rm -f $jobtmpfile - else - JOB=() - fi + local jobtmpfile=`tempfile` + # hack to get an array variable named as $j assigned to the JOB array + echo "echo \${$JNAME_ESCAPED[*]}" > $jobtmpfile + JOB=(`. $jobtmpfile`) + rm -f $jobtmpfile if [ ${#JOB[*]} -eq 0 ]; then # create a default job with given JOB_NAME @@ -186,14 +182,14 @@ for rep in core community extra; do line=`echo $line | sed "s|.*href=\"\([^\"]*\)\">.*|\1|"` pkg=`echo $line | sed "s|\(.*\)-[^-]*-[^-]*-[^-]*|\1|"` ver=`echo $line | sed "s|.*-\([^-]*\)-[^-]*-[^-]*|\1|"` - alias=`grep "^$pkg" $ALIASES_DB` + alias=`grep "^$pkg " $ALIASES_DB` [ "$alias" ] || alias=`grep "^lib$pkg " $ALIASES_DB` - [ "$alias" ] && pkg=$alias - line=`grep -i "^$pkg:" $buildstmp || grep -i "^lib$pkg:" $buildstmp || grep -i " $pkg[^-_A-Za-z0-9]" $buildstmp` + [ "$alias" ] && pkgalias=${alias/* /} || pkgalias=$pkg + line=`grep -i "^$pkgalias:" $buildstmp || grep -i "^lib$pkgalias:" $buildstmp || grep -i " $pkgalias[^-_A-Za-z0-9]" $buildstmp` if [ "$line" ]; then - pkg=${line/:*} + [ "$pkg" != "$pkgalias" ] && alias=$pkgalias || alias= [ "$pkg" -a "$ver" ] && { - echo "$pkg $ver $SOURCEURL ${alias/* /}" >> $tmpfile + echo "$pkg $ver $SOURCEURL ${alias}" >> $tmpfile } fi done