Changeset 24726 for trunk/ippScripts/scripts/magic_destreak_revert.pl
- Timestamp:
- Jul 8, 2009, 6:19:50 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/magic_destreak_revert.pl
r24686 r24726 70 70 defined $outroot; 71 71 72 # XXX: for testing73 $no_update = 1;74 75 72 &my_die("bytes and md5sum are is required for raw stage stage", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) if ($stage eq 'raw' and (!$bytes or !$md5sum)); 76 73 … … 87 84 if ($@ or not defined $nebulous) { 88 85 &my_die ("Unable to create a Nebulous::Client object with proxy $nebulousServer", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 89 return undef;90 86 } 91 87 … … 109 105 my $nebulousInput = inNebulous($dirname); 110 106 111 # parse replace arguments check for errors and set up112 # the appropriate paths113 # this program doesn't make sense if $replace is false114 &my_die("Invalid value for replace: $replace", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) if $replace ne "T";115 116 107 if (defined($replace) and ($replace eq "T")) { 117 108 $replace = 1; … … 120 111 } 121 112 122 # default value is "NULL" do not use 113 &my_die("replace not allowed for non-nebulous files", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR) 114 if ($replace eq "T") and !$nebulousInput; 115 116 117 # default value is "NULL" do not use it 123 118 if (defined($recoveryroot) and ($recoveryroot eq "NULL")) { 124 119 $recoveryroot = undef; … … 135 130 $backup_path_base = $tmproot . "$basename"; 136 131 } else { 137 # note: t railing /is necessary132 # note: the trailing / here is necessary 138 133 $tmproot = "$outroot/"; 139 134 $backup_path_base = $tmproot . $basename; … … 189 184 } 190 185 191 do_swap($image, $bimage) or186 revert_file($image, $bimage) or 192 187 &my_die("failed to restore image file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 188 189 # don't commit next the next couple of lines and see xxx below 190 # change to if 0 to revert chip runs without masks 191 if (0) { 192 193 193 if ($mask) { 194 my $swap_result = do_swap($mask, $bmask); 195 if (! $swap_result) { 196 # delete next 5 lines 197 if ($stage eq "chip") { 198 # XXX: this is a kludge to get around my test environment 199 # Don't commit 200 print STDERR "failed to resotre camera mask file, proceeding\n"; 194 if (!revert_file($mask, $bmask)) { 195 if ($stage eq 'chip') { 196 # XXX: don't fail if the mask file fails to revert. It probably doesn't exist 197 # Handle this properly 198 print STDERR "failure to revert mask file, ignored\n"; 201 199 } else { 202 &my_die("failed to restore mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 203 } # delete this line 204 } 205 } 200 &my_die("failed to restore mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 201 } 202 } 203 } 204 206 205 if ($ch_mask) { 207 do_swap($ch_mask, $bch_mask) or 208 &my_die("failed to restore chip mask", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 206 # Handle this properly 207 if (!revert_file($ch_mask, $bch_mask)) { 208 # print STDERR "failure to revert chip mask file, ignored\n"; 209 &my_die("failed to restore chip mask file", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 210 } 209 211 } 212 213 # xxx don't commmit next line 214 } 215 210 216 if ($weight) { 211 do_swap($weight, $bweight) or217 revert_file($weight, $bweight) or 212 218 &my_die("failed to restore variance image", $magic_ds_id, $component, $PS_EXIT_CONFIG_ERROR); 213 219 } 214 220 215 # now reverse the desreaked file 216 # Change magicdstool to set the magicked value to zero 217 # Actually we should probably do this first to insure that no data gets deleted 218 # Input result into database 219 if (0) { 220 # XXX: this is the wrong mode 221 my $command = "$magicdstool -adddestreakedfile"; 221 # now revert the row in the database 222 { 223 my $command = "$magicdstool -revertdestreakedfile"; 222 224 $command .= " -magic_ds_id $magic_ds_id"; 223 225 $command .= " -component $component"; 224 $command .= " -setmagicked" if $replace;225 $command .= " -backup_path_base $backup_path_base" if $backup_path_base;226 $command .= " -recovery_path_base $recovery_path_base" if $recovery_path_base;227 226 $command .= " -dbname $dbname" if defined $dbname; 228 227 … … 242 241 243 242 244 245 243 ### Pau. 246 244 … … 256 254 } 257 255 258 sub do_swap256 sub revert_file 259 257 { 260 258 my $original = shift; … … 297 295 if ($b_path and -e $b_path) { 298 296 print "ready to delete backup\n" if $verbose; 299 if (! $ nebulous->delete($backup)) {297 if (! $ipprc->file_delete($backup)) { 300 298 print "failed to delete $backup\n"; 301 299 return 0; … … 307 305 # delete the 'backup' (destreaked target) file if it exists 308 306 if ($b_path and -e $b_path) { 309 if (! $ nebulous->delete($backup)) {307 if (! $ipprc->file_delete($backup)) { 310 308 print "failed to delete $backup\n"; 311 309 return 0; … … 348 346 $exit_code = $PS_EXIT_PROG_ERROR unless defined $exit_code; 349 347 350 my $command = "$magicdstool -adddestreakedfile"; 351 $command .= " -magic_ds_id $magic_ds_id"; 352 $command .= " -component $component"; 353 $command .= " -fault $exit_code"; 354 $command .= " -dbname $dbname" if defined $dbname; 355 356 # Add the processed file to the database 357 unless ($no_update) { 358 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 359 run(command => $command, verbose => $verbose); 360 unless ($success) { 361 carp("failed to update database for $magic_ds_id $component"); 362 } 363 } else { 364 print "Skipping command: $command\n"; 365 } 348 # we wouldn't be here unless an entry already exists in the database 349 # my $command = "$magicdstool -adddestreakedfile"; 350 # $command .= " -magic_ds_id $magic_ds_id"; 351 # $command .= " -component $component"; 352 # $command .= " -fault $exit_code"; 353 # $command .= " -dbname $dbname" if defined $dbname; 354 355 # # Add the processed file to the database 356 # unless ($no_update) { 357 # my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 358 # run(command => $command, verbose => $verbose); 359 # unless ($success) { 360 # carp("failed to update database for $magic_ds_id $component"); 361 # } 362 # } else { 363 # print "Skipping command: $command\n"; 364 # } 366 365 367 366 carp($msg);
Note:
See TracChangeset
for help on using the changeset viewer.
