Index: trunk/ippScripts/scripts/dist_component.pl
===================================================================
--- trunk/ippScripts/scripts/dist_component.pl	(revision 23728)
+++ trunk/ippScripts/scripts/dist_component.pl	(revision 23743)
@@ -124,8 +124,9 @@
 my $file_list = get_file_list($stage, $component, $path_base);
 
-# If the file list is empty it is an error because we should at least get a config dump file
-# XXX: is this true? what about fake?
-
-&my_die("empty file list", $dist_id, $component, $PS_EXIT_CONFIG_ERROR) if (!scalar keys %$file_list);
+if ($stage ne 'fake') {
+    # If the file list is empty it is an error because we should at least get a config dump file
+    # except for fake stage which doesn't do anything yet
+    &my_die("empty file list", $dist_id, $component, $PS_EXIT_CONFIG_ERROR) if (!scalar @$file_list);
+}
 
 # set up directory for temporary files
@@ -149,10 +150,12 @@
 #   2. magic is not required for this distRun
 #   3. the processing for the component produced no images (warp or diff with bad quality for example)
-my $nan_masked_pixels = ! ($clean || $no_magic || $poor_quality);
+my $nan_masked_pixels = ! ($clean || (($stage eq "camera") || ($stage eq 'fake') || ($stage eq 'stack')) || $no_magic || $poor_quality);
 
 my ($image, $mask, $variance);
 
-foreach my $file_rule (keys %$file_list) {
+# foreach my $file_rule (keys %$file_list) {
+foreach my $file (@$file_list) {
     # check whether this file rule refers to an image, mask, or variance fits image
+    my $file_rule = $file->{file_rule};
     my $image_type = get_image_type($stage, $file_rule);
 
@@ -164,5 +167,5 @@
             or ($file_rule =~ /.JPEG2/));
 
-    my $file_name = $file_list->{$file_rule};
+    my $file_name = $file->{name};
     my $base = basename($file_name);
     my $path = $ipprc->file_resolve($file_name);
@@ -248,4 +251,10 @@
 my $bytes;
 my $md5sum;
+if ($stage eq 'fake') {
+    open DUMMY, ">$tmpdir/fake.$component" or &my_die("Unable to create placeholder for fake component",
+        $dist_id, $component, $PS_EXIT_CONFIG_ERROR);
+    print DUMMY "This file is a placeholder\n";
+    close DUMMY;
+}
 # create the tarfile
 {
@@ -352,11 +361,14 @@
     my $path_base = shift;
 
-    my %file_list;
+    my @file_list;
     if ($stage eq "raw") {
         # XXX: TODO for now disttool sets path_base is set to the uri of the file
         # eventually rawImfile will have a path_base that we'll need to add '.fits'
         # XXX do we want to distribute the registration log files?
-        $file_list{"RAW.IMAGE"} = $path_base;
-        return \%file_list;
+        my %file;
+        $file{file_rule} = "RAW.IMAGE";
+        $file{name} = $path_base;
+        push @file_list, \%file;
+        return \@file_list;
     }
 
@@ -368,4 +380,8 @@
     } elsif ($stage eq "camera") {
         $config_file_rule = "PSASTRO.CONFIG";
+        $component = "";
+    } elsif ($stage eq 'fake') {
+        # XXX: fake is a no op now return an emtpy list
+        return \@file_list;
     } elsif ($stage eq "warp") {
         $config_file_rule = "PSWARP.CONFIG";
@@ -381,6 +397,10 @@
                     $PS_EXIT_CONFIG_ERROR);
 
+    my %config_file_hash;
+
     # add the configuration file to the list
-    $file_list{$config_file_rule} = $config_file;
+    $config_file_hash{file_rule} = $config_file_rule;
+    $config_file_hash{name} = $config_file;
+    push @file_list, \%config_file_hash;
 
     my $resolved = $ipprc->file_resolve($config_file);
@@ -400,62 +420,30 @@
         }
     }
