DISTARCH=i386
FERMIROOT=.
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/$COMPSFILE and $FERMIROOT/fermigroups.xml.main and $FERMIROOT/workgroups.xml.main then adding package dependency info"
echo "Writing it out as $FERMIROOT/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
WHERE=`pwd`
W1=`dirname $WHERE`
WHERE=`dirname $W1`
BASEDIR=`dirname $WHERE`
echo $BASENAME
$COMPEXTRA/getfullcomps.py  $PARTCOMPS $BASEDIR   $DISTARCH >> /tmp/$PARTCOMPS 
# put the "</comps>" at the end back
echo '</comps>' >> /tmp/$PARTCOMPS
cp /tmp/$PARTCOMPS comps.xml.new
