Changeset 29173 for trunk/pstamp/scripts/pstamp_insert_request.pl
- Timestamp:
- Sep 17, 2010, 2:52:15 PM (16 years ago)
- File:
-
- 1 edited
-
trunk/pstamp/scripts/pstamp_insert_request.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/scripts/pstamp_insert_request.pl
r28106 r29173 44 44 45 45 my $pstamptool = can_run('pstamptool') or (warn "Can't find pstamptool" and $missing_tools = 1); 46 my $ pstampdump = can_run('pstampdump') or (warn "Can't find pstampdump" and $missing_tools = 1);46 my $fields = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1); 47 47 48 48 if ($missing_tools) { … … 53 53 my ($extname, $extver, $req_name); 54 54 { 55 my $command = "$pstampdump -headeronly $tmp_req_file"; 55 # get the header keywords of interest. 56 # Note that if it's a pstamp request then REQ_NAME should be defined. 57 # if it's a detectability query it will not have a REQ_NAME but will have a QUERY_ID 58 my $command = "echo $tmp_req_file | $fields -x 0 EXTNAME EXTVER REQ_NAME QUERY_ID"; 56 59 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 57 60 run(command => $command, verbose => $verbose); 61 if (0) { 62 # stoopid fields doesn't set exit status to zero when it works 58 63 unless ($success) { 59 64 print STDERR @$stderr_buf; 60 65 exit $error_code >> 8; 61 66 } 67 } 62 68 my $output = join "", @$stdout_buf; 63 ( $extname, $extver, $req_name) = split " ", $output;64 if ( $extname and ($extname ne "PS1_PS_REQUEST")) {69 (undef, $extname, $extver, $req_name) = split " ", $output; 70 if (!$extname or ! (($extname eq "PS1_PS_REQUEST") or ($extname eq "MOPS_DETECTABILITY_QUERY"))) { 65 71 print STDERR "invalid request file\n"; 66 72 exit $PS_EXIT_DATA_ERROR; 67 73 } 68 74 if (!defined $req_name) { 69 print STDERR "invalid request file no REQ_NAME \n";75 print STDERR "invalid request file no REQ_NAME or QUERY_ID\n"; 70 76 exit $PS_EXIT_DATA_ERROR; 71 77 } … … 91 97 my $req_id = 0; 92 98 { 93 94 my $command = "$pstamptool -addreq -name $req_name -uri $req_file -ds_id 0"; 99 my $command = "$pstamptool -addreq -uri $req_file -ds_id 0 -name $req_name"; 95 100 $command .= " -dbname $dbname" if $dbname; 96 101 $command .= " -dbserver $dbserver" if $dbserver;
Note:
See TracChangeset
for help on using the changeset viewer.