-
-    if ($line) {
-        # this is a new style config dump that contains the list of files
-
-        my %files;
-        while ($line = <$in>) {
-            chomp $line;
-            my ($key, $type, $val) = split " ", $line;
-            # skip blank lines
-            next if !$key;
-            # we're done when we find END
-            last if $key eq "END";
-            # skip multi and other lines
-            next if ($type ne "STR");
-
-            # printf "%-32.32s   %s\n", $key, $val;
-
-            &my_die("no value found for file rule $key in $resolved", $dist_id, $component,
-                    $PS_EXIT_CONFIG_ERROR) if (!$val);
-
-            $file_list{$key} = $val;
-        }
-        close $in;
-    } else {
-        # did not find FILES.OUTPUT in the config file, assume we have an old style file
-        # and build the distro from the static list which is at the end of this script
-        my $clean_mdc = get_legacy_file_mdc();
-
-        my $mdlist = $mdcParser->parse($clean_mdc) or
-                &my_die("failed to parse legacy file mdc", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR);
-
-        my $product_lists = parse_md_list($mdlist) or
-                &my_die("failed to parse metadata list", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR);
-
-
-        my $product_list;
-        foreach my $list (@$product_lists) {
-
-            my $list_name = $list->{STAGE};
-            if (lc ($list_name) eq lc($stage) ) {
-                $product_list = $list;
-            }
-        }
-        &my_die("failed to parse find product list for stage $stage", $dist_id, $component, $PS_EXIT_UNKNOWN_ERROR) if !$product_list;
-
-        # resolve each file rule and add it to the file_list
-        foreach my $rule (keys %$product_list) {
-            next if $rule eq "STAGE";
-            my $fn = $ipprc->filename($rule, $path_base, $component) or
-                &my_die("Missing entry from camera config: $rule", $dist_id, $component,
-                    $PS_EXIT_CONFIG_ERROR);
-            #        printf "%-16.16s\t%s\t%s\n",  $rule, $clean, $fn;
-
-            $file_list{$rule} = $fn;
-        }
-    }
-
-    return \%file_list;
+    &my_die("config dump file does not contain FILES.OUTPUT: $config_file", $dist_id, $component,
+                    $PS_EXIT_CONFIG_ERROR) if (!$line);
+
+    while ($line = <$in>) {
+        chomp $line;
+        my ($key, $type, $val) = split " ", $line;
+        # skip blank lines
+        next if !$key;
+        # we're done when we find END
+        last if $key eq "END";
+        # skip multi and other lines
+        next if ($type ne "STR");
+
+        # printf "%-32.32s   %s\n", $key, $val;
+
+        &my_die("no value found for file rule $key in $resolved", $dist_id, $component,
+                $PS_EXIT_CONFIG_ERROR) if (!$val);
+
+        my %file;
+        $file{file_rule} = $key;
+        $file{name} = $val;
+        push @file_list, \%file;
+    }
+    close $in;
+
+    return \@file_list;
 }
 
@@ -509,113 +497,3 @@
 }
 
