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:-}
30 if test "$1" = "-o" ; then
34 elif test "$1" = "-R" ; then
45 if test -d repodata ; then
49 if test -f primary.xml || test -f primary.xml.gz || test -f primary.xml.bz2 ; then
50 primfile=`mktemp` || exit 3
52 # fake tag to combine primary.xml and extensions
53 # like susedata.xml, other.xml, filelists.xml
55 for i in primary.xml* susedata.xml*; do
56 test -s "$i" || continue
59 *.bz2) bzip2 -dc "$i";;
67 for i in susedata.xml*; do
68 test -s "$i" || continue
71 *.bz2) bzip2 -dc "$i";;
78 ) | grep -v '\?xml' | sed '1i\<?xml version="1.0" encoding="UTF-8"?>' | rpmmd2solv $parser_options > $primfile || exit 4
82 if test -f product.xml; then
83 prodfile=`mktemp` || exit 3
86 for i in product*.xml*; do
88 *.gz) gzip -dc "$i" ;;
89 *.bz2) bzip2 -dc "$i" ;;
94 ) | grep -v '\?xml' | rpmmd2solv $parser_options > $prodfile || exit 4
98 patternfile="/nonexist"
99 for i in patterns.xml*; do
100 test -s "$i" || continue
102 *.gz) cmd='gzip -dc' ;;
103 *.bz2) cmd='bzip2 -dc' ;;
108 if test -n "$cmd" ; then
109 patternfile=`mktemp` || exit 3
110 $cmd "$i" | rpmmd2solv $parser_options > $patternfile || exit 4
113 # This contains repomd.xml
114 # for now we only read some keys like timestamp
116 for i in repomd.xml*; do
117 test -s "$i" || continue
119 *.gz) cmd="gzip -dc" ;;
120 *.bz2) cmd="bzip2 -dc" ;;
123 # only check the first repomd.xml*, in case there are more
126 repomdfile="/nonexist"
127 if test -n "$cmd"; then
128 # we have some repomd.xml*
129 repomdfile=`mktemp` || exit 3
130 $cmd "$i" | repomdxml2solv $parser_options > $repomdfile || exit 4
133 # This contains suseinfo.xml, which is extensions to repomd.xml
134 # for now we only read some keys like expiration and products
136 for i in suseinfo.xml*; do
137 test -s "$i" || continue
139 *.gz) cmd="gzip -dc" ;;
140 *.bz2) cmd="bzip2 -dc" ;;
143 # only check the first suseinfo.xml*, in case there are more
146 suseinfofile="/nonexist"
147 if test -n "$cmd"; then
148 # we have some suseinfo.xml*
149 suseinfofile=`mktemp` || exit 3
150 $cmd "$i" | repomdxml2solv $parser_options > $suseinfofile || exit 4
153 # This contains a updateinfo.xml* and maybe patches
155 for i in updateinfo.xml*; do
156 test -s "$i" || continue
158 *.gz) cmd="gzip -dc" ;;
159 *.bz2) cmd="bzip2 -dc" ;;
162 # only check the first updateinfo.xml*, in case there are more
165 updateinfofile="/nonexist"
166 if test -n "$cmd"; then
167 # we have some updateinfo.xml*
168 updateinfofile=`mktemp` || exit 3
169 $cmd "$i" | updateinfoxml2solv $parser_options > $updateinfofile || exit 4
172 patchfile="/nonexist"
173 if test -f patches.xml; then
174 patchfile=`mktemp` || exit 3
177 for i in patch-*.xml*; do
179 *.gz) gzip -dc "$i" ;;
180 *.bz2) bzip2 -dc "$i" ;;
185 ) | grep -v '\?xml' | patchxml2solv $parser_options > $patchfile || exit 4
188 # This contains a deltainfo.xml*
190 for i in deltainfo.xml*; do
191 test -s "$i" || continue
193 *.gz) cmd="gzip -dc" ;;
194 *.bz2) cmd="bzip2 -dc" ;;
197 # only check the first deltainfo.xml*, in case there are more
200 deltainfofile="/nonexist"
201 if test -n "$cmd"; then
202 # we have some deltainfo.xml*
203 deltainfofile=`mktemp` || exit 3
204 $cmd "$i" | deltainfoxml2solv $parser_options > $deltainfofile || exit 4
207 # Now merge primary, patches, updateinfo, and deltainfo
208 if test -s $repomdfile; then
209 m_repomdfile=$repomdfile
211 if test -s $suseinfofile; then
212 m_suseinfofile=$suseinfofile
214 if test -s $primfile; then
217 if test -s $patternfile; then
218 m_patternfile=$patternfile
220 if test -s $prodfile; then
223 if test -s $patchfile; then
224 m_patchfile=$patchfile
226 if test -s $updateinfofile; then
227 m_updateinfofile=$updateinfofile
229 if test -s $deltainfofile; then
230 m_deltainfofile=$deltainfofile
232 mergesolv $m_repomdfile $m_suseinfofile $m_primfile $m_prodfile $m_patternfile $m_patchfile $m_updateinfofile $m_deltainfofile
233 rm -f $repomdfile $suseinfofile $primfile $patternfile $prodfile $patchfile $updateinfofile $deltainfofile
235 elif test_susetags; then
237 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
238 if test -z $DESCR; then
239 DESCR=suse/setup/descr
241 cd ${DESCR} || exit 2
244 if test -s packages.gz; then
246 elif test -s packages.bz2; then
247 bzip2 -dc packages.bz2
248 elif test -s packages; then
253 if test -s packages.DU.gz; then
254 gzip -dc packages.DU.gz
255 elif test -s packages.DU.bz2; then
256 bzip2 -dc packages.DU.bz2
257 elif test -s packages.DU; then
261 # Now default language
262 if test -s packages.en.gz; then
263 gzip -dc packages.en.gz
264 elif test -s packages.en.bz2; then
265 bzip2 -dc packages.en.bz2
266 elif test -s packages.en; then
270 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
271 # but only those mentioned in the file 'patterns'
272 if test -f patterns; then
273 for i in `cat patterns`; do
274 test -s "$i" || continue
276 *.gz) gzip -dc "$i" ;;
277 *.bz2) bzip2 -dc "$i" ;;
283 # Now all other packages.{lang}. Needs to come last as it switches
284 # languages for all following susetags files
285 for i in packages.*; do
287 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
288 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
289 *) name="$i"; prog=cat ;;
292 # ignore files we handled already
293 *.DU | *.en | *.FL | packages ) continue ;;
295 suff=${name#packages.}
301 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
304 find * -name .\* -prune -o $findopt -name \*.delta.rpm -o -name \*.patch.rpm -o -name \*.rpm -a -type f -print0 | rpms2solv -0 -m -