IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 27, 2009, 11:34:07 AM (17 years ago)
Author:
eugene
Message:

merge changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20090715/ippScripts/scripts/register_imfile.pl

    r23831 r25624  
    3333my $ppStats = can_run( 'ppStats' ) or (warn "Can't find ppStats" and $missing_tools = 1);
    3434my $ppStatsFromMetadata = can_run( 'ppStatsFromMetadata' ) or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1);
    35 
    36 my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $dbname, $verbose, $no_update, $no_op, $logfile);
     35my $ppConfigDump = can_run( 'ppConfigDump' ) or (warn "Can't find ppConfigDump" and $missing_tools = 1);
     36
     37my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $bytes, $md5sum, $dbname, $verbose, $no_update, $no_op, $logfile);
    3738GetOptions(
    3839    'caches'           => \$cache,
     
    4142    'tmp_exp_name|n=s' => \$tmp_exp_name,
    4243    'uri|u=s'          => \$uri,
     44    'bytes=s'          => \$bytes,
     45    'md5sum=s'         => \$md5sum,
    4346    'dbname|d=s'       => \$dbname,    # Database name
    4447    'verbose'          => \$verbose,   # Print to stdout
     
    106109    chomp $out2;
    107110    $cmdflags = $out2;
     111
     112    # Manually parse the burntool_state entry.
     113    my $burntoolState = 0;
     114    my $isGPC1 = 0;
     115    my $burntoolStateGood = 0;
     116    foreach my $line (split /\n/, $out1) {
     117        if ($line =~ /FPA.BURNTOOL.APPLIED/) {
     118            $line =~ s/^\s+//;
     119            $burntoolState = (split /\s+/, $line)[2];
     120        }
     121        if ($line =~ /FPA.CAMERA/) {
     122            $line =~ s/^\s+//;
     123            if ((split /\s+/, $line)[2] eq 'GPC1') {
     124                $isGPC1 = 1;
     125            }
     126        }
     127    }
     128    if ($isGPC1 != 1) {
     129        $burntoolState = 0; # If it's not GPC1, you shouldn't have run burntool.
     130    }
     131    elsif (($isGPC1 == 1) && ($burntoolState == 1)) {
     132        my $ppConfigDump_cmd = "$ppConfigDump -camera GPC1 -dump-camera -";
     133        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     134            IPC::Cmd::run(command => $ppConfigDump_cmd, verbose => $verbose);
     135        unless ($success) {
     136            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     137            warn ("Unable to perform ppConfigDump");
     138            exit($error_code);
     139        }
     140
     141        # This is ugly, but doing a full parse for one entry is a bit wasteful.
     142        foreach my $line (split /\n/, (join "", @$stdout_buf)) {
     143            if ($line =~ /BURNTOOL.STATE.GOOD/) {
     144                $line =~ s/^\s+//;
     145                $burntoolStateGood = (split /\s+/, $line)[2];
     146                last;
     147            }
     148        }
     149        $burntoolState = $burntoolStateGood; # Positive because this has the header table.
     150    }
     151    $cmdflags .= " -burntool_state $burntoolState ";
    108152}
    109153
     
    123167$command .= " -tmp_class_id $tmp_class_id"; # the original class_id supplied by the user, replace by ppStats CLASS.ID
    124168$command .= " -uri $uri ";
     169$command .= " -bytes $bytes" if $bytes;
     170$command .= " -md5sum $md5sum" if $md5sum and ($md5sum ne 'NULL');
    125171$command .= " -hostname $host" if defined $host;
    126172$command .= " -dbname $dbname" if defined $dbname;
Note: See TracChangeset for help on using the changeset viewer.