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 repomd.xml
51 # for now we only read some keys like expiration
52 if test -f repomd.xml || test -f repomd.xml.gz || test -f repomd.xml.bz2 ; then
53 for i in repomd.xml*; do
55 *.gz) cmd="gzip -dc" ;;
56 *.bz2) cmd="bzip2 -dc" ;;
59 # only check the first updateinfo.xml*, in case there are more
63 repomdfile="/nonexist"
64 if test -n "$cmd"; then
65 # we have some repomd.xml*
66 repomdfile=`mktemp` || exit 3
67 $cmd $i | repomdxml2solv $parser_options > $repomdfile || exit 4
71 # This contains a updateinfo.xml* and maybe patches
72 if test -f updateinfo.xml || test -f updateinfo.xml.gz || test -f updateinfo.xml.bz2 ; then
73 for i in updateinfo.xml*; do
75 *.gz) cmd="gzip -dc" ;;
76 *.bz2) cmd="bzip2 -dc" ;;
79 # only check the first updateinfo.xml*, in case there are more
82 updateinfofile="/nonexist"
83 if test -n "$cmd"; then
84 # we have some updateinfo.xml*
85 updateinfofile=`mktemp` || exit 3
86 $cmd $i | updateinfoxml2solv $parser_options > $updateinfofile || exit 4
91 if test -f patches.xml; then
92 patchfile=`mktemp` || exit 3
95 for i in patch-*.xml*; do
97 *.gz) gzip -dc "$i" ;;
98 *.bz2) bzip2 -dc "$i" ;;
103 ) | grep -v '\?xml' | patchxml2solv $parser_options > $patchfile || exit 4
106 # This contains a deltainfo.xml*
107 if test -f deltainfo.xml || test -f deltainfo.xml.gz || test -f deltainfo.xml.bz2 ; then
108 for i in deltainfo.xml*; do
110 *.gz) cmd="gzip -dc" ;;
111 *.bz2) cmd="bzip2 -dc" ;;
114 # only check the first deltainfo.xml*, in case there are more
117 deltainfofile="/nonexist"
118 if test -n "$cmd"; then
119 # we have some deltainfo.xml*
120 deltainfofile=`mktemp` || exit 3
121 $cmd $i | deltainfoxml2solv $parser_options > $deltainfofile || exit 4
125 # Now merge primary, patches, updateinfo, and deltainfo
126 if test -s $repomdfile; then
127 m_repomdfile=$repomdfile
129 if test -s $primfile; then
132 if test -s $patchfile; then
133 m_patchfile=$patchfile
135 if test -s $updateinfofile; then
136 m_updateinfofile=$updateinfofile
138 if test -s $deltainfofile; then
139 m_deltainfofile=$deltainfofile
141 mergesolv $m_repomdfile $m_primfile $m_patchfile $m_updateinfofile $m_deltainfofile
142 rm -f $repomdfile $primfile $patchfile $updateinfofile $deltainfofile
144 elif test_susetags; then
146 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
147 if test -z $DESCR; then
148 DESCR=suse/setup/descr
150 cd ${DESCR} || exit 2
153 if test -s packages.gz; then
155 elif test -s packages.bz2; then
156 bzip2 -dc packages.bz2
157 elif test -s packages; then
162 if test -s packages.DU.gz; then
163 gzip -dc packages.DU.gz
164 elif test -s packages.DU.bz2; then
165 bzip2 -dc packages.DU.bz2
166 elif test -s packages.DU; then
170 # Now default language
171 if test -s packages.en.gz; then
172 gzip -dc packages.en.gz
173 elif test -s packages.en.bz2; then
174 bzip2 -dc packages.en.bz2
175 elif test -s packages.en; then
179 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
180 # but only those mentioned in the file 'patterns'
181 if test -f patterns; then
182 for i in `cat patterns`; do
183 test -s "$i" || continue
185 *.gz) gzip -dc "$i" ;;
186 *.bz2) bzip2 -dc "$i" ;;
192 # Now all other packages.{lang}. Needs to come last as it switches
193 # languages for all following susetags files
194 for i in packages.*; do
196 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
197 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
198 *) name="$i"; prog=cat ;;
201 # ignore files we handled already
202 *.DU | *.en | *.FL | packages ) continue ;;
204 suff=${name#packages.}
210 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
218 if test -n "$rpms" ; then
219 echo "$rpms" | rpms2solv -m -