+repomd_findfile() {
+ local t=$1
+ local p=$2
+ local f
+ if test -n "$t" -a -s repomd.xml ; then
+ f=`repomdxml2solv -q $t:location < repomd.xml 2>/dev/null`
+ f=${f##*/}
+ if test -f "$f" ; then
+ echo "$f"
+ return
+ fi
+ fi
+ if test -f "$p.bz2" ; then
+ echo "$p.bz2"
+ elif test -f "$p.gz" ; then
+ echo "$p.gz"
+ elif test -f "$p" ; then
+ echo "$p"
+ fi
+}
+
+repomd_decompress() {
+ case $1 in
+ *.gz) gzip -dc "$1" ;;
+ *.bz2) bzip2 -dc "$1" ;;
+ *.lzma) lzma -dc "$1" ;;
+ *.xz) xz -dc "$1" ;;
+ *) cat "$1" ;;
+ 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"
+ elif test -s "$1.lzma" ; then
+ lzma -dc "$1.lzma"
+ elif test -s "$1.bz2" ; then
+ bzip2 -dc "$1.bz2"
+ elif test -s "$1.gz" ; then
+ gzip -dc "$1.gz"
+ elif test -s "$1" ; then
+ cat "$1"
+ fi
+}
+