IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 30674


Ignore:
Timestamp:
Feb 17, 2011, 1:38:26 PM (15 years ago)
Author:
bills
Message:

Allow the user of the distribution client to set the system to *not* extract
the files into the destination directories. This is controlled with two
pantasks macros set.no.extract and clear.no.extract

Location:
trunk
Files:
2 edited

Legend:

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

    r29973 r30674  
    4141
    4242# Parse the command-line arguments
    43 my ( $file_id, $source, $product, $fileset, $fileset_id, $file, $component, $bytes, $md5sum, $workdir, $dirinfo_uri, $dbname, $verbose, $no_update, $save_temps );
     43my ( $file_id, $source, $product, $fileset, $fileset_id, $file, $component, $bytes, $md5sum, $workdir, $dirinfo_uri, $no_extract, $dbname, $verbose, $no_update, $save_temps );
    4444
    4545GetOptions(
     
    5454           'md5sum=s'          => \$md5sum, # md5sum for file from data store
    5555           'workdir=s'         => \$workdir, # Working directory for output
     56           'no-extract'        => \$no_extract, # Do not extract the tarfiles
    5657           'dirinfo=s'    => \$dirinfo_uri, # file containing the destination directories for this component
    5758           'dbname=s'          => \$dbname,    # Database name
     
    8586my $mdcParser = PS::IPP::Metadata::Config->new;
    8687
    87 
     88# select a directory for the dirinfo and dbinfo files
     89# XXX: perhaps this directory should be set by the script and passed in
     90# rather than computed here.
     91
     92my ($day, $month, $year) = (localtime)[3,4,5];
     93my $datestr = sprintf "%04d%02d%02d", $year+1900, $month + 1, $day;
     94my $dir_for_info_files = caturi($workdir, $datestr, $fileset);
     95
     96
     97my $is_tarfile = 0;
     98if ($file =~ m|.*\.tgz$|) {        # XXX: perhaps get this off of file type ?
     99    $is_tarfile = 1;
     100}
     101
     102my $filename;
     103if ($is_tarfile and $no_extract) {
     104    $filename = "$dir_for_info_files/$file";
     105} else {
     106    $filename = "$tempdir/$file";
     107}
    88108
    89109# Retrieve file
    90 my $filename = "$tempdir/$file";  # Target filename
    91110{
    92111    my $uri = "$source/$product/$fileset/$file"; # URI for datastore file
     
    107126my ($destdir, $components, $dirinfo_lines) = read_dirinfo_file($dirinfo_file_to_read, $file_id);
    108127
    109 # select a directory for the dirinfo and dbinfo files
    110 # XXX: perhaps this directory should be set by the script and passed in
    111 # rather than computed here.
    112 
    113 my ($day, $month, $year) = (localtime)[3,4,5];
    114 my $datestr = sprintf "%04d%02d%02d", $year+1900, $month + 1, $day;
    115 my $dir_for_info_files = caturi($workdir, $datestr, $fileset);
    116128
    117129# Deal with file
     
    279291
    280292
    281 } elsif ($file =~ m|.*\.tgz$|) {        # XXX: perhaps get this off of file type ?
     293} elsif ($is_tarfile and !$no_extract) {
    282294    # Get contents of tarball
    283295    my @files = ();
     
    339351        }
    340352    }
     353} elsif ($is_tarfile and $no_extract) {
     354    print "skipping extraction of tarfile $filename\n";
    341355} else {
    342356    &my_die( "Unrecognised file: $file\n", $file_id, $PS_EXIT_UNKNOWN_ERROR);
  • trunk/ippTasks/receive.pro

    r24749 r30674  
    105105$receive_Advance_DB = 0
    106106
     107# set this to skip extraction of tarfiles into their destination directories
     108$NO_EXTRACT = ""
     109macro set.no.extract
     110    $NO_EXTRACT = "--no-extract"
     111end
     112macro clear.no.extract
     113    $NO_EXTRACT = ""
     114end
     115macro show.no.extract
     116    echo $NO_EXTRACT
     117end
     118
    107119task           receive.source.load
    108120  host         local
     
    416428    host anyhost
    417429
    418     $run = receive_file.pl --file_id $FILE_ID --source $SOURCE --product $PRODUCT --fileset $FILESET --fileset_id $FILESET_ID --file $FILE --component $COMPONENT --bytes $BYTES --md5 $MD5SUM --workdir $WORKDIR --dirinfo $DIRINFO
     430    $run = receive_file.pl --file_id $FILE_ID --source $SOURCE --product $PRODUCT --fileset $FILESET --fileset_id $FILESET_ID --file $FILE --component $COMPONENT --bytes $BYTES --md5 $MD5SUM --workdir $WORKDIR --dirinfo $DIRINFO $NO_EXTRACT
    419431    add_standard_args run
    420432
Note: See TracChangeset for help on using the changeset viewer.