Index: trunk/ippScripts/scripts/receive_file.pl
===================================================================
--- trunk/ippScripts/scripts/receive_file.pl	(revision 24894)
+++ trunk/ippScripts/scripts/receive_file.pl	(revision 25940)
@@ -136,7 +136,11 @@
     $command .= " -dbname $dbname" if defined $dbname;
 
-    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-        run(command => $command, verbose => $verbose);
-    &my_die( "Unable to update fileset $fileset_id to\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) unless $success;
+    unless ($no_update) {
+        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+            run(command => $command, verbose => $verbose);
+        &my_die( "Unable to update fileset $fileset_id to\n", $file_id, $PS_EXIT_UNKNOWN_ERROR) unless $success;
+    } else {
+        print STDERR "skipping $command\n";
+    }
 
 } elsif ($component eq "dbinfo") {
@@ -164,14 +168,10 @@
     # we are very strict about the format of the file
     #
-    # First comes the data for the Run
-    # Next is the data for each component
+    # First comes the dbversion metadata
+    # Next comes the data for the Run
+    # Next is the data for each component and other associated tables
     # The component_id (class_id, skycell_id) must come before any of the paths that we edit
 
-    # The first line tells us the run type. From this we get the stage
-    #
-    my $line = $lines[0];
-    my ($runType, $multi) = split " ", $line;
-    &my_die( "unexpected first line found in $filename: $line\n", $file_id, $PS_EXIT_UNKNOWN_ERROR)
-        if !$runType or ($multi ne 'MULTI');
+    my $runType = findRunType(\@lines);
 
     my $stage;
@@ -215,5 +215,5 @@
         $component_dir = $components->{$current_component};
     }
-    foreach $line (@lines) {
+    foreach my $line (@lines) {
         my $out_line = $line;
 
@@ -492,4 +492,37 @@
     return $new_path;
 }
+sub findRunType {
+    my $lines = shift;
+    my $runType;
+    my ($firstWord, $multi) = split " ", $lines->[0];
+    &my_die( "unexpected first line found in $filename: $lines->[0]\n",
+                $file_id, $PS_EXIT_UNKNOWN_ERROR) if ($firstWord ne 'dbversion') or ($multi ne 'MULTI');
+
+    my $dbversionDone = 0;
+    foreach my $line (@$lines) {
+        # skip blank lines
+        next if !$line or $line eq "\n";
+
+        ($firstWord, $multi) = split " ", $line;
+        if ($dbversionDone) {
+            # The first non blank line after the dbversion tells us the run type.
+            # From this we get the stage
+            &my_die( "unexpected line found in $filename: $line\n",
+                $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$firstWord or !$multi or ($multi ne 'MULTI');
+
+            $runType = $firstWord;
+            last;
+        } else {
+            if ($firstWord and $firstWord eq 'END') {
+                # we're past the dbversion file now
+                $dbversionDone = 1;
+            }
+        }
+    }
+    &my_die( "failed to determine run type from $filename",
+                $file_id, $PS_EXIT_UNKNOWN_ERROR) if !$runType;
+
+    return $runType;
+}
 
 sub my_die
