Changeset 26215 for trunk/pstamp/scripts
- Timestamp:
- Nov 20, 2009, 12:18:48 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_get_image_job.pl (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_get_image_job.pl
r26214 r26215 51 51 $err .= "--output_base is required to specify the output fileset\n" if (!$output_base); 52 52 53 die $errif $err;53 my_die( $err, $PS_EXIT_PROG_ERROR) if $err; 54 54 55 55 my $params_file = $output_base . ".mdc"; 56 56 if (! open(INPUT, "<$params_file") ) { 57 die("failed to open params file: $params_file");57 my_die("failed to open params file: $params_file", $PS_EXIT_UNKNOWN_ERROR); 58 58 } 59 59 60 60 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 61 61 62 my $data = $mdcParser->parse(join "", (<INPUT>)) or die("failed to parse metadata config doc");62 my $data = $mdcParser->parse(join "", (<INPUT>)) or my_die("failed to parse metadata config doc", $PS_EXIT_UNKNOWN_ERROR); 63 63 my $components = parse_md_list($data); 64 64 my $n = scalar @$components; 65 65 if ($n != 1) { 66 die("params file $params_file contains unexpected number of components: $n");66 my_die("params file $params_file contains unexpected number of components: $n", $PS_EXIT_PROG_ERROR); 67 67 } 68 68 my $comp = $components->[0]; … … 84 84 85 85 if (!$camera or !$path_base or !$component or !$stage_id or !$stage) { 86 die "failed to parse params from: $params_file";86 my_die("failed to parse params from: $params_file", $PS_EXIT_UNKNOWN_ERROR); 87 87 } 88 88 … … 110 110 run(command => $command, verbose => $verbose); 111 111 unless ($success) { 112 die("Unable to perform $command: $error_code");112 my_die("Unable to perform $command: $error_code", $error_code >> 8); 113 113 } 114 114 } 115 115 116 116 if (! open(RESULTS, "<$results_file")) { 117 die("failed to open bundle results file: $results_file");117 my_die("failed to open bundle results file: $results_file", $PS_EXIT_UNKNOWN_ERROR); 118 118 } 119 119 … … 135 135 $md5sum = $val; 136 136 } else { 137 die("unexpected tag: $tag found in results file: $results_file");137 my_die("unexpected tag: $tag found in results file: $results_file", $PS_EXIT_PROG_ERROR); 138 138 } 139 139 } … … 141 141 my $reglist = "$out_dir/reglist$job_id"; 142 142 if (! open(REGLIST, ">$reglist") ) { 143 die("failed to open registration list: $reglist");143 my_die("failed to open registration list: $reglist", $PS_EXIT_UNKNOWN_ERROR); 144 144 } 145 145 … … 149 149 150 150 exit 0; 151 152 sub my_die { 153 my $msg = shift; 154 my $rc = shift; 155 156 print STDERR $msg; 157 exit $rc ? $rc : $PS_EXIT_UNKNOWN_ERROR; 158 }
Note:
See TracChangeset
for help on using the changeset viewer.
