From: Michael Andres Date: Mon, 26 Jan 2009 17:24:51 +0000 (+0100) Subject: Fix parsing DESCRDIR from content file X-Git-Tag: BASE-SuSE-Code-12_1-Branch~318^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dbe5a1898e24f4bb5c0d434d32976bfac0d3b7c8;p=platform%2Fupstream%2Flibsolv.git Fix parsing DESCRDIR from content file --- diff --git a/tools/repo2solv.sh b/tools/repo2solv.sh index 5f7c712..104b8ae 100755 --- a/tools/repo2solv.sh +++ b/tools/repo2solv.sh @@ -4,12 +4,18 @@ # give it a directory of a local mirror of a repo and this # tries to detect the repo type and generate one SOLV file on stdout +get_DESCRDIR () { + local d=$(grep '^DESCRDIR' content | sed 's/^DESCRDIR[[:space:]]\+\(.*\)[[:space:]]*$/\1/') + if test -z "$d"; then + echo suse/setup/desc + else + echo ${d} + fi +} + test_susetags() { if test -s content; then - DESCR=`grep DESCRDIR content | cut -d ' ' -f 2` - if test -z $DESCR; then - DESCR=suse/setup/descr - fi + DESCR=$(get_DESCRDIR) test -d $DESCR return $? else @@ -18,7 +24,7 @@ test_susetags() { } # signal an error if there is a problem -set -e +set -e LANG=C unset CDPATH @@ -248,10 +254,7 @@ if test "$repotype" = rpmmd ; then elif test "$repotype" = susetags ; then olddir=`pwd` - DESCR=`grep DESCRDIR content | cut -d ' ' -f 2` - if test -z $DESCR; then - DESCR=suse/setup/descr - fi + DESCR=$(get_DESCRDIR) cd ${DESCR} || exit 2 ( # First packages @@ -305,7 +308,7 @@ elif test "$repotype" = susetags ; then case $name in # ignore files we handled already *.DU | *.en | *.FL | packages ) continue ;; - *) + *) suff=${name#packages.} echo "=Lan: $suff" $prog "$i" ;;