Index: trunk/ippScripts/scripts/stack_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/stack_skycell.pl	(revision 12013)
+++ trunk/ippScripts/scripts/stack_skycell.pl	(revision 12021)
@@ -33,7 +33,7 @@
 use Pod::Usage qw( pod2usage );
 
-my ($p6_id, $camera, $dbname, $workdir, $no_update, $no_op);
+my ($stack_id, $camera, $dbname, $workdir, $no_update, $no_op);
 GetOptions(
-    'p6_id|d=s'         => \$p6_id, # Phase 6 identifier
+    'stack_id|d=s'      => \$stack_id, # Stack identifier
     'camera|c=s'        => \$camera, # Camera name
     'dbname|d=s'        => \$dbname, # Database name
@@ -45,7 +45,7 @@
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-    -msg => "Required options: --p6_id --camera",
+    -msg => "Required options: --stack_id --camera",
     -exitval => 3,
-) unless defined $p6_id
+) unless defined $stack_id
     and defined $camera;
 
@@ -54,5 +54,5 @@
 # Look for programs we need
 my $missing_tools;
-my $stacktool = can_run('p6tool') or (warn "Can't find p6tool" and $missing_tools = 1);
+my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1);
 my $ppStac = can_run('ppStac') or (warn "Can't find ppStac" and $missing_tools = 1);
 if ($missing_tools) { 
@@ -65,5 +65,5 @@
 my $files;
 {
-    my $command = "$stacktool -inputscfile -p6_id $p6_id";
+    my $command = "$stacktool -inputscfile -stack_id $stack_id";
     $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -71,14 +71,14 @@
     unless ($success) {
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform stacktool -inputscfile: $error_code", $p6_id, $error_code);
+	&my_die("Unable to perform stacktool -inputscfile: $error_code", $stack_id, $error_code);
     }
 
     my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
-	&my_die("Unable to parse metadata config doc", $p6_id, $PS_EXIT_PROG_ERROR);
+	&my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
     $files = parse_md_list($metadata) or 
-	&my_die("Unable to parse metadata list", $p6_id, $PS_EXIT_PROG_ERROR);
-}
-
-&my_die("Subtraction list contains more than two elements", $p6_id, $PS_EXIT_SYS_ERROR) unless
+	&my_die("Unable to parse metadata list", $stack_id, $PS_EXIT_PROG_ERROR);
+}
+
+&my_die("Subtraction list contains more than two elements", $stack_id, $PS_EXIT_SYS_ERROR) unless
     scalar @$files >= 2;
 
@@ -90,5 +90,5 @@
     $inputList .= "$uri ";
     if (defined $skycell_id) {
-	&my_die("Skycell identifiers don't match", $p6_id, $PS_EXIT_SYS_ERROR) unless
+	&my_die("Skycell identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless
 	    $file->{skycell_id} eq $skycell_id;
     } else {
@@ -106,5 +106,5 @@
 
 # Get the output filenames
-my $outputFile = "$skycell_id.sub.$p6_id"; # Root name
+my $outputFile = "$skycell_id.sub.$stack_id"; # Root name
 my $outputRoot = File::Spec->catfile( $workdir, $outputFile );
 
@@ -123,20 +123,20 @@
     unless ($success) {
 	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform ppImage: $error_code", $p6_id, $error_code);
-    }
-    &my_die("Couldn't find expected output file: $outputName", $p6_id, $PS_EXIT_SYS_ERROR) unless -f $outputName;
-#    &my_die("Couldn't find expected output file: $bin1Name",    $p6_id, $PS_EXIT_SYS_ERROR) unless -f $bin1Name;
-#    &my_die("Couldn't find expected output file: $bin2Name",    $p6_id, $PS_EXIT_SYS_ERROR) unless -f $bin2Name;
-#    &my_die("Couldn't find expected output file: $outputStats", $p6_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
+	&my_die("Unable to perform ppImage: $error_code", $stack_id, $error_code);
+    }
+    &my_die("Couldn't find expected output file: $outputName", $stack_id, $PS_EXIT_SYS_ERROR) unless -f $outputName;
+#    &my_die("Couldn't find expected output file: $bin1Name",    $stack_id, $PS_EXIT_SYS_ERROR) unless -f $bin1Name;
+#    &my_die("Couldn't find expected output file: $bin2Name",    $stack_id, $PS_EXIT_SYS_ERROR) unless -f $bin2Name;
+#    &my_die("Couldn't find expected output file: $outputStats", $stack_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats;
 
     # Get the statistics on the residual image
     if (0) { ### Disabled because ppStac doesn't output stats yet
 	my $statsFile;		# File handle
-	open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $p6_id, $PS_EXIT_SYS_ERROR);
+	open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $stack_id, $PS_EXIT_SYS_ERROR);
 	my @contents = <$statsFile>; # Contents of file
 	close $statsFile;
 	my $metadata = $mdcParser->parse(join "", @contents) or
-	    &my_die("Unable to parse metadata config doc", $p6_id, $PS_EXIT_PROG_ERROR);
-	$stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $p6_id, $PS_EXIT_PROG_ERROR);
+	    &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
+	$stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $stack_id, $PS_EXIT_PROG_ERROR);
     }
 }
@@ -152,5 +152,5 @@
     # Add the subtraction result
     {
-	my $command = "$stacktool -addsumscfile -p6_id $p6_id -uri $outputName -b1_uri $outputRoot";
+	my $command = "$stacktool -addsumscfile -stack_id $stack_id -uri $outputName -b1_uri $outputRoot";
 	$command .= " -bg $bg -bg_stdev $bg_stdev";
 	$command .= " -dbname $dbname" if defined $dbname;
@@ -160,5 +160,5 @@
 	unless ($success) {
 	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform stacktool -adddiffscfile: $error_code", $p6_id, $error_code);
+	    &my_die("Unable to perform stacktool -adddiffscfile: $error_code", $stack_id, $error_code);
 	}
 	
@@ -168,5 +168,5 @@
     # Register the run as completed
     {
-	my $command = "$stacktool -updaterun -p6_id $p6_id -state stop"; # Command to run p6tool
+	my $command = "$stacktool -updaterun -stack_id $stack_id -state stop"; # Command to run stacktool
 	$command .= " -dbname $dbname" if defined $dbname;
 
@@ -185,10 +185,10 @@
 {
     my $msg = shift;		# Warning message on die
-    my $p6_id = shift;		# Phase 5 identifier
+    my $stack_id = shift;	# Stack identifier
     my $exit_code = shift;	# Exit code to add
 
     warn($msg);
-    if ($p6_id and not $no_update) {
-	my $command = "$stacktool -updaterun -p6_id $p6_id -state stop -code $exit_code";
+    if ($stack_id and not $no_update) {
+	my $command = "$stacktool -updaterun -stack_id $stack_id -state stop -code $exit_code";
 	$command .= " -dbname $dbname" if defined $dbname;
         system ($command);
