Index: fedkit/splitter.pl
===================================================================
--- fedkit/splitter.pl	(revision fe459d02cb022a98225e4ba1f755da814047521d)
+++ fedkit/splitter.pl	(revision 4e794c9f337baa37b7c810d97f838b2b6dfc0410)
@@ -112,8 +112,8 @@
 # current user is used.
 sub scp_file {
-    my($file, $where, $dest) = @_;
+    my($file, $user, $host, $dest) = @_;
 
     # XXX system with a relative pathname is sort of gross
-    system("scp $file $where:$dest");
+    system("scp $file $user\@$host:$dest");
     if ($?) {
 	warn "scp failed $?\n";
@@ -149,5 +149,5 @@
     &ssh_cmd($user, $host, "mkdir -p $dest_dir");
     for $s (@scripts) {
-	&scp_file("$local_script_dir/$s", "$user\@$host", $dest_dir) || 
+	&scp_file("$local_script_dir/$s", $user, $host, $dest_dir) || 
 	    return 0;
     }
@@ -174,5 +174,5 @@
 	}
 	else {
-	    &scp_file("$src_dir/$f", "$user\@$host", $dest_dir) || return 0;
+	    &scp_file("$src_dir/$f", $user, $host, $dest_dir) || return 0;
 	}
     }
@@ -200,4 +200,5 @@
 					    # sub-experiment
     my($proj_dir) = "/proj/$pid/exp/$eid/tmp";  # Where to stash federation stuff
+    my($tarfiles_dir) = "/proj/$pid/tarfiles/$eid";  # Where to stash tarfiles
     my($to_hostname) = "$proj_dir/hosts";   # remote hostnames file
     my($status) = new IO::Pipe;		    # The pipe to get status
@@ -217,5 +218,5 @@
     # Copy the experiment definition data over 
     print "transferring subexperiment to $tb\n" if $verbose;
-    &scp_file("$tmpdir/$tb/$tclfile", "$user\@$host") || return 0;
+    &scp_file("$tmpdir/$tb/$tclfile", $user, $host) || return 0;
     # Clear out any old experiment data; if not deleted, copies over it by
     # different users will fail.
@@ -227,12 +228,22 @@
     &ssh_cmd($user, $host, "/bin/sh -c \\'/bin/rm -rf $proj_dir/*\\'") || 
 	return 0;
+    print "clearing experiment tarfiles subdirs on $tb\n" if $verbose;
+    &ssh_cmd($user, $host, "/bin/rm -rf $tarfiles_dir/") || 
+	return 0;
+    print "creating tarfiles subdir $tarfiles_dir on $tb\n" if $verbose;
+    &ssh_cmd($user, $host, "mkdir -p $tarfiles_dir", "create tarfiles") || 
+	return 0;
     # Remote experiment is active.  Modify it.
     if ($state eq "active") {
 	print "Transferring federation support files to $tb\n" if $verbose;
 	# First copy new scripts and hostinfo into the remote /proj
-	&scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||
+	&scp_file("$tmpdir/hostnames", $user, $host, $to_hostname) ||
 	    return 0;
 	&ship_scripts($host, $user, $proj_dir) || return 0;
 	&ship_configs($host, $user, "$tmpdir/$tb", $proj_dir) || return 0;
+	if ( -d "$tmpdir/tarfiles") {
+	    &ship_configs($host, $user, "$tmpdir/tarfiles", $tarfiles_dir) || 
+		return 0;
+	}
 
 	print "Modifying $eid in place on $tb\n" if $verbose;
@@ -247,8 +258,12 @@
 	# First copy new scripts and hostinfo into the remote /proj (because
 	# the experiment exists, the directory tree should be there.
-	&scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||
+	&scp_file("$tmpdir/hostnames", $user, $host, $to_hostname) ||
 	    return 0;
 	&ship_scripts($host, $user, $proj_dir) || return 0;
 	&ship_configs($host, $user, "$tmpdir/$tb", $proj_dir) || return 0;
+	if ( -d "$tmpdir/tarfiles") {
+	    &ship_configs($host, $user, "$tmpdir/tarfiles", $tarfiles_dir) || 
+		return 0;
+	}
 
 	print "Modifying $eid on $tb\n" if $verbose;
@@ -265,4 +280,11 @@
     # the configuration files and scripts into the new experiment directories.
     if ($state eq "none") {
+
+	if ( -d "$tmpdir/tarfiles") {
+	    # Tarfiles have to exist for the creation to work
+	    print "copying tarfiles to $tb\n";
+	    &ship_configs($host, $user, "$tmpdir/tarfiles", $tarfiles_dir) || 
+		return 0;
+	}
 	print "Creating $eid on $tb\n" if $verbose;
 	&ssh_cmd($user, $host, "/usr/testbed/bin/startexp -i -f -w -p " . 
@@ -270,5 +292,5 @@
 	print "Transferring federation support files to $tb\n" if $verbose;
 	# First copy new scripts and hostinfo into the remote /proj
-	&scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||
+	&scp_file("$tmpdir/hostnames", $user, $host, $to_hostname) ||
 	    return 0;
 	&ship_scripts($host, $user, $proj_dir) || return 0;
@@ -574,4 +596,6 @@
     # XXX: oh is this bad
     s#GWCONF#FEDDIR\`hostname\`.gw.conf#g;
+    s#PROJDIR#/proj/$project{$ctb}/#g;
+    s#EID#$eid#g;
     s#FEDDIR#/proj/$project{$ctb}/exp/$eid/tmp/#g;
     print FILE;
@@ -582,12 +606,10 @@
 for $t (@tarfiles) {
     die "tarfile '$t' unreadable: $!\n" unless -r $t;
-    for $tb (keys %allocated) {
-	unless (-d "$tmpdir/$tb/tarfiles") {
-	    mkdir("$tmpdir/$tb/tarfiles") || 
-		die "Can't create $tmpdir/$tb/tarfiles:$!\n";
-	}
-	copy($t, "$tmpdir/$tb/tarfiles") || 
-		die "Can't copy $t to  $tmpdir/$tb/tarfiles:$!\n";
-    }
+    unless (-d "$tmpdir/tarfiles") {
+	mkdir("$tmpdir/tarfiles") || 
+	    die "Can't create $tmpdir/tarfiles:$!\n";
+    }
+    copy($t, "$tmpdir/tarfiles") || 
+	die "Can't copy $t to  $tmpdir/tarfiles:$!\n";
 }
 
