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
51 if test -f product.xml; then
52 prodfile=`mktemp` || exit 3
55 for i in product*.xml*; do
57 *.gz) gzip -dc "$i" ;;
58 *.bz2) bzip2 -dc "$i" ;;
63 ) | grep -v '\?xml' | rpmmd2solv $parser_options > $prodfile || exit 4
67 # This contains repomd.xml
68 # for now we only read some keys like expiration
69 if test -f repomd.xml || test -f repomd.xml.gz || test -f repomd.xml.bz2 ; then
70 for i in repomd.xml*; do
72 *.gz) cmd="gzip -dc" ;;
73 *.bz2) cmd="bzip2 -dc" ;;
76 # only check the first repomd.xml*, in case there are more
80 repomdfile="/nonexist"
81 if test -n "$cmd"; then
82 # we have some repomd.xml*
83 repomdfile=`mktemp` || exit 3
84 $cmd $i | repomdxml2solv $parser_options > $repomdfile || exit 4
88 # This contains a updateinfo.xml* and maybe patches
89 if test -f updateinfo.xml || test -f updateinfo.xml.gz || test -f updateinfo.xml.bz2 ; then
90 for i in updateinfo.xml*; do
92 *.gz) cmd="gzip -dc" ;;
93 *.bz2) cmd="bzip2 -dc" ;;
96 # only check the first updateinfo.xml*, in case there are more
99 updateinfofile="/nonexist"
100 if test -n "$cmd"; then
101 # we have some updateinfo.xml*
102 updateinfofile=`mktemp` || exit 3
103 $cmd $i | updateinfoxml2solv $parser_options > $updateinfofile || exit 4
107 patchfile="/nonexist"
108 if test -f patches.xml; then
109 patchfile=`mktemp` || exit 3
112 for i in patch-*.xml*; do
114 *.gz) gzip -dc "$i" ;;
115 *.bz2) bzip2 -dc "$i" ;;
120 ) | grep -v '\?xml' | patchxml2solv $parser_options > $patchfile || exit 4
123 # This contains a deltainfo.xml*
124 if test -f deltainfo.xml || test -f deltainfo.xml.gz || test -f deltainfo.xml.bz2 ; then
125 for i in deltainfo.xml*; do
127 *.gz) cmd="gzip -dc" ;;
128 *.bz2) cmd="bzip2 -dc" ;;
131 # only check the first deltainfo.xml*, in case there are more
134 deltainfofile="/nonexist"
135 if test -n "$cmd"; then
136 # we have some deltainfo.xml*
137 deltainfofile=`mktemp` || exit 3
138 $cmd $i | deltainfoxml2solv $parser_options > $deltainfofile || exit 4
142 # Now merge primary, patches, updateinfo, and deltainfo
143 if test -s $repomdfile; then
144 m_repomdfile=$repomdfile
146 if test -s $primfile; then
149 if test -s $prodfile; then
152 if test -s $patchfile; then
153 m_patchfile=$patchfile
155 if test -s $updateinfofile; then
156 m_updateinfofile=$updateinfofile
158 if test -s $deltainfofile; then
159 m_deltainfofile=$deltainfofile
161 mergesolv $m_repomdfile $m_primfile $m_prodfile $m_patchfile $m_updateinfofile $m_deltainfofile
162 rm -f $repomdfile $primfile $prodfile $patchfile $updateinfofile $deltainfofile
164 elif test_susetags; then
166 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
167 if test -z $DESCR; then
168 DESCR=suse/setup/descr
170 cd ${DESCR} || exit 2
173 if test -s packages.gz; then
175 elif test -s packages.bz2; then
176 bzip2 -dc packages.bz2
177 elif test -s packages; then
182 if test -s packages.DU.gz; then
183 gzip -dc packages.DU.gz
184 elif test -s packages.DU.bz2; then
185 bzip2 -dc packages.DU.bz2
186 elif test -s packages.DU; then
190 # Now default language
191 if test -s packages.en.gz; then
192 gzip -dc packages.en.gz
193 elif test -s packages.en.bz2; then
194 bzip2 -dc packages.en.bz2
195 elif test -s packages.en; then
199 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
200 # but only those mentioned in the file 'patterns'
201 if test -f patterns; then
202 for i in `cat patterns`; do
203 test -s "$i" || continue
205 *.gz) gzip -dc "$i" ;;
206 *.bz2) bzip2 -dc "$i" ;;
212 # Now all other packages.{lang}. Needs to come last as it switches
213 # languages for all following susetags files
214 for i in packages.*; do
216 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
217 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
218 *) name="$i"; prog=cat ;;
221 # ignore files we handled already
222 *.DU | *.en | *.FL | packages ) continue ;;
224 suff=${name#packages.}
230 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
238 if test -n "$rpms" ; then
239 echo "$rpms" | rpms2solv -m -