#!/bin/sh

LEVEL=0

dodir() {
        for file in *; do
                if [ -d $file ] && [ "$file" != "." ] && [ "$file" != ".." ] && [ "$file" != "files" ]; then
                        LEVEL=`expr $LEVEL + 1`
                        if [ $LEVEL -eq 1 ]; then
                                TAG="category"
                                SPACING="  "
                        else
                                TAG="package"
                                SPACING="    "
                        fi
                        echo "$SPACING<$TAG name=\"$file\">"
                        cd $file
                        dodir
                        cd ..
                        LEVEL=`expr $LEVEL - 1`
                        echo "$SPACING</$TAG>"
#                elif [ -f $file ] && [ "${file%%.ebuild}" != "$file" ]; then
                 elif [ -f $file ]; then
                        echo "$SPACING  <version name=\"$file\">"
                        /home/ykoehler/xmltest $file
#			(
#                                source $file &&
#                                echo "$SPACING    <description>$DESCRIPTION</description>" &&
#                                echo "$SPACING    <home-page>$HOMEPAGE</home-page>" &&
#                                echo "$SPACING    <dependencies>$DEPEND</dependencies>" &&
#                                echo "$SPACING    <runtime-dep>$RDEPEND</runtime-dep>"
#                                echo "$SPACING    <keywords>$KEYWORDS</keywords>" &&
#                                echo "$SPACING    <uses>$IUSE</uses>")
                        echo "$SPACING  </version>"
                fi
        done
}

cd /var/cache/edb/dep
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>"
echo "<gentoo>"
dodir
echo "</gentoo>"



