4 # give it a directory of a local mirror of a repo and this
5 # tries to detect the repo type and generate one SOLV file on stdout
8 if test -s content; then
9 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
10 if test -z $DESCR; then
11 DESCR=suse/setup/descr
20 # this should signal an error if there is a problem
25 parser_options=${PARSER_OPTIONS:-}
30 if test -d repodata; then
34 if test -f primary.xml || test -f primary.xml.gz || test -f primary.xml.bz2 ; then
35 primfile=`mktemp` || exit 3
37 # fake tag to combine primary.xml and extensions
38 # like susedata.xml, other.xml, filelists.xml
40 for i in primary.xml* susedata.xml*; do
43 *.bz2) bzip2 -dc "$i";;
51 for i in susedata.xml*; do
54 *.bz2) bzip2 -dc "$i";;
61 ) | grep -v '\?xml' | sed '1i\<?xml version="1.0" encoding="UTF-8"?>' | rpmmd2solv $parser_options > $primfile || exit 4
65 if test -f product.xml; then
66 prodfile=`mktemp` || exit 3
69 for i in product*.xml*; do
71 *.gz) gzip -dc "$i" ;;
72 *.bz2) bzip2 -dc "$i" ;;
77 ) | grep -v '\?xml' | rpmmd2solv $parser_options > $prodfile || exit 4
81 # This contains repomd.xml
82 # for now we only read some keys like timestamp
83 if test -f repomd.xml || test -f repomd.xml.gz || test -f repomd.xml.bz2 ; then
84 for i in repomd.xml*; do
86 *.gz) cmd="gzip -dc" ;;
87 *.bz2) cmd="bzip2 -dc" ;;
90 # only check the first repomd.xml*, in case there are more
94 repomdfile="/nonexist"
95 if test -n "$cmd"; then
96 # we have some repomd.xml*
97 repomdfile=`mktemp` || exit 3
98 $cmd $i | repomdxml2solv $parser_options > $repomdfile || exit 4
102 # This contains suseinfo.xml, which is extensions to repomd.xml
103 # for now we only read some keys like expiration and products
104 if test -f suseinfo.xml || test -f suseinfo.xml.gz || test -f suseinfo.xml.bz2 ; then
105 for i in suseinfo.xml*; do
107 *.gz) cmd="gzip -dc" ;;
108 *.bz2) cmd="bzip2 -dc" ;;
111 # only check the first suseinfo.xml*, in case there are more
115 suseinfofile="/nonexist"
116 if test -n "$cmd"; then
117 # we have some suseinfo.xml*
118 suseinfofile=`mktemp` || exit 3
119 $cmd $i | repomdxml2solv $parser_options > $suseinfofile || exit 4
123 # This contains a updateinfo.xml* and maybe patches
124 if test -f updateinfo.xml || test -f updateinfo.xml.gz || test -f updateinfo.xml.bz2 ; then
125 for i in updateinfo.xml*; do
127 *.gz) cmd="gzip -dc" ;;
128 *.bz2) cmd="bzip2 -dc" ;;
131 # only check the first updateinfo.xml*, in case there are more
134 updateinfofile="/nonexist"
135 if test -n "$cmd"; then
136 # we have some updateinfo.xml*
137 updateinfofile=`mktemp` || exit 3
138 $cmd $i | updateinfoxml2solv $parser_options > $updateinfofile || exit 4
142 patchfile="/nonexist"
143 if test -f patches.xml; then
144 patchfile=`mktemp` || exit 3
147 for i in patch-*.xml*; do
149 *.gz) gzip -dc "$i" ;;
150 *.bz2) bzip2 -dc "$i" ;;
155 ) | grep -v '\?xml' | patchxml2solv $parser_options > $patchfile || exit 4
158 # This contains a deltainfo.xml*
159 if test -f deltainfo.xml || test -f deltainfo.xml.gz || test -f deltainfo.xml.bz2 ; then
160 for i in deltainfo.xml*; do
162 *.gz) cmd="gzip -dc" ;;
163 *.bz2) cmd="bzip2 -dc" ;;
166 # only check the first deltainfo.xml*, in case there are more
169 deltainfofile="/nonexist"
170 if test -n "$cmd"; then
171 # we have some deltainfo.xml*
172 deltainfofile=`mktemp` || exit 3
173 $cmd $i | deltainfoxml2solv $parser_options > $deltainfofile || exit 4
177 # Now merge primary, patches, updateinfo, and deltainfo
178 if test -s $repomdfile; then
179 m_repomdfile=$repomdfile
181 if test -s $suseinfofile; then
182 m_suseinfofile=$suseinfofile
184 if test -s $primfile; then
187 if test -s $prodfile; then
190 if test -s $patchfile; then
191 m_patchfile=$patchfile
193 if test -s $updateinfofile; then
194 m_updateinfofile=$updateinfofile
196 if test -s $deltainfofile; then
197 m_deltainfofile=$deltainfofile
199 mergesolv $m_repomdfile $m_suseinfofile $m_primfile $m_prodfile $m_patchfile $m_updateinfofile $m_deltainfofile
200 rm -f $repomdfile $suseinfofile $primfile $prodfile $patchfile $updateinfofile $deltainfofile
202 elif test_susetags; then
204 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
205 if test -z $DESCR; then
206 DESCR=suse/setup/descr
208 cd ${DESCR} || exit 2
211 if test -s packages.gz; then
213 elif test -s packages.bz2; then
214 bzip2 -dc packages.bz2
215 elif test -s packages; then
220 if test -s packages.DU.gz; then
221 gzip -dc packages.DU.gz
222 elif test -s packages.DU.bz2; then
223 bzip2 -dc packages.DU.bz2
224 elif test -s packages.DU; then
228 # Now default language
229 if test -s packages.en.gz; then
230 gzip -dc packages.en.gz
231 elif test -s packages.en.bz2; then
232 bzip2 -dc packages.en.bz2
233 elif test -s packages.en; then
237 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
238 # but only those mentioned in the file 'patterns'
239 if test -f patterns; then
240 for i in `cat patterns`; do
241 test -s "$i" || continue
243 *.gz) gzip -dc "$i" ;;
244 *.bz2) bzip2 -dc "$i" ;;
250 # Now all other packages.{lang}. Needs to come last as it switches
251 # languages for all following susetags files
252 for i in packages.*; do
254 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
255 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
256 *) name="$i"; prog=cat ;;
259 # ignore files we handled already
260 *.DU | *.en | *.FL | packages ) continue ;;
262 suff=${name#packages.}
268 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
276 if test -n "$rpms" ; then
277 echo "$rpms" | rpms2solv -m -