Changeset 23894 for trunk/ippScripts/scripts/receive_source.pl
- Timestamp:
- Apr 16, 2009, 5:54:55 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/receive_source.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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.
