[zypp-commit] r11356 - /branches/SuSE-Linux-11_0-Branch/sat-solver/tools/repo2solv.sh
Author: mlschroe Date: Wed Oct 15 15:23:38 2008 New Revision: 11356 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11356&view=rev Log: - add '-o' option - add support for patterns [bnc#419947] - better quoting of filenames - fix tiny bug in rpms2solv case Modified: branches/SuSE-Linux-11_0-Branch/sat-solver/tools/repo2solv.sh Modified: branches/SuSE-Linux-11_0-Branch/sat-solver/tools/repo2solv.sh URL: http://svn.opensuse.org/viewcvs/zypp/branches/SuSE-Linux-11_0-Branch/sat-solver/tools/repo2solv.sh?rev=11356&r1=11355&r2=11356&view=diff ============================================================================== --- branches/SuSE-Linux-11_0-Branch/sat-solver/tools/repo2solv.sh (original) +++ branches/SuSE-Linux-11_0-Branch/sat-solver/tools/repo2solv.sh Wed Oct 15 15:23:38 2008 @@ -24,6 +24,11 @@ unset CDPATH parser_options=${PARSER_OPTIONS:-} +if test "$1" = "-o" ; then + exec > "$2" + shift + shift +fi dir="$1" cd "$dir" || exit 1 @@ -31,6 +36,7 @@ cd repodata || exit 2 # This contains a primary.xml* and maybe patches + cmd= for i in primary.xml*; do case $i in *.gz) cmd="gzip -dc" ;; @@ -44,12 +50,31 @@ if test -n "$cmd"; then # we have some primary.xml* primfile=`mktemp` || exit 3 - $cmd $i | rpmmd2solv $parser_options > $primfile || exit 4 + $cmd "$i" | rpmmd2solv $parser_options > $primfile || exit 4 + fi + + # check for patterns + cmd= + patternfile="/nonexist" + for i in patterns.xml*; do + test -s "$i" || continue + case $i in + *.gz) cmd='gzip -dc' ;; + *.bz2) cmd='bzip2 -dc' ;; + *) cmd='cat' ;; + esac + break + done + if test -n "$cmd"; then + patternfile=`mktemp` || exit 3 + $cmd "$i" | rpmmd2solv $parser_options > $patternfile || exit 4 fi # This contains a updateinfo.xml* and maybe patches if test -f updateinfo.xml || test -f updateinfo.xml.gz || test -f updateinfo.xml.bz2 ; then + cmd= for i in updateinfo.xml*; do + test -s "$i" || continue case $i in *.gz) cmd="gzip -dc" ;; *.bz2) cmd="bzip2 -dc" ;; @@ -97,7 +122,7 @@ if test -n "$cmd"; then # we have some deltainfo.xml* deltainfofile=`mktemp` || exit 3 - $cmd $i | deltainfoxml2solv $parser_options > $deltainfofile || exit 4 + $cmd "$i" | deltainfoxml2solv $parser_options > $deltainfofile || exit 4 fi fi @@ -105,6 +130,9 @@ if test -s $primfile; then m_primfile=$primfile fi + if test -s $patternfile; then + m_patternfile=$patternfile + fi if test -s $patchfile; then m_patchfile=$patchfile fi @@ -114,8 +142,8 @@ if test -s $deltainfofile; then m_deltainfofile=$deltainfofile fi - mergesolv $m_primfile $m_patchfile $m_updateinfofile $m_deltainfofile - rm -f $primfile $patchfile $updateinfofile $deltainfofile + mergesolv $m_primfile $m_patternfile $m_patchfile $m_updateinfofile $m_deltainfofile + rm -f $primfile $patternfile $patchfile $updateinfofile $deltainfofile elif test_susetags; then olddir=`pwd` @@ -179,7 +207,7 @@ *) suff=${name#packages.} echo "=Lan: $suff" - eval "$prog '$i'" ;; + $prog "$i" ;; esac done @@ -188,11 +216,11 @@ else rpms='' for r in *.rpm ; do - rpms="$rpms$r -" + test -e "$r" && rpms="$rpms +$r" done if test -n "$rpms" ; then - echo "$rpms" | rpms2solv -m - + echo "${rpms#?}" | rpms2solv -m - else exit 1 fi -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
mlschroe@svn.opensuse.org