Show
Ignore:
Timestamp:
13.11.2013 16:29:21 (6 years ago)
Author:
sjm84
Message:

Do over of previous 2 commits: the new commandline arguments are more general.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • other-projects/nightly-tasks/diffcol/trunk/task.pl

    r28616 r28620  
    112112my $action = "all"; 
    113113my $subaction = ""; # run_test can take subactions: --just_diff and --no_svn 
    114 my @collections = (); 
     114my @collections = (); # list of collections that run_test should process 
     115 
     116if(scalar(@ARGV) == 0) { 
     117    $action="all"; 
     118} 
     119 
     120# process any arguments that are --gs2|--gs3 and --bin|--svn, and delete them from the array 
     121# if none provided, it's gs2 and svn by default. 
     122for (my $i = $#ARGV; $i >= 0; --$i) {  
     123    if($ARGV[$i] =~ m/--(bin|svn)/) { 
     124    $install_type = $1; 
     125    splice @ARGV, $i, 1; # remove the element from the argument array 
     126    } elsif($ARGV[$i] =~ m/--gs(2|3)/) { 
     127    $install_version = $1; 
     128    splice @ARGV, $i, 1; # remove the element from the argument array 
     129    } 
     130} 
     131 
    115132 
    116133# run_test can take any number of args 
    117 if(scalar(@ARGV) > 1 && $ARGV[0] !~ m/run_test|setup_greenstone/) { 
     134if(scalar(@ARGV) > 1 && $ARGV[0] ne "run_test") { 
    118135    print STDERR "**** Wrong number of arguments\n"; 
    119136    &printusage(); 
     
    121138} 
    122139 
    123 if(scalar(@ARGV) == 0) { 
    124     $action="all"; 
    125 } 
    126 else {     
     140if(scalar(@ARGV) > 0) {     
    127141    switch ($ARGV[0]) { 
    128142    case qr/^(-h|--?help|help)$/i { &printusage; exit 0; } 
     
    135149    } 
    136150 
    137     # setup_greenstone can take gs2|gs3 and bin|svn. gs2 and svn by default 
    138      
    139151    # run_test action can take a subaction: nosvn|justdiff. It can also take --modelOS (windows|linux|darwin) 
    140152    # nosvn: uses the model-collect as static and copies it over to collect, rebuilding what's currently in model-collect instead of copying  
    141153    # it out from the svn model-collect again. 
    142154    # justdiff: same as nosvn, but doesn't copy over model-collection to collect, and doesn't rebuild either of them. Just does the diff part. 
    143     if($action eq "setup_greenstone" && scalar(@ARGV) >= 2) { 
    144                  
    145         for (my $i=0; $i < scalar(@ARGV); $i++) {  
    146             if($ARGV[$i] =~ m@^--@) {                    
    147             $subaction = $ARGV[$i]; 
    148             if($subaction =~ m/--gs(2|3)/) { 
    149                 $install_version = $1; 
    150             } elsif ($subaction =~ m/--(bin|svn)/) { 
    151                 $install_type = $1; 
    152             } else { 
    153                 print STDERR "**** Bad subaction: ".$ARGV[$i]."\n";  
    154                 &printusage;  
    155                 exit -1; 
    156             } 
    157             } 
    158         } 
    159          
    160         #print STDERR "Install type $install_type\n"; 
    161         #print STDERR "Install version $install_version\n"; 
    162  
    163     } elsif($action eq "run_test" && scalar(@ARGV) >= 2) { 
     155 
     156    if($action eq "run_test" && scalar(@ARGV) >= 2) { 
    164157        push(@collections, @ARGV); 
    165158        shift @collections; # remove action from array 
     
    197190} 
    198191 
     192#print STDERR "Install type $install_type\n"; 
     193#print STDERR "Install version $install_version\n"; 
     194 
    199195 
    200196#check key environment vars are set