From: Duncan Mac-Vicar P Date: Fri, 11 Jul 2008 23:44:41 +0000 (+0000) Subject: - make repo2solv.sh also take repomd.xml in count X-Git-Tag: BASE-SuSE-Code-12_1-Branch~308^2~296 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ea435a8e12d98eab400ff2b75c4c6b9972105cc0;p=thirdparty%2Flibsolv.git - make repo2solv.sh also take repomd.xml in count - install repomdxml2solv --- diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 32cd3afe..5299d700 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -69,6 +69,7 @@ install(TARGETS rpms2solv updateinfoxml2solv deltainfoxml2solv + repomdxml2solv DESTINATION ${BIN_INSTALL_DIR} ) install(PROGRAMS repo2solv.sh DESTINATION ${BIN_INSTALL_DIR} ) diff --git a/tools/repo2solv.sh b/tools/repo2solv.sh index 25862d4a..a09a4270 100755 --- a/tools/repo2solv.sh +++ b/tools/repo2solv.sh @@ -47,6 +47,27 @@ if test -d repodata; then $cmd $i | rpmmd2solv $parser_options > $primfile || exit 4 fi + # This contains repomd.xml + # for now we only read some keys like expiration + if test -f repomd.xml || test -f repomd.xml.gz || test -f repomd.xml.bz2 ; then + for i in repomd.xml*; do + case $i in + *.gz) cmd="gzip -dc" ;; + *.bz2) cmd="bzip2 -dc" ;; + *) cmd="cat" ;; + esac + # only check the first updateinfo.xml*, in case there are more + break + done + + repomdfile="/nonexist" + if test -n "$cmd"; then + # we have some repomd.xml* + repomdfile=`mktemp` || exit 3 + $cmd $i | repomdxml2solv $parser_options > $repomdfile || exit 4 + fi + 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 for i in updateinfo.xml*; do @@ -102,6 +123,9 @@ if test -d repodata; then fi # Now merge primary, patches, updateinfo, and deltainfo + if test -s $repomdfile; then + m_repomdfile=$repomdfile + fi if test -s $primfile; then m_primfile=$primfile fi @@ -114,8 +138,8 @@ if test -d repodata; then 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_repomdfile $m_primfile $m_patchfile $m_updateinfofile $m_deltainfofile + rm -f $repomdfile $primfile $patchfile $updateinfofile $deltainfofile elif test_susetags; then olddir=`pwd`