Changeset 23894 for trunk/ippScripts/scripts
- Timestamp:
- Apr 16, 2009, 5:54:55 PM (17 years ago)
- Location:
- trunk/ippScripts/scripts
- Files:
-
- 3 edited
-
receive_file.pl (modified) (6 diffs)
-
receive_fileset.pl (modified) (3 diffs)
-
receive_source.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/receive_file.pl
r23890 r23894 65 65 my $filename = "$tempdir/$file"; # Target filename 66 66 { 67 my $uri = "$source/ product/$fileset/$file"; # URI for datastore file67 my $uri = "$source/$product/$fileset/$file"; # URI for datastore file 68 68 my $command = "dsget --uri $uri --filename $filename"; # Command to execute 69 69 … … 81 81 82 82 my $command = "$tool -importrun -infile $filename"; # Command to execute 83 $command .= " -dbname $dbname" if defined $dbname; 83 84 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 84 85 run(command => $command, verbose => $verbose); … … 88 89 my @files = (); 89 90 { 90 my $command = "tar -C $tempdir -t vzf $filename"; # Command to execute91 my $command = "tar -C $tempdir -tzf $filename"; # Command to execute 91 92 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 92 93 run(command => $command, verbose => $verbose); 93 94 die "Unable to get listing of tar file $filename\n" unless $success; 94 95 95 foreach my $line (@$stdout_buf) { 96 my @lines = split(/\n/, join "", @$stdout_buf); # Lines from output 97 foreach my $line ( @lines ) { 96 98 $line =~ s/\#.*$//; 97 99 next unless $line =~ /\S+/; … … 99 101 my $file = $fields[0]; # Name of file 100 102 $file =~ s|^./||; 101 push @files, $file if defined $file;103 push @files, $file if $file =~ /\S+/; 102 104 } 103 105 } … … 115 117 my $from = "$tempdir/$file"; # Source for file 116 118 my $target = "$workdir/$file"; # Target destination for file 117 my $to = $ipprc->file_ prepare( $target ); # Target for move119 my $to = $ipprc->file_create( $target ); # Target for move 118 120 system("mv $from $to") == 0 or die "Unable to move $file into workdir $workdir: $!\n"; 119 121 } … … 129 131 { 130 132 my $command = "$receivetool -addresult"; 131 $command .= " -file $file_id";133 $command .= " -file_id $file_id"; 132 134 $command .= (" -dtime_copy " . (($mjd_copy - $mjd_start) * 86400)); 133 $command .= (" -dtime_extract " . (($mjd_extract - $mjd_ start) * 86400));135 $command .= (" -dtime_extract " . (($mjd_extract - $mjd_copy) * 86400)); 134 136 $command .= " -dbname $dbname" if defined $dbname; 137 138 139 print "$command\n"; 135 140 136 141 unless (defined $no_update) { -
trunk/ippScripts/scripts/receive_fileset.pl
r23888 r23894 55 55 my @files = (); # Files to add 56 56 { 57 my $uri = "$source/ product/$fileset"; # URI for datastore fileset57 my $uri = "$source/$product/$fileset"; # URI for datastore fileset 58 58 $uri .= "/index.txt" unless $uri =~ m|/index.txt$|; 59 59 my $command = "dsfilesetls --uri $uri"; # Command to execute … … 64 64 65 65 # Get files 66 foreach my $line (@$stdout_buf) { 66 my @lines = split(/\n/, join "", @$stdout_buf); # Lines from output 67 foreach my $line ( @lines ) { 67 68 $line =~ s/\#.*$//; 68 69 next unless $line =~ /\S+/; … … 77 78 my $command = "receivetool -addfile"; # Command to execute 78 79 $command .= " -fileset_id $fileset_id"; 79 $command .= " -file " . join(' -file', @files);80 $command .= " -file " . join(' -file ', @files); 80 81 $command .= " -dbname $dbname" if defined $dbname; 81 82 -
trunk/ippScripts/scripts/receive_source.pl
r23892 r23894 55 55 $uri .= "/index.txt" unless $uri =~ m|/index.txt$|; 56 56 my $command = "dsproductls --uri $uri"; # Command to execute 57 $command .= " --last_fileset $last_fileset" if defined $last_fileset;57 $command .= " --last_fileset $last_fileset" if defined $last_fileset; 58 58 59 59 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 61 61 die "Unable to get source listing from $source for $product\n" unless $success; 62 62 63 # Add filesets 64 my $last; # Last fileset seen 65 foreach my $line (@$stdout_buf) { 63 # Parse list of filesets 64 my @filesets = (); # Filesets to add 65 my @lines = split(/\n/, join "", @$stdout_buf); # Lines from output 66 foreach my $line ( @lines ) { 66 67 $line =~ s/\#.*//g; 67 68 next unless $line =~ /\S+/; … … 69 70 my @fields = split(/\s+/, $line); # Fields in line 70 71 my $fileset = $fields[1]; 71 next if not defined $fileset; 72 73 my $command = "receivetool -addfileset"; # Command to execute 74 $command .= " -source_id $source_id"; 75 $command .= " -fileset $fileset"; 76 $command .= " -dbname $dbname" if defined $dbname; 77 78 unless (defined $no_update) { 79 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 80 run(command => $command, verbose => $verbose); 81 die "Unable to add fileset $fileset\n" unless $success; 82 $last = $fileset; 83 } 72 push @filesets, $fileset if defined $fileset and $fileset =~ /\S+/; 84 73 } 85 74 86 # Update the last fileset seen 87 if (defined $last and (not defined $last_fileset or $last ne $last_fileset)) { 88 my $command = "receivetool -updatelast"; # Command to execute 89 $command .= " -source_id $source_id"; 90 $command .= " -fileset $last"; 91 $command .= " -dbname $dbname" if defined $dbname; 75 if (scalar @filesets > 0) { 76 # Add filesets 77 { 78 my $command = "receivetool -addfileset"; # Command to execute 79 $command .= " -src_id $source_id"; 80 $command .= " -fileset " . join(' -fileset ', @filesets); 81 $command .= " -dbname $dbname" if defined $dbname; 92 82 93 unless (defined $no_update) { 94 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 95 run(command => $command, verbose => $verbose); 96 die "Unable to update last fileset to $last\n" unless $success; 83 unless (defined $no_update) { 84 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 85 run(command => $command, verbose => $verbose); 86 die "Unable to add filesets from $source for $product\n" unless $success; 87 } 88 } 89 90 # Update the last fileset seen 91 { 92 my $command = "receivetool -updatelast"; # Command to execute 93 $command .= " -src_id $source_id"; 94 my $last = pop @filesets; # Last fileset 95 $command .= " -fileset $last"; 96 $command .= " -dbname $dbname" if defined $dbname; 97 98 unless (defined $no_update) { 99 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 100 run(command => $command, verbose => $verbose); 101 die "Unable to update last fileset to $last\n" unless $success; 102 } 97 103 } 98 104 }
Note:
See TracChangeset
for help on using the changeset viewer.
