X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Frepo2solv.sh;h=11c6567b485668184595f8009072dc94aadd1248;hb=77c0a018bfb0590b708141e5266b7cb0156ca639;hp=518f700142deb12353f4f902d5776134a8e9a7cb;hpb=29b546ff3ebe910c3fa2a9be0abb249c0328768a;p=platform%2Fupstream%2Flibsolv.git diff --git a/tools/repo2solv.sh b/tools/repo2solv.sh index 518f700..11c6567 100755 --- a/tools/repo2solv.sh +++ b/tools/repo2solv.sh @@ -54,6 +54,18 @@ repomd_decompress() { esac } +susetags_findfile() { + if test -s "$1.xz" ; then + echo "$1.xz" + elif test -s "$1.lzma" ; then + echo "$1.lzma" + elif test -s "$1.bz2" ; then + echo "$1.bz2" + elif test -s "$1.gz" ; then + echo "$1.gz" + fi +} + susetags_findfile_cat() { if test -s "$1.xz" ; then xz -dc "$1.xz" @@ -77,6 +89,7 @@ parser_options=${PARSER_OPTIONS:-} findopt="-prune" repotype= +addautooption= while true ; do if test "$1" = "-o" ; then @@ -88,6 +101,11 @@ while true ; do findopt= repotype=plaindir shift + elif test "$1" = "-X" ; then + addautooption=-X + shift + elif test "$1" = "-A" ; then + shift else break fi @@ -98,7 +116,7 @@ cd "$dir" || exit 1 if test -z "$repotype" ; then # autodetect repository type - if test -d repodata ; then + if test -d repodata -o -f repomd.xml; then repotype=rpmmd elif test_susetags ; then repotype=susetags @@ -108,7 +126,9 @@ if test -z "$repotype" ; then fi if test "$repotype" = rpmmd ; then - cd repodata || exit 2 + test -d repodata && { + cd repodata || exit 2 + } primfile= primxml=`repomd_findfile primary primary.xml` @@ -128,7 +148,7 @@ if test "$repotype" = rpmmd ; then repomd_decompress "$susedataxml" fi echo '' - ) | grep -v '\?xml' | sed '1i\' | rpmmd2solv $parser_options > $primfile || exit 4 + ) | sed 's/]*>//g' | sed '1i\' | rpmmd2solv $parser_options > $primfile || exit 4 fi prodfile= @@ -137,12 +157,8 @@ if test "$repotype" = rpmmd ; then prodxml=`repomd_findfile product product.xml` fi if test -n "$prodxml" -a -s "$prodxml" ; then - prodfile=`mktemp` || exit 3 - ( - echo '' - repomd_decompress "$prodxml" - echo '' - ) | grep -v '\?xml' | rpmmd2solv $parser_options > $prodfile || exit 4 + prodfile=`mktemp` || exit 3 + repomd_decompress "$prodxml" | rpmmd2solv $parser_options > $prodfile || exit 4 fi patternfile= @@ -189,14 +205,35 @@ if test "$repotype" = rpmmd ; then repomd_decompress "$deltainfoxml" | deltainfoxml2solv $parser_options > $deltainfofile || exit 4 fi + # This contains appdata + appdataxml= + appdatafile= + if test -x /usr/bin/appdata2solv ; then + appdataxml=`repomd_findfile appdata appdata.xml` + fi + if test -n "$appdataxml" -a -s "$appdataxml" ; then + appdatafile=`mktemp` || exit 3 + repomd_decompress "$appdataxml" | appdata2solv $parser_options > $appdatafile || exit 4 + fi + # Now merge primary, patches, updateinfo, and deltainfo - mergesolv $repomdfile $suseinfofile $primfile $prodfile $patternfile $updateinfofile $deltainfofile - rm -f $repomdfile $suseinfofile $primfile $patternfile $prodfile $updateinfofile $deltainfofile + mergesolv $addautooption $repomdfile $suseinfofile $primfile $prodfile $patternfile $updateinfofile $deltainfofile $appdatafile + rm -f $repomdfile $suseinfofile $primfile $patternfile $prodfile $updateinfofile $deltainfofile $appdatafile elif test "$repotype" = susetags ; then olddir=`pwd` DESCR=$(get_DESCRDIR) cd ${DESCR} || exit 2 + appdataxml= + appdatafile= + if test -x /usr/bin/appdata2solv ; then + appdataxml=`susetags_findfile appdata.xml` + fi + if test -n "$appdataxml" ; then + appdatafile=`mktemp` || exit 3 + repomd_decompress "$appdataxml" | appdata2solv $parser_options > $appdatafile || exit 4 + parser_options="-M $appdatafile $parser_options" + fi ( # First packages susetags_findfile_cat packages @@ -234,10 +271,11 @@ elif test "$repotype" = susetags ; then esac done - ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4 + ) | susetags2solv $addautooption -c "${olddir}/content" $parser_options || exit 4 + test -n "$appdatafile" && rm -f "$appdatafile" cd "$olddir" elif test "$repotype" = plaindir ; then - find * -name .\* -prune -o $findopt -name \*.delta.rpm -o -name \*.patch.rpm -o -name \*.rpm -a -type f -print0 | rpms2solv -0 -m - + find * -name .\* -prune -o $findopt -name \*.delta.rpm -o -name \*.patch.rpm -o -name \*.rpm -a -type f -print0 | rpms2solv $addautooption -0 -m - else echo "unknown repository type '$repotype'" >&2 exit 1