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
7 # this should signal an error if there is a problem
11 parser_options=${PARSER_OPTIONS:-}
16 if test -d repodata; then
19 # This contains a primary.xml* and maybe patches
20 for i in primary.xml*; do
22 *.gz) cmd="gzip -dc" ;;
23 *.bz2) cmd="bzip2 -dc" ;;
26 # only check the first primary.xml*, in case there are more
30 if test -n "$cmd"; then
31 # we have some primary.xml*
32 primfile=`mktemp` || exit 3
33 $cmd $i | rpmmd2solv $parser_options > $primfile || exit 4
36 # This contains a updateinfo.xml* and maybe patches
37 if test -f updateinfo.xml || test -f updateinfo.xml.gz || test -f updateinfo.xml.bz2 ; then
38 for i in updateinfo.xml*; do
40 *.gz) cmd="gzip -dc" ;;
41 *.bz2) cmd="bzip2 -dc" ;;
44 # only check the first updateinfo.xml*, in case there are more
47 updateinfofile="/nonexist"
48 if test -n "$cmd"; then
49 # we have some updateinfo.xml*
50 updateinfofile=`mktemp` || exit 3
51 $cmd $i | updateinfoxml2solv $parser_options > $updateinfofile || exit 4
56 if test -f patches.xml; then
57 patchfile=`mktemp` || exit 3
60 for i in patch-*.xml*; do
62 *.gz) gzip -dc "$i" ;;
63 *.bz2) bzip2 -dc "$i" ;;
68 ) | grep -v '\?xml' | patchxml2solv $parser_options > $patchfile || exit 4
71 # This contains a deltainfo.xml*
72 if test -f deltainfo.xml || test -f deltainfo.xml.gz || test -f deltainfo.xml.bz2 ; then
73 for i in deltainfo.xml*; do
75 *.gz) cmd="gzip -dc" ;;
76 *.bz2) cmd="bzip2 -dc" ;;
79 # only check the first deltainfo.xml*, in case there are more
82 deltainfofile="/nonexist"
83 if test -n "$cmd"; then
84 # we have some deltainfo.xml*
85 deltainfofile=`mktemp` || exit 3
86 $cmd $i | deltainfoxml2solv $parser_options > $deltainfofile || exit 4
90 # Now merge primary, patches, updateinfo, and deltainfo
91 if test -s $primfile; then
94 if test -s $patchfile; then
95 m_patchfile=$patchfile
97 if test -s $updateinfofile; then
98 m_updateinfofile=$updateinfofile
100 if test -s $deltainfofile; then
101 m_deltainfofile=$deltainfofile
103 mergesolv $m_primfile $m_patchfile $m_updateinfofile $m_deltainfofile
104 rm -f $primfile $patchfile $updateinfofile $deltainfofile
106 elif test -d suse/setup/descr && test -s content; then
108 cd suse/setup/descr || exit 2
111 if test -s packages.gz; then
113 elif test -s packages.bz2; then
114 bzip2 -dc packages.bz2
115 elif test -s packages; then
120 if test -s packages.DU.gz; then
121 gzip -dc packages.DU.gz
122 elif test -s packages.DU.bz2; then
123 bzip2 -dc packages.DU.bz2
124 elif test -s packages.DU; then
128 # Now default language
129 if test -s packages.en.gz; then
130 gzip -dc packages.en.gz
131 elif test -s packages.en.bz2; then
132 bzip2 -dc packages.en.bz2
133 elif test -s packages.en; then
137 # Now patterns. Not simply those files matching *.pat{,.gz,bz2},
138 # but only those mentioned in the file 'patterns'
139 if test -f patterns; then
140 for i in `cat patterns`; do
141 test -s "$i" || continue
143 *.gz) gzip -dc "$i" ;;
144 *.bz2) bzip2 -dc "$i" ;;
150 # Now all other packages.{lang}. Needs to come last as it switches
151 # languages for all following susetags files
152 for i in packages.*; do
154 *.gz) name="${i%.gz}" ; prog="gzip -dc" ;;
155 *.bz2) name="${i%.bz2}" ; prog="bzip2 -dc" ;;
156 *) name="$i"; prog=cat ;;
159 # ignore files we handled already
160 *.DU | *.en | *.FL | packages ) continue ;;
162 suff=${name#packages.}
168 ) | susetags2solv -c "${olddir}/content" $parser_options || exit 4
176 if test -n "$rpms" ; then
177 echo "$rpms" | rpms2solv -m -