From dbe5a1898e24f4bb5c0d434d32976bfac0d3b7c8 Mon Sep 17 00:00:00 2001 From: Michael Andres Date: Mon, 26 Jan 2009 18:24:51 +0100 Subject: [PATCH] Fix parsing DESCRDIR from content file --- tools/repo2solv.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) 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" ;; -- 2.7.4