IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 16, 2009, 5:54:55 PM (17 years ago)
Author:
Paul Price
Message:

Distribution client workflow is now working!

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/receive_source.pl

    r23892 r23894  
    5555$uri .= "/index.txt" unless $uri =~ m|/index.txt$|;
    5656my $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;
    5858
    5959my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     
    6161die "Unable to get source listing from $source for $product\n" unless $success;
    6262
    63 # Add filesets
    64 my $last;                   # Last fileset seen
    65 foreach my $line (@$stdout_buf) {
     63# Parse list of filesets
     64my @filesets = ();              # Filesets to add
     65my @lines = split(/\n/, join "", @$stdout_buf); # Lines from output
     66foreach my $line ( @lines ) {
    6667    $line =~ s/\#.*//g;
    6768    next unless $line =~ /\S+/;
     
    6970    my @fields = split(/\s+/, $line); # Fields in line
    7071    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+/;
    8473}
    8574
    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;
     75if (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;
    9282
    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        }
    97103    }
    98104}
Note: See TracChangeset for help on using the changeset viewer.