Changeset 35168
- Timestamp:
- Feb 14, 2013, 11:37:02 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tags/ipp-20121218/ippScripts/scripts/chip_imfile.pl
r35084 r35168 338 338 my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose); 339 339 unless ($repair_success) { 340 &my_die(" Missing file:Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);340 &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR); 341 341 } 342 342 $uriReal = $ipprc->file_resolve( $uri ); … … 345 345 &my_die("Unable to resolve $uri on $host", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) if !$uriReal; 346 346 347 my $funpack_is_compressed = "$funpack -L $uriReal"; 348 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_is_compressed, verbose => $verbose); 349 if ($stdout_buf =~ /compressed/) { 350 # funpack into the temp file if the file is compressed 351 my $funpack_cmd = "$funpack -S $uriReal > $tempName"; 347 # funpack into the temp file. 348 my $funpack_cmd = "$funpack -S $uriReal > $tempName"; 349 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose); 350 unless ($success) { 351 # Catch errors here 352 my $repair_cmd = "$nebrepair $uri"; 353 my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose); 354 unless ($repair_success) { 355 &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR); 356 } 352 357 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose); 353 unless ($success) { 354 # Catch errors here 355 my $repair_cmd = "$nebrepair $uri"; 358 } 359 unless ($success) { 360 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 361 &my_die("Unable to perform funpack: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 362 } 363 364 ## Construct commands to apply the pre-calculated burntool trailfits to the pixel data. 365 my ($burntoolTable_uri, $burntoolTable_uriReal); 366 my $burntool_cmd = "$burntool "; 367 368 if ($burntoolState == -1 * $burntoolStateGood) { # Burntool information stored in an external table. 369 $burntoolTable_uri = $uri; 370 $burntoolTable_uri =~ s/fits$/burn.tbl/; 371 $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri ); 372 if ((!$burntoolTable_uriReal)||(!($ipprc->file_exists($burntoolTable_uri)))) { 373 my $repair_cmd = "$nebrepair $burntoolTable_uri"; 356 374 my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose); 357 375 unless ($repair_success) { 358 &my_die(" funpack -S failed:Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR);376 &my_die("Unable to attempt repair: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR); 359 377 } 360 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $funpack_cmd, verbose => $verbose);378 $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri ); 361 379 } 362 unless ($success) { 363 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 364 &my_die("Unable to perform funpack: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 365 } 366 367 ## Construct commands to apply the pre-calculated burntool trailfits to the pixel data. 368 my ($burntoolTable_uri, $burntoolTable_uriReal); 369 my $burntool_cmd = "$burntool "; 370 371 if ($burntoolState == -1 * $burntoolStateGood) { # Burntool information stored in an external table. 372 $burntoolTable_uri = $uri; 373 $burntoolTable_uri =~ s/fits$/burn.tbl/; 374 $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri ); 375 if ((!$burntoolTable_uriReal)||(!($ipprc->file_exists($burntoolTable_uri)))) { 376 my $repair_cmd = "$nebrepair $burntoolTable_uri"; 377 my ($repair_success, $repair_error_code, $repair_full_buf, $repair_stdout_buf, $repair_stderr_buf ) = run(command => $repair_cmd, verbose => $verbose); 378 unless ($repair_success) { 379 &my_die("Repair failed: $uri $repair_error_code", $exp_id,$chip_id, $class_id, $PS_EXIT_SYS_ERROR); 380 } 381 $burntoolTable_uriReal = $ipprc->file_resolve( $burntoolTable_uri ); 382 } 383 unless ($ipprc->file_exists($burntoolTable_uri)) { 384 # Catch errors here 385 &my_die("Couldn't find burntool table: $burntoolTable_uri",$exp_id,$chip_id,$class_id, $PS_EXIT_SYS_ERROR); 386 } 387 388 $burntool_cmd .= "$tempName in=${burntoolTable_uriReal} persist=t apply=t"; 389 } 390 elsif ($burntoolState == $burntoolStateGood) { # Burntool information stored in a header table. 391 $burntool_cmd .= "$tempName persist=t apply=t"; 392 } 393 else { 394 &my_die("Image data not properly burntooled, impossible state", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 395 } 396 397 ## Run burntool to change the pixels of tempfile, and repoint $uri to that file. 398 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = 399 run(command => $burntool_cmd, verbose => $verbose); 400 unless ($success) { 401 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 402 &my_die("Unable to perform burntool: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 403 } 404 405 $uri = $tempName; 406 unless ($ipprc->file_exists($uri)) { 407 &my_die("Couldn't find deburned input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 408 } 409 } else { 410 warn ("Non compressed image. Skipping neb-repair"); 411 } 380 unless ($ipprc->file_exists($burntoolTable_uri)) { 381 # Catch errors here 382 &my_die("Couldn't find burntool table: $burntoolTable_uri",$exp_id,$chip_id,$class_id, $PS_EXIT_SYS_ERROR); 383 } 384 385 $burntool_cmd .= "$tempName in=${burntoolTable_uriReal} persist=t apply=t"; 386 } 387 elsif ($burntoolState == $burntoolStateGood) { # Burntool information stored in a header table. 388 $burntool_cmd .= "$tempName persist=t apply=t"; 389 } 390 else { 391 &my_die("Image data not properly burntooled, impossible state", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 392 } 393 394 ## Run burntool to change the pixels of tempfile, and repoint $uri to that file. 395 ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf) = 396 run(command => $burntool_cmd, verbose => $verbose); 397 unless ($success) { 398 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 399 &my_die("Unable to perform burntool: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 400 } 401 402 $uri = $tempName; 403 unless ($ipprc->file_exists($uri)) { 404 &my_die("Couldn't find deburned input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR); 405 } 406 412 407 # print STDERR "$uri $uriReal $tempName $burntoolTable_uri $burntoolTable_uriReal $burntool_cmd $save_temps\n"; 413 408 # exit(100);
Note:
See TracChangeset
for help on using the changeset viewer.
