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
41 test -s "$i" || continue
44 *.bz2) bzip2 -dc "$i";;
52 for i in susedata.xml*; do
53 test -s "$i" || continue
56 *.bz2) bzip2 -dc "$i";;
63 ) | grep -v '\?xml' | sed '1i\<?xml version="1.0" encoding="UTF-8"?>' | rpmmd2solv $parser_options > $primfile || exit 4
67 if test -f product.xml; then
68 prodfile=`mktemp` || exit 3
71 for i in product*.xml*; do
73 *.gz) gzip -dc "$i" ;;
74 *.bz2) bzip2 -dc "$i" ;;
79 ) | grep -v '\?xml' | rpmmd2solv $parser_options > $prodfile || exit 4
82 patternfile="/nonexist"
83 for i in patterns.xml*; do
84 test -s "$i" || continue
86 patternfile=`mktemp` || exit 3
88 for i in patterns.xml*; do
89 test -s "$i" || continue
91 *.gz) gzip -dc "$i" ;;
92 *.bz2) bzip2 -dc "$i" ;;
96 ) | rpmmd2solv $parser_options > $patternfile || exit 4
100 # This contains repomd.xml
101 # for now we only read some keys like timestamp
102 if test -f repomd.xml || test -f repomd.xml.gz || test -f repomd.xml.bz2 ; then
103 for i in repomd.xml*; do
105 *.gz) cmd="gzip -dc" ;;
106 *.bz2) cmd="bzip2 -dc" ;;
109 # only check the first repomd.xml*, in case there are more
113 repomdfile="/nonexist"
114 if test -n "$cmd"; then
115 # we have some repomd.xml*
116 repomdfile=`mktemp` || exit 3
117 $cmd $i | repomdxml2solv $parser_options > $repomdfile || exit 4
121 # This contains suseinfo.xml, which is extensions to repomd.xml
122 # for now we only read some keys like expiration and products
123 if test -f suseinfo.xml || test -f suseinfo.xml.gz || test -f suseinfo.xml.bz2 ; then
124 for i in suseinfo.xml*; do
126 *.gz) cmd="gzip -dc" ;;
127 *.bz2) cmd="bzip2 -dc" ;;
130 # only check the first suseinfo.xml*, in case there are more
134 suseinfofile="/nonexist"
135 if test -n "$cmd"; then
136 # we have some suseinfo.xml*
137 suseinfofile=`mktemp` || exit 3
138 $cmd $i | repomdxml2solv $parser_options > $suseinfofile || exit 4
142 # This contains a updateinfo.xml* and maybe patches
143 if test -f updateinfo.xml || test -f updateinfo.xml.gz || test -f updateinfo.xml.bz2 ; then
144 for i in updateinfo.xml*; do
146 *.gz) cmd="gzip -dc" ;;
147 *.bz2) cmd="bzip2 -dc" ;;
150 # only check the first updateinfo.xml*, in case there are more
153 updateinfofile="/nonexist"
154 if test -n "$cmd"; then
155 # we have some updateinfo.xml*
156 updateinfofile=`mktemp` || exit 3
157 $cmd $i | updateinfoxml2solv $parser_options > $updateinfofile || exit 4
161 patchfile="/nonexist"
162 if test -f patches.xml; then
163 patchfile=`mktemp` || exit 3
166 for i in patch-*.xml*; do
168 *.gz) gzip -dc "$i" ;;
169 *.bz2) bzip2 -dc "$i" ;;
174 ) | grep -v '\?xml' | patchxml2solv $parser_options > $patchfile || exit 4
177 # This contains a deltainfo.xml*
178 if test -f deltainfo.xml || test -f deltainfo.xml.gz || test -f deltainfo.xml.bz2 ; then
179 for i in deltainfo.xml*; do
181 *.gz) cmd="gzip -dc" ;;
182 *.bz2) cmd="bzip2 -dc" ;;
185 # only check the first deltainfo.xml*, in case there are more
188 deltainfofile="/nonexist"
189 if test -n "$cmd"; then
190 # we have some deltainfo.xml*
191 deltainfofile=`mktemp` || exit 3
192 $cmd $i | deltainfoxml2solv $parser_options > $deltainfofile || exit 4
196 # Now merge primary, patches, updateinfo, and deltainfo
197 if test -s $repomdfile; then
198 m_repomdfile=$repomdfile
200 if test -s $suseinfofile; then
201 m_suseinfofile=$suseinfofile
203 if test -s $primfile; then
206 if test -s $patternfile; then
207 m_patternfile=$patternfile
209 if test -s $prodfile; then
212 if test -s $patchfile; then
213 m_patchfile=$patchfile
215 if test -s $updateinfofile; then
216 m_updateinfofile=$updateinfofile
218 if test -s $deltainfofile; then
219 m_deltainfofile=$deltainfofile
221 mergesolv $m_repomdfile $m_suseinfofile $m_primfile $m_prodfile $m_patternfile $m_patchfile $m_updateinfofile $m_deltainfofile
222 rm -f $repomdfile $suseinfofile $primfile $patternfile $prodfile $patchfile $updateinfofile $deltainfofile
224 elif test_susetags; then
226 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
227 if test -z $DESCR; then
228 DESCR=suse/setup/descr
230 cd ${DESCR} || exit 2
233 if test -s packages.gz; then
235 elif test -s packages.bz2; then
236 bzip2 -dc packages.bz2
237 elif test -s packages; then
242 if test -s packages.DU.gz; then
243 gzip -dc packages.DU.gz
244 elif test -s packages.DU.bz2; then
245 bzip2 -dc packages.DU.bz2
246 elif test -s packages.DU; then
250 # Now default language
251 if test -s packages.en.gz; then
252 gzip -dc packages.en.gz
253 elif test -s packages.en.bz2; then
254 bzip2 -dc packages.en.bz2
255 elif test -s packages.en; then
259 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
260 # but only those mentioned in the file 'patterns'
261 if test -f patterns; then
262 for i in `cat patterns`; do
263 test -s "$i" || continue
265 *.gz) gzip -dc "$i" ;;
266 *.bz2) bzip2 -dc "$i" ;;
272 # Now all other packages.{lang}. Needs to come last as it switches
273 # languages for all following susetags files
274 for i in packages.*; do
276 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
277 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
278 *) name="$i"; prog=cat ;;
281 # ignore files we handled already
282 *.DU | *.en | *.FL | packages ) continue ;;
284 suff=${name#packages.}
290 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
298 if test -n "$rpms" ; then
299 echo "$rpms" | rpms2solv -m -