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
33 # This contains a primary.xml* and maybe patches
34 for i in primary.xml*; do
36 *.gz) cmd="gzip -dc" ;;
37 *.bz2) cmd="bzip2 -dc" ;;
40 # only check the first primary.xml*, in case there are more
44 if test -n "$cmd"; then
45 # we have some primary.xml*
46 primfile=`mktemp` || exit 3
47 $cmd $i | rpmmd2solv $parser_options > $primfile || exit 4
50 # This contains a susedata.xml* with extended primary data
51 if test -f susedata.xml || test -f susedata.xml.gz || test -f susedata.xml.bz2 ; then
52 for i in susedata.xml*; do
54 *.gz) cmd="gzip -dc" ;;
55 *.bz2) cmd="bzip2 -dc" ;;
58 # only check the first susedata.xml*, in case there are more
61 susedatafile="/nonexist"
62 if test -n "$cmd"; then
63 # we have some susedata.xml*
64 susedatafile=`mktemp` || exit 3
65 $cmd $i | rpmmd2solv $parser_options > $susedatafile || exit 4
70 if test -f product.xml; then
71 prodfile=`mktemp` || exit 3
74 for i in product*.xml*; do
76 *.gz) gzip -dc "$i" ;;
77 *.bz2) bzip2 -dc "$i" ;;
82 ) | grep -v '\?xml' | rpmmd2solv $parser_options > $prodfile || exit 4
86 # This contains repomd.xml
87 # for now we only read some keys like expiration
88 if test -f repomd.xml || test -f repomd.xml.gz || test -f repomd.xml.bz2 ; then
89 for i in repomd.xml*; do
91 *.gz) cmd="gzip -dc" ;;
92 *.bz2) cmd="bzip2 -dc" ;;
95 # only check the first repomd.xml*, in case there are more
99 repomdfile="/nonexist"
100 if test -n "$cmd"; then
101 # we have some repomd.xml*
102 repomdfile=`mktemp` || exit 3
103 $cmd $i | repomdxml2solv $parser_options > $repomdfile || exit 4
107 # This contains a updateinfo.xml* and maybe patches
108 if test -f updateinfo.xml || test -f updateinfo.xml.gz || test -f updateinfo.xml.bz2 ; then
109 for i in updateinfo.xml*; do
111 *.gz) cmd="gzip -dc" ;;
112 *.bz2) cmd="bzip2 -dc" ;;
115 # only check the first updateinfo.xml*, in case there are more
118 updateinfofile="/nonexist"
119 if test -n "$cmd"; then
120 # we have some updateinfo.xml*
121 updateinfofile=`mktemp` || exit 3
122 $cmd $i | updateinfoxml2solv $parser_options > $updateinfofile || exit 4
126 patchfile="/nonexist"
127 if test -f patches.xml; then
128 patchfile=`mktemp` || exit 3
131 for i in patch-*.xml*; do
133 *.gz) gzip -dc "$i" ;;
134 *.bz2) bzip2 -dc "$i" ;;
139 ) | grep -v '\?xml' | patchxml2solv $parser_options > $patchfile || exit 4
142 # This contains a deltainfo.xml*
143 if test -f deltainfo.xml || test -f deltainfo.xml.gz || test -f deltainfo.xml.bz2 ; then
144 for i in deltainfo.xml*; do
146 *.gz) cmd="gzip -dc" ;;
147 *.bz2) cmd="bzip2 -dc" ;;
150 # only check the first deltainfo.xml*, in case there are more
153 deltainfofile="/nonexist"
154 if test -n "$cmd"; then
155 # we have some deltainfo.xml*
156 deltainfofile=`mktemp` || exit 3
157 $cmd $i | deltainfoxml2solv $parser_options > $deltainfofile || exit 4
161 # Now merge primary, patches, updateinfo, and deltainfo
162 if test -s $repomdfile; then
163 m_repomdfile=$repomdfile
165 if test -s $susedatafile; then
166 m_susedata=$susedatafile
168 if test -s $primfile; then
171 if test -s $prodfile; then
174 if test -s $patchfile; then
175 m_patchfile=$patchfile
177 if test -s $updateinfofile; then
178 m_updateinfofile=$updateinfofile
180 if test -s $deltainfofile; then
181 m_deltainfofile=$deltainfofile
183 mergesolv $m_repomdfile $m_primfile $m_susedatafile $m_prodfile $m_patchfile $m_updateinfofile $m_deltainfofile
184 rm -f $repomdfile $primfile $prodfile $patchfile $updateinfofile $deltainfofile
186 elif test_susetags; then
188 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
189 if test -z $DESCR; then
190 DESCR=suse/setup/descr
192 cd ${DESCR} || exit 2
195 if test -s packages.gz; then
197 elif test -s packages.bz2; then
198 bzip2 -dc packages.bz2
199 elif test -s packages; then
204 if test -s packages.DU.gz; then
205 gzip -dc packages.DU.gz
206 elif test -s packages.DU.bz2; then
207 bzip2 -dc packages.DU.bz2
208 elif test -s packages.DU; then
212 # Now default language
213 if test -s packages.en.gz; then
214 gzip -dc packages.en.gz
215 elif test -s packages.en.bz2; then
216 bzip2 -dc packages.en.bz2
217 elif test -s packages.en; then
221 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
222 # but only those mentioned in the file 'patterns'
223 if test -f patterns; then
224 for i in `cat patterns`; do
225 test -s "$i" || continue
227 *.gz) gzip -dc "$i" ;;
228 *.bz2) bzip2 -dc "$i" ;;
234 # Now all other packages.{lang}. Needs to come last as it switches
235 # languages for all following susetags files
236 for i in packages.*; do
238 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
239 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
240 *) name="$i"; prog=cat ;;
243 # ignore files we handled already
244 *.DU | *.en | *.FL | packages ) continue ;;
246 suff=${name#packages.}
252 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
260 if test -n "$rpms" ; then
261 echo "$rpms" | rpms2solv -m -