DISTARCH=i386
FERMIROOT=/mnt/src/90rolling/
COMPSFILE=comps.xml.main
COMPEXTRA=/usr/share/comps-extras/
export PYTHONPATH=/usr/lib/anaconda
PARTCOMPS=comps.xml.tmp
cd $FERMIROOT/$DISTARCH/RedHat/base
echo "Taking $FERMIROOT/$DISTARCH/RedHat/base/$COMPSFILE and $FERMIROOT/$DISTARCH/RedHat/base/fermigroups.xml.main and $FERMIROOT/$DISTARCH/RedHat/base/workgroups.xml.main then adding package dependency info"
echo "Writing it out as $FERMIROOT/$DISTARCH/RedHat/base/comps.xml.new "
# gets rid of the "</comps>" at the end temporatily
cat $COMPSFILE |sed 's!</comps>!!g' > $PARTCOMPS
# adding in the fermi groups such as Fermi Desktop 
if [ -s fermigroups.xml.main ] ; then
  cat fermigroups.xml.main >> $PARTCOMPS
fi
# adding in the workgroups
if [ -s workgroups.xml.main ] ; then
  cat workgroups.xml.main >> $PARTCOMPS
fi
# put the "</comps>" at the end back
cp $PARTCOMPS /tmp
echo '</comps>' >> $PARTCOMPS
# adding in the package dependency info
$COMPEXTRA/getfullcomps.py  $PARTCOMPS $FERMIROOT  $DISTARCH >> /tmp/$PARTCOMPS 
# put the "</comps>" at the end back
echo '</comps>' >> /tmp/$PARTCOMPS
cp /tmp/$PARTCOMPS comps.xml.new
