Changeset 27764 for other-projects


Ignore:
Timestamp:
2013-07-05T18:40:10+12:00 (11 years ago)
Author:
ak19
Message:

Now it gets the PDFBox binary from svn and unzips it into ext for testing the PDFBox tutorial.

File:
1 edited

Legend:

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

    r27743 r27764  
    3030no strict 'subs'; # allow barewords (eg STDERR) as function arguments
    3131
     32
    3233my $isWin = ($^O =~ m/mswin/i) ? 1 : 0;
     34my $isMac = ($^O =~ m/macos|darwin/i) ? 1 : 0;
    3335my $sep = $isWin ? "\\" : "/";
    3436my $pathsep = $isWin ? ";" : ":";
     
    247249
    248250    ##print STDERR "@@@ OS:  $^O.|".$Config{'archname64'}."|\n";
    249 
    250    
     251   
    251252    if($isWin) {
    252253        print STDERR "Compiling $gsdl using makegs2.bat running in auto (silent) mode\n";
     
    258259    } else { # if we're on linux/darwin, need gnome-lib for the correct architecture. And need imagemagick to build imgs in collections
    259260       
    260     my $isMac = ($^O =~ m/macos|darwin/i) ? 1 : 0;
    261261    my $bit_arch=`uname -m`;
    262262
     
    359359        exit -1;
    360360    }
    361 
     361   
    362362    # set the path to the greenstone_home variable                             
    363363    $greenstone_home="$ENV{'DATA_DIR'}$sep$gsdl";
    364 
     364   
     365}
     366
     367sub getPDFBox
     368{   
     369    # current revision is 27763, but using "head" works
     370    my $PDFBOX_TRAC_URL="http://trac.greenstone.org/export/head/gs2-extensions/pdf-box/trunk/pdf-box-java"; # both for .zip and .tar.gz extension
     371    #"http://trac.greenstone.org/export/".$ENV{'SVN_OPT_REV'}."/gs2-extensions/pdf-box/trunk/pdf-box-java";
     372
     373    # now get the PDFBox extension for PDFBox tutorial 
     374    print STDERR "Getting pdfbox from $PDFBOX_TRAC_URL:\n";     
     375   
     376    chdir($greenstone_home);
     377    my $cmd = "";
     378    if ($isWin) {
     379        $cmd = "setup.bat && cd ext && wget $PDFBOX_TRAC_URL.zip && unzip pdf-box-java.zip";
     380       
     381    } elsif ($isMac) { # need to use curl not wget
     382        $cmd = "cd ext && curl $PDFBOX_TRAC_URL.tar.gz > pdf-box-java.tar.gz && tar -xzf pdf-box-java.tar.gz";
     383    }
     384    else { # linux
     385        $cmd = "source setup.bash && cd ext && wget $PDFBOX_TRAC_URL.tar.gz && tar -xzf pdf-box-java.tar.gz";
     386    }
     387    my $status = system $cmd;
     388    if($status != 0) {
     389        print STDERR "@@@ Failed to set up PDFBox\n";
     390        #exit -1; # proceed testing other tutorials?
     391    }
    365392}
    366393
     
    368395sub run_test
    369396{
     397    my $pdfbox = &filename_concat($greenstone_home, "ext", "pdf-box");
     398    if(!-d $pdfbox) {
     399        &getPDFBox();
     400    }
     401
    370402    open (my $xml_fh, '>'.$xmlout) || die "Could not open xml file $xmlout for appending: $!\n";
    371403
Note: See TracChangeset for help on using the changeset viewer.