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
24 parser_options=${PARSER_OPTIONS:-}
29 if test -d repodata; then
32 # This contains a primary.xml* and maybe patches
33 for i in primary.xml*; do
35 *.gz) cmd="gzip -dc" ;;
36 *.bz2) cmd="bzip2 -dc" ;;
39 # only check the first primary.xml*, in case there are more
43 if test -n "$cmd"; then
44 # we have some primary.xml*
45 primfile=`mktemp` || exit 3
46 $cmd $i | rpmmd2solv $parser_options > $primfile || exit 4
49 # This contains a updateinfo.xml* and maybe patches
50 if test -f updateinfo.xml || test -f updateinfo.xml.gz || test -f updateinfo.xml.bz2 ; then
51 for i in updateinfo.xml*; do
53 *.gz) cmd="gzip -dc" ;;
54 *.bz2) cmd="bzip2 -dc" ;;
57 # only check the first updateinfo.xml*, in case there are more
60 updateinfofile="/nonexist"
61 if test -n "$cmd"; then
62 # we have some updateinfo.xml*
63 updateinfofile=`mktemp` || exit 3
64 $cmd $i | updateinfoxml2solv $parser_options > $updateinfofile || exit 4
69 if test -f patches.xml; then
70 patchfile=`mktemp` || exit 3
73 for i in patch-*.xml*; do
75 *.gz) gzip -dc "$i" ;;
76 *.bz2) bzip2 -dc "$i" ;;
81 ) | grep -v '\?xml' | patchxml2solv $parser_options > $patchfile || exit 4
84 # This contains a deltainfo.xml*
85 if test -f deltainfo.xml || test -f deltainfo.xml.gz || test -f deltainfo.xml.bz2 ; then
86 for i in deltainfo.xml*; do
88 *.gz) cmd="gzip -dc" ;;
89 *.bz2) cmd="bzip2 -dc" ;;
92 # only check the first deltainfo.xml*, in case there are more
95 deltainfofile="/nonexist"
96 if test -n "$cmd"; then
97 # we have some deltainfo.xml*
98 deltainfofile=`mktemp` || exit 3
99 $cmd $i | deltainfoxml2solv $parser_options > $deltainfofile || exit 4
103 # Now merge primary, patches, updateinfo, and deltainfo
104 if test -s $primfile; then
107 if test -s $patchfile; then
108 m_patchfile=$patchfile
110 if test -s $updateinfofile; then
111 m_updateinfofile=$updateinfofile
113 if test -s $deltainfofile; then
114 m_deltainfofile=$deltainfofile
116 mergesolv $m_primfile $m_patchfile $m_updateinfofile $m_deltainfofile
117 rm -f $primfile $patchfile $updateinfofile $deltainfofile
119 elif test_susetags; then
121 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
122 if test -z $DESCR; then
123 DESCR=suse/setup/descr
125 cd ${DESCR} || exit 2
128 if test -s packages.gz; then
130 elif test -s packages.bz2; then
131 bzip2 -dc packages.bz2
132 elif test -s packages; then
137 if test -s packages.DU.gz; then
138 gzip -dc packages.DU.gz
139 elif test -s packages.DU.bz2; then
140 bzip2 -dc packages.DU.bz2
141 elif test -s packages.DU; then
145 # Now default language
146 if test -s packages.en.gz; then
147 gzip -dc packages.en.gz
148 elif test -s packages.en.bz2; then
149 bzip2 -dc packages.en.bz2
150 elif test -s packages.en; then
154 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
155 # but only those mentioned in the file 'patterns'
156 if test -f patterns; then
157 for i in `cat patterns`; do
158 test -s "$i" || continue
160 *.gz) gzip -dc "$i" ;;
161 *.bz2) bzip2 -dc "$i" ;;
167 # Now all other packages.{lang}. Needs to come last as it switches
168 # languages for all following susetags files
169 for i in packages.*; do
171 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
172 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
173 *) name="$i"; prog=cat ;;
176 # ignore files we handled already
177 *.DU | *.en | *.FL | packages ) continue ;;
179 suff=${name#packages.}
185 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
193 if test -n "$rpms" ; then
194 echo "$rpms" | rpms2solv -m -