Changeset 11316 for trunk/ippScripts/scripts/phase2.pl
- Timestamp:
- Jan 25, 2007, 7:10:31 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/phase2.pl (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/phase2.pl
r11298 r11316 8 8 use PS::IPP::Metadata::Stats; 9 9 use Data::Dumper; 10 use PS::IPP::Config; 10 use PS::IPP::Config qw( 11 $PS_EXIT_SUCCESS 12 $PS_EXIT_UNKNOWN_ERROR 13 $PS_EXIT_SYS_ERROR 14 $PS_EXIT_CONFIG_ERROR 15 $PS_EXIT_PROG_ERROR 16 $PS_EXIT_DATA_ERROR 17 $PS_EXIT_TIMEOUT_ERROR 18 ); 11 19 my $ipprc = PS::IPP::Config->new(); # IPP configuration 12 20 use File::Spec; … … 51 59 my $p2tool = can_run('p2tool') or (warn "Can't find p2tool" and $missing_tools = 1); 52 60 my $ppImage = can_run('ppImage') or (warn "Can't find ppImage" and $missing_tools = 1); 53 die "Can't find required tools.\n" if $missing_tools; 61 if ($missing_tools) { 62 warn("Can't find required tools."); 63 exit($PS_EXIT_CONFIG_ERROR); 64 } 54 65 55 66 unless (defined $workdir) { … … 79 90 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 80 91 run(command => $command, verbose => 1); 81 die "Unable to perform ppImage on $input: $error_code\n" if not $success; 82 die "Couldn't find expected output file: $outputImage\n" if not -f $outputImage; 83 die "Couldn't find expected output file: $outputBin1\n" if not -f $outputBin1; 84 die "Couldn't find expected output file: $outputBin2\n" if not -f $outputBin2; 85 die "Couldn't find expected output file: $outputStats\n" if not -f $outputStats; 92 unless ($success) { 93 $error_code >> 8; 94 &my_die("Unable to perform ppImage: $error_code", $exp_tag, $class_id, $error_code); 95 } 96 &my_die("Couldn't find expected output file: $outputImage\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputImage; 97 &my_die("Couldn't find expected output file: $outputBin1\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin1; 98 &my_die("Couldn't find expected output file: $outputBin2\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputBin2; 99 &my_die("Couldn't find expected output file: $outputStats\n", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR) unless -f $outputStats; 86 100 } 87 101 … … 90 104 { 91 105 my $statsFile; # File handle 92 open $statsFile, $outputStats or die "Can't open statistics file $outputStats: $!\n";106 open $statsFile, $outputStats or &my_die("Can't open statistics file $outputStats: $!", $exp_tag, $class_id, $PS_EXIT_SYS_ERROR); 93 107 my @contents = <$statsFile>; # Contents of file 94 108 close $statsFile; 95 109 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 96 my $metadata = $mdcParser->parse(join "", @contents) 97 or die "unable to parse metadata config doc";110 my $metadata = $mdcParser->parse(join "", @contents) or 111 &my_die("Unable to parse metadata config doc", $exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 98 112 $stats = PS::IPP::Metadata::Stats->new(); # Stats parser 99 $stats->parse($metadata) or die "Unable to find all values in statistics output.\n"; 113 $stats->parse($metadata) or 114 &my_die("Unable to find all values in statistics output.\n", $exp_tag, $class_id, $PS_EXIT_PROG_ERROR); 100 115 } 101 116 … … 120 135 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 121 136 run(command => $command, verbose => 1); 122 die "Unable to perform p2tool -addprocessedimfile for $expTag/$classId: $error_code\n" 123 if not $success; 137 unless ($success) { 138 $error_code >> 8; 139 warn("Unable to perform p2tool -addprocessedimfile: $error_code\n"); 140 exit($error_code); 141 } 124 142 125 143 unlink $outputStats; 144 } 145 146 147 sub my_die 148 { 149 my $msg = shift; # Warning message on die 150 my $exp_tag = shift; # Exposure tag 151 my $class_id = shift; # Class identifier 152 my $exit_code = shift; # Exit code to add 153 154 warn($msg); 155 if ($exp_tag and $class_id) { 156 my $command = "$dettool -addprocessedimfile -exp_tag $exp_tag -class_id $class_id -code $exit_code"; 157 $command .= " -dbname $dbname" if defined $dbname; 158 system ($command); 159 } 160 exit $exit_code; 126 161 } 127 162
Note:
See TracChangeset
for help on using the changeset viewer.
