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 # signal an error if there is a problem
25 parser_options=${PARSER_OPTIONS:-}
27 if test "$1" = "-o" ; then
35 if test -d repodata ; then
39 if test -f primary.xml || test -f primary.xml.gz || test -f primary.xml.bz2 ; then
40 primfile=`mktemp` || exit 3
42 # fake tag to combine primary.xml and extensions
43 # like susedata.xml, other.xml, filelists.xml
45 for i in primary.xml* susedata.xml*; do
46 test -s "$i" || continue
49 *.bz2) bzip2 -dc "$i";;
57 for i in susedata.xml*; do
58 test -s "$i" || continue
61 *.bz2) bzip2 -dc "$i";;
68 ) | grep -v '\?xml' | sed '1i\<?xml version="1.0" encoding="UTF-8"?>' | rpmmd2solv $parser_options > $primfile || exit 4
72 if test -f product.xml; then
73 prodfile=`mktemp` || exit 3
76 for i in product*.xml*; do
78 *.gz) gzip -dc "$i" ;;
79 *.bz2) bzip2 -dc "$i" ;;
84 ) | grep -v '\?xml' | rpmmd2solv $parser_options > $prodfile || exit 4
88 patternfile="/nonexist"
89 for i in patterns.xml*; do
90 test -s "$i" || continue
92 *.gz) cmd='gzip -dc' ;;
93 *.bz2) cmd='bzip2 -dc' ;;
98 if test -n "$cmd" ; then
99 patternfile=`mktemp` || exit 3
100 $cmd "$i" | rpmmd2solv $parser_options > $patternfile || exit 4
103 # This contains repomd.xml
104 # for now we only read some keys like timestamp
106 for i in repomd.xml*; do
107 test -s "$i" || continue
109 *.gz) cmd="gzip -dc" ;;
110 *.bz2) cmd="bzip2 -dc" ;;
113 # only check the first repomd.xml*, in case there are more
116 repomdfile="/nonexist"
117 if test -n "$cmd"; then
118 # we have some repomd.xml*
119 repomdfile=`mktemp` || exit 3
120 $cmd "$i" | repomdxml2solv $parser_options > $repomdfile || exit 4
123 # This contains suseinfo.xml, which is extensions to repomd.xml
124 # for now we only read some keys like expiration and products
126 for i in suseinfo.xml*; do
127 test -s "$i" || continue
129 *.gz) cmd="gzip -dc" ;;
130 *.bz2) cmd="bzip2 -dc" ;;
133 # only check the first suseinfo.xml*, in case there are more
136 suseinfofile="/nonexist"
137 if test -n "$cmd"; then
138 # we have some suseinfo.xml*
139 suseinfofile=`mktemp` || exit 3
140 $cmd "$i" | repomdxml2solv $parser_options > $suseinfofile || exit 4
143 # This contains a updateinfo.xml* and maybe patches
145 for i in updateinfo.xml*; do
146 test -s "$i" || continue
148 *.gz) cmd="gzip -dc" ;;
149 *.bz2) cmd="bzip2 -dc" ;;
152 # only check the first updateinfo.xml*, in case there are more
155 updateinfofile="/nonexist"
156 if test -n "$cmd"; then
157 # we have some updateinfo.xml*
158 updateinfofile=`mktemp` || exit 3
159 $cmd "$i" | updateinfoxml2solv $parser_options > $updateinfofile || exit 4
162 patchfile="/nonexist"
163 if test -f patches.xml; then
164 patchfile=`mktemp` || exit 3
167 for i in patch-*.xml*; do
169 *.gz) gzip -dc "$i" ;;
170 *.bz2) bzip2 -dc "$i" ;;
175 ) | grep -v '\?xml' | patchxml2solv $parser_options > $patchfile || exit 4
178 # This contains a deltainfo.xml*
180 for i in deltainfo.xml*; do
181 test -s "$i" || continue
183 *.gz) cmd="gzip -dc" ;;
184 *.bz2) cmd="bzip2 -dc" ;;
187 # only check the first deltainfo.xml*, in case there are more
190 deltainfofile="/nonexist"
191 if test -n "$cmd"; then
192 # we have some deltainfo.xml*
193 deltainfofile=`mktemp` || exit 3
194 $cmd "$i" | deltainfoxml2solv $parser_options > $deltainfofile || exit 4
197 # Now merge primary, patches, updateinfo, and deltainfo
198 if test -s $repomdfile; then
199 m_repomdfile=$repomdfile
201 if test -s $suseinfofile; then
202 m_suseinfofile=$suseinfofile
204 if test -s $primfile; then
207 if test -s $patternfile; then
208 m_patternfile=$patternfile
210 if test -s $prodfile; then
213 if test -s $patchfile; then
214 m_patchfile=$patchfile
216 if test -s $updateinfofile; then
217 m_updateinfofile=$updateinfofile
219 if test -s $deltainfofile; then
220 m_deltainfofile=$deltainfofile
222 mergesolv $m_repomdfile $m_suseinfofile $m_primfile $m_prodfile $m_patternfile $m_patchfile $m_updateinfofile $m_deltainfofile
223 rm -f $repomdfile $suseinfofile $primfile $patternfile $prodfile $patchfile $updateinfofile $deltainfofile
225 elif test_susetags; then
227 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
228 if test -z $DESCR; then
229 DESCR=suse/setup/descr
231 cd ${DESCR} || exit 2
234 if test -s packages.gz; then
236 elif test -s packages.bz2; then
237 bzip2 -dc packages.bz2
238 elif test -s packages; then
243 if test -s packages.DU.gz; then
244 gzip -dc packages.DU.gz
245 elif test -s packages.DU.bz2; then
246 bzip2 -dc packages.DU.bz2
247 elif test -s packages.DU; then
251 # Now default language
252 if test -s packages.en.gz; then
253 gzip -dc packages.en.gz
254 elif test -s packages.en.bz2; then
255 bzip2 -dc packages.en.bz2
256 elif test -s packages.en; then
260 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
261 # but only those mentioned in the file 'patterns'
262 if test -f patterns; then
263 for i in `cat patterns`; do
264 test -s "$i" || continue
266 *.gz) gzip -dc "$i" ;;
267 *.bz2) bzip2 -dc "$i" ;;
273 # Now all other packages.{lang}. Needs to come last as it switches
274 # languages for all following susetags files
275 for i in packages.*; do
277 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
278 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
279 *) name="$i"; prog=cat ;;
282 # ignore files we handled already
283 *.DU | *.en | *.FL | packages ) continue ;;
285 suff=${name#packages.}
291 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
296 test -e "$r" || continue
300 if test -n "$rpms" ; then
301 echo "${rpms#?}" | rpms2solv -m -