IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 3, 2011, 2:51:02 PM (15 years ago)
Author:
bills
Message:

Changes to support storing distribution bundles in nebulous

File:
1 edited

Legend:

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

    r28963 r30489  
    2323use PS::IPP::Config 1.01 qw( :standard );
    2424
    25 my $ipprc = PS::IPP::Config->new(); # IPP configuration
    2625
    2726use Getopt::Long qw( GetOptions :config auto_help auto_version gnu_getopt );
     
    2928
    3029# Parse the command-line arguments
    31 my ($dist_id, $stage, $stage_id, $outdir, $clean);
     30my ($dist_id, $stage, $stage_id, $outdir, $clean, $camera);
    3231my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile);
    3332
    3433GetOptions(
    35            'dist_id=s'  => \$dist_id,# Magic destreak run identifier
     34           'dist_id=s'      => \$dist_id,# Magic destreak run identifier
     35           'camera=s'       => \$camera,
    3636           'stage=s'        => \$stage,      # raw, chip, warp, or diff
    3737           'stage_id=s'     => \$stage_id,   # exp_id, chip_id, warp_id, or diff_id
     
    5353    defined $stage_id and
    5454    defined $outdir;
     55
     56my $ipprc = PS::IPP::Config->new($camera); # IPP configuration
    5557
    5658$ipprc->redirect_output($logfile) if $logfile;
     
    134136}
    135137
    136 # XXX should we create a file rule for this?
    137 my $dbinfo_file = "$outdir/dbinfo.$stage.$stage_id.mdc";
    138 
    139 {
    140     my $command = "$tool_cmd $exportarg -outfile $dbinfo_file";
     138
     139# work around the fact that $ipprc->file_create does not actually create a file on disk
     140# unless the scheme is nebulous
     141sub create_file {
     142    my $rule = shift;
     143    my $path_base = shift;
     144    my $ref = shift;
     145
     146    my $file;
     147
     148    my $error;
     149    $file = $ipprc->prepare_output($rule, $path_base, undef, 1, \$error)
     150        or &my_die("Unable to prepare outut for $rule", $dist_id, $PS_EXIT_SYS_ERROR);
     151
     152    my $scheme = file_scheme($file);
     153    $scheme = "" if !$scheme;
     154
     155    my $resolved;
     156    if ($scheme) {
     157        $ipprc->file_create($file)
     158            or &my_die("Unable to create $file", $dist_id, $PS_EXIT_SYS_ERROR);
     159
     160        $resolved = $ipprc->file_resolve($file)
     161            or &my_die("Unable to resolve $file", $dist_id, $PS_EXIT_SYS_ERROR);
     162
     163        if ($scheme eq 'neb') {
     164            &my_die("$resolved not found", $dist_id, $PS_EXIT_SYS_ERROR) unless ($resolved and -e $resolved);
     165    }
     166    } else {
     167        $resolved = $file;
     168    }
     169    $$ref = $resolved;
     170
     171    return $file
     172}
     173
     174my $dbinfo_root = "$outdir/dbinfo.$stage.$stage_id";
     175my $resolved;
     176my $dbinfo_file = create_file("DIST.OUTPUT.DBINFO", $dbinfo_root, \$resolved);
     177
     178{
     179    my $command = "$tool_cmd $exportarg -outfile $resolved";
    141180    $command .= " -clean" if ((defined $clean) and ($stage ne "raw"));
    142181    $command .= " -dbname $dbname" if defined $dbname;
     
    149188    }
    150189}
    151 my $dirinfo = "$outdir/dirinfo.$stage.$stage_id.mdc";
     190
     191my $dirinfo_root = "$outdir/dirinfo.$stage.$stage_id";
     192my $dirinfo = create_file("DIST.OUTPUT.DIRINFO", $dirinfo_root, \$resolved);
     193
    152194{
    153195    my $command = "$tool_cmd $list_mode";
     
    168210        &my_die("Unable to parse metadata list", $dist_id, $PS_EXIT_UNKNOWN_ERROR);
    169211
    170     open MANIFEST, ">$dirinfo" or
    171         &my_die("Unable to open dirinfo file $dirinfo",  $dist_id, $PS_EXIT_UNKNOWN_ERROR);
     212    open MANIFEST, ">$resolved" or
     213        &my_die("Unable to open dirinfo file $resolved",  $dist_id, $PS_EXIT_UNKNOWN_ERROR);
    172214
    173215    my $destdir;
     
    197239        &my_die("unable to find path",  $dist_id, $PS_EXIT_UNKNOWN_ERROR) if !$path;
    198240        my $component_dir = find_componentdir($destdir, $path);
    199 #        print MANIFEST "$component METADATA\n";
    200241        print MANIFEST "\t" , "$component", "\tSTR\t", $component_dir, "\n";
    201242    }
     
    217258    }
    218259}
    219 
    220260
    221261exit 0;
Note: See TracChangeset for help on using the changeset viewer.