#!/usr/bin/perl
open (INSTALL_FILE, '>build-install.xml') ;
print INSTALL_FILE<<DDD;
<project name="XMLPublication Project" default="install" basedir='.' >
  <target name="clean">
    <ant dir="empty_project" target="clean"/>
  </target>

<property name="XMLPublicationSite" value='http://wwbota.free.fr/XMLPublication' />

<target name="install" >
   <get src="\$\{XMLPublicationSite\}/lib/saxon.jar"
	dest="lib/saxon.jar" 
	verbose="true"
	usetimestamp="true"/>
DDD

use Cwd;
$PWD=cwd();
for $DIR ( 'kernel/', 'empty_project/', '.' ) {
chdir("$PWD/$DIR");
print STDERR cwd(), "\n";
print STDERR $DIR, "\n";
system('cvs status -l $DIR | grep File: > ' . "tmp.get");
open  ( FILELIST, "tmp.get");
$RELATIVE_REMOTE_DIR=$DIR;
if ( $RELATIVE_REMOTE_DIR eq '.' ) {$RELATIVE_REMOTE_DIR='' }

LINE:
  while (<FILELIST>) {
    s/File: // ;
    # s/([^ ]+) .*/$1/ ;
    split;
    $_ = @_[0];
    s/(.*)/<get src="\$\{XMLPublicationSite\}\/$RELATIVE_REMOTE_DIR$1" dest="$DIR\/$1" verbose="true" usetimestamp="true"\/>/ ;
  } continue {
    print INSTALL_FILE or die "-p destination: $!\n";
  }
close ( FILELIST );
chdir("..");
}

print INSTALL_FILE<<FFF; 
</target>
</project>
FFF