-# list of output data products for runs that were made before the configuration re-work 
-sub get_legacy_file_mdc
-{
-    my $list =
-"
-#
-# interesting things we might want to save in this file
-#   1. whether file is to be distributed in 'clean' mode
-#   2. whether file is to be cleaned (this should be the same thing)
-#   3. type of file 'no, not our business, precious'
-
-# this data should probably be computed by the relevant program and saved as part
-# of the configuration dump that is output.
-
-
-PROD_LIST MULTI
-
-PROD_LIST   METADATA
-        STAGE                    STR     RAW
-    # there is isn't really a file rule for raw images
-	RAW.IMAGE           	BOOL	F
-END
-
-# list of data products for a gpc1 chipProcessedImfile  (made by ppImage)
-PROD_LIST   METADATA
-        STAGE                    STR     CHIP
-	PPIMAGE.CONFIG  	BOOL	T
- 	PPIMAGE.CHIP    	BOOL	F
- 	PPIMAGE.CHIP.MASK	BOOL	F
- 	PPIMAGE.CHIP.VARIANCE	BOOL	F
-#	PPIMAGE.BIN1    	BOOL	T
-#	PPIMAGE.BIN2    	BOOL	T
-	PSPHOT.OUT.CMF.SPL	BOOL	T
-	PSPHOT.BACKMDL  	BOOL	T
-	PPIMAGE.STATS   	BOOL	T
-	LOG.IMFILE      	BOOL	T
-	TRACE.IMFILE    	BOOL	T
-    # where do we put exposure level data such as LOG.EXP ?
-END
-# exposure level output products from camera processing made by psastro and ppImage (jpegs)
-PROD_LIST   METADATA
-        STAGE                    STR     CAM
-	PSASTRO.CONFIG  	BOOL	T
-	PSASTRO.OUTPUT  	BOOL	T
-	PSASTRO.STATS   	BOOL	T
-#	PPIMAGE.JPEG1   	BOOL	T
-#	PPIMAGE.JPEG2   	BOOL	T
-	LOG.EXP         	BOOL	T
-	TRACE.EXP       	BOOL	T
-END
-# chip lelel output products from camera processing made by psastro
-PROD_LIST   METADATA
-        STAGE                    STR CAM_CHIP
- 	PSASTRO.OUTPUT.MASK	BOOL	F
-END
-PROD_LIST   METADATA
-        STAGE                    STR     FAKE
- 	PPSIM.OUTPUT    	BOOL	F
-END
-# list of data products for a gpc1 warpSkyfile (pswarp)
-PROD_LIST   METADATA
-        STAGE                    STR     WARP
-	PSWARP.CONFIG   	BOOL	T
- 	PSWARP.OUTPUT   	BOOL	F
- 	PSWARP.OUTPUT.MASK	BOOL	F
- 	PSWARP.OUTPUT.VARIANCE	BOOL	F
-	PSWARP.OUTPUT.SOURCES	BOOL	T
-	PSPHOT.BACKMDL.MEF  	BOOL	T
-	PSPHOT.PSF.SKY.SAVE	BOOL	T
-	SKYCELL.STATS   	BOOL	T
-	SKYCELL.TEMPLATE	BOOL	T
-	LOG.EXP         	BOOL	T
-	TRACE.EXP       	BOOL	T
-END
-# outputs from diffRun (ppSub)
-PROD_LIST   METADATA
-        STAGE                    STR     DIFF
-	PPSUB.CONFIG    	BOOL	T
- 	PPSUB.OUTPUT    	BOOL	F
- 	PPSUB.OUTPUT.MASK	BOOL	F
- 	PPSUB.OUTPUT.VARIANCE	BOOL	F
-	PPSUB.OUTPUT.KERNELS	BOOL	T
-#	PPSUB.OUTPUT.JPEG1	BOOL	T
-#	PPSUB.OUTPUT.JPEG2	BOOL	T
-	PSPHOT.OUT.CMF.MEF	BOOL	T
-	PSPHOT.BACKMDL.MEF	BOOL	T
-	SKYCELL.STATS   	BOOL	T
-	LOG.EXP         	BOOL	T
-	TRACE.EXP       	BOOL	T
-END
-PROD_LIST   METADATA
-        STAGE                    STR     STACK
-	PPSTACK.CONFIG  	BOOL	T
- 	PPSTACK.OUTPUT  	BOOL	F
- 	PPSTACK.OUTPUT.MASK	BOOL	F
- 	PPSTACK.OUTPUT.VARIANCE	BOOL	F
-	PPSTACK.TARGET.PSF	BOOL	T
-	PSPHOT.OUT.CMF.MEF	BOOL	T
-	PSPHOT.BACKMDL.MEF	BOOL	T
-	SKYCELL.STATS   	BOOL	T
-#	PPSTACK.OUTPUT.JPEG1	BOOL	T
-#	PPSTACK.OUTPUT.JPEG2	BOOL	T
-	LOG.EXP         	BOOL	T
-	TRACE.EXP       	BOOL	T
-END
-";
-    return $list;
-}
-
-
 __END__
