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 updateinfo.xml* and maybe patches
51 if test -f updateinfo.xml || test -f updateinfo.xml.gz || test -f updateinfo.xml.bz2 ; then
52 for i in updateinfo.xml*; do
54 *.gz) cmd="gzip -dc" ;;
55 *.bz2) cmd="bzip2 -dc" ;;
58 # only check the first updateinfo.xml*, in case there are more
61 updateinfofile="/nonexist"
62 if test -n "$cmd"; then
63 # we have some updateinfo.xml*
64 updateinfofile=`mktemp` || exit 3
65 $cmd $i | updateinfoxml2solv $parser_options > $updateinfofile || exit 4
70 if test -f patches.xml; then
71 patchfile=`mktemp` || exit 3
74 for i in patch-*.xml*; do
76 *.gz) gzip -dc "$i" ;;
77 *.bz2) bzip2 -dc "$i" ;;
82 ) | grep -v '\?xml' | patchxml2solv $parser_options > $patchfile || exit 4
85 # This contains a deltainfo.xml*
86 if test -f deltainfo.xml || test -f deltainfo.xml.gz || test -f deltainfo.xml.bz2 ; then
87 for i in deltainfo.xml*; do
89 *.gz) cmd="gzip -dc" ;;
90 *.bz2) cmd="bzip2 -dc" ;;
93 # only check the first deltainfo.xml*, in case there are more
96 deltainfofile="/nonexist"
97 if test -n "$cmd"; then
98 # we have some deltainfo.xml*
99 deltainfofile=`mktemp` || exit 3
100 $cmd $i | deltainfoxml2solv $parser_options > $deltainfofile || exit 4
104 # Now merge primary, patches, updateinfo, and deltainfo
105 if test -s $primfile; then
108 if test -s $patchfile; then
109 m_patchfile=$patchfile
111 if test -s $updateinfofile; then
112 m_updateinfofile=$updateinfofile
114 if test -s $deltainfofile; then
115 m_deltainfofile=$deltainfofile
117 mergesolv $m_primfile $m_patchfile $m_updateinfofile $m_deltainfofile
118 rm -f $primfile $patchfile $updateinfofile $deltainfofile
120 elif test_susetags; then
122 DESCR=`grep DESCRDIR content | cut -d ' ' -f 2`
123 if test -z $DESCR; then
124 DESCR=suse/setup/descr
126 cd ${DESCR} || exit 2
129 if test -s packages.gz; then
131 elif test -s packages.bz2; then
132 bzip2 -dc packages.bz2
133 elif test -s packages; then
138 if test -s packages.DU.gz; then
139 gzip -dc packages.DU.gz
140 elif test -s packages.DU.bz2; then
141 bzip2 -dc packages.DU.bz2
142 elif test -s packages.DU; then
146 # Now default language
147 if test -s packages.en.gz; then
148 gzip -dc packages.en.gz
149 elif test -s packages.en.bz2; then
150 bzip2 -dc packages.en.bz2
151 elif test -s packages.en; then
155 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
156 # but only those mentioned in the file 'patterns'
157 if test -f patterns; then
158 for i in `cat patterns`; do
159 test -s "$i" || continue
161 *.gz) gzip -dc "$i" ;;
162 *.bz2) bzip2 -dc "$i" ;;
168 # Now all other packages.{lang}. Needs to come last as it switches
169 # languages for all following susetags files
170 for i in packages.*; do
172 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
173 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
174 *) name="$i"; prog=cat ;;
177 # ignore files we handled already
178 *.DU | *.en | *.FL | packages ) continue ;;
180 suff=${name#packages.}
186 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
194 if test -n "$rpms" ; then
195 echo "$rpms" | rpms2solv -m -