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
147 *.gz) cmd="gzip -dc" ;;
148 *.bz2) cmd="bzip2 -dc" ;;
151 # only check the first updateinfo.xml*, in case there are more
154 updateinfofile="/nonexist"
155 if test -n "$cmd"; then
156 # we have some updateinfo.xml*
157 updateinfofile=`mktemp` || exit 3
158 $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*
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
195 # Now merge primary, patches, updateinfo, and deltainfo
196 if test -s $repomdfile; then
197 m_repomdfile=$repomdfile
199 if test -s $suseinfofile; then
200 m_suseinfofile=$suseinfofile
202 if test -s $primfile; then
205 if test -s $patternfile; then
206 m_patternfile=$patternfile
208 if test -s $prodfile; then
211 if test -s $patchfile; then
212 m_patchfile=$patchfile
214 if test -s $updateinfofile; then
215 m_updateinfofile=$updateinfofile
217 if test -s $deltainfofile; then
218 m_deltainfofile=$deltainfofile
220 mergesolv $m_repomdfile $m_suseinfofile $m_primfile $m_prodfile $m_patternfile $m_patchfile $m_updateinfofile $m_deltainfofile
221 rm -f $repomdfile $suseinfofile $primfile $patternfile $prodfile $patchfile $updateinfofile $deltainfofile
223 elif test_susetags; then
225 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
226 if test -z $DESCR; then
227 DESCR=suse/setup/descr
229 cd ${DESCR} || exit 2
232 if test -s packages.gz; then
234 elif test -s packages.bz2; then
235 bzip2 -dc packages.bz2
236 elif test -s packages; then
241 if test -s packages.DU.gz; then
242 gzip -dc packages.DU.gz
243 elif test -s packages.DU.bz2; then
244 bzip2 -dc packages.DU.bz2
245 elif test -s packages.DU; then
249 # Now default language
250 if test -s packages.en.gz; then
251 gzip -dc packages.en.gz
252 elif test -s packages.en.bz2; then
253 bzip2 -dc packages.en.bz2
254 elif test -s packages.en; then
258 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
259 # but only those mentioned in the file 'patterns'
260 if test -f patterns; then
261 for i in `cat patterns`; do
262 test -s "$i" || continue
264 *.gz) gzip -dc "$i" ;;
265 *.bz2) bzip2 -dc "$i" ;;
271 # Now all other packages.{lang}. Needs to come last as it switches
272 # languages for all following susetags files
273 for i in packages.*; do
275 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
276 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
277 *) name="$i"; prog=cat ;;
280 # ignore files we handled already
281 *.DU | *.en | *.FL | packages ) continue ;;
283 suff=${name#packages.}
289 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
294 test -e "$r" || continue
298 if test -n "$rpms" ; then
299 echo "${rpms#?}" | rpms2solv -m -