Ignore:
Timestamp:
2013-10-30T20:54:49+13:00 (10 years ago)
Author:
ak19
Message:
  1. New subroutine util::set_gnomelib_env that sets the environment for gnomelib needed for running hashfile, suffix and wget which are dependent on the libiconv dll in ext/gnome-lib(-minimal). It's particularly the Mac Lions that need libiconv.2.dylib. 2. Updated the call to hashfile in doc.pm, the call to suffix in Phind.pm and the calls to wget in several perl scripts and modules to call util::set_gnomelib_env, though this will only set the environment once for each subshell.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/g2futil.pm

    r26440 r28560  
    99    }
    1010
    11     my $fedora_client_bin = &util::filename_cat($ENV{'FEDORA_HOME'},"client","bin");
     11    my $fedora_client_bin = &FileUtils::filenameConcatenate($ENV{'FEDORA_HOME'},"client","bin");
    1212    &util::envvar_append("PATH",$fedora_client_bin);
    1313}
     
    1515use strict;
    1616use util;
     17use FileUtils;
    1718
    1819sub run_cmd_old
     
    186187    #$ENV{'fgsPassword'} = $options->{'password'};   
    187188
    188     #my $prog = &util::filename_cat($ENV{'FEDORA_GSEARCH'}, "runRESTClient.sh");
    189     my $prog = &util::filename_cat($fedoragsearch_webapp, "client", "runRESTClient.sh");
     189    #my $prog = &FileUtils::filenameConcatenate($ENV{'FEDORA_GSEARCH'}, "runRESTClient.sh");
     190    my $prog = &FileUtils::filenameConcatenate($fedoragsearch_webapp, "client", "runRESTClient.sh");
    190191
    191192    my $gsearch_commands = "updateIndex deletePid"; # deletePID
     
    214215    #$ENV{'fgsPassword'} = $options->{'password'};   
    215216
    216     #my $prog = &util::filename_cat($ENV{'FEDORA_GSEARCH'}, "runRESTClient.sh");
    217     my $prog = &util::filename_cat($fedoragsearch_webapp, "client", "runRESTClient.sh");
     217    #my $prog = &FileUtils::filenameConcatenate($ENV{'FEDORA_GSEARCH'}, "runRESTClient.sh");
     218    my $prog = &FileUtils::filenameConcatenate($fedoragsearch_webapp, "client", "runRESTClient.sh");
    218219   
    219220    my $gsearch_commands = "updateIndex fromPid"; # fromPID
     
    231232    # if GS3, first look for a fedoragsearch webapp installed in Greenstone's tomcat
    232233    if(defined $ENV{'GSDL3SRCHOME'}) {
    233     $fedoragsearch_webapp = &util::filename_cat($ENV{'GSDL3SRCHOME'},"packages","tomcat","webapps","fedoragsearch");   
    234     return $fedoragsearch_webapp if (&util::dir_exists($fedoragsearch_webapp));
     234    $fedoragsearch_webapp = &FileUtils::filenameConcatenate($ENV{'GSDL3SRCHOME'},"packages","tomcat","webapps","fedoragsearch");   
     235    return $fedoragsearch_webapp if (&FileUtils::directoryExists($fedoragsearch_webapp));
    235236    }
    236237
    237238    # next look for a fedoragsearch webapp installed in Fedora's tomcat
    238239    if(defined $ENV{'FEDORA_HOME'}) {
    239     $fedoragsearch_webapp =  &util::filename_cat($ENV{'FEDORA_HOME'},"tomcat","webapps","fedoragsearch");
    240     return $fedoragsearch_webapp if (&util::dir_exists($fedoragsearch_webapp));
     240    $fedoragsearch_webapp =  &FileUtils::filenameConcatenate($ENV{'FEDORA_HOME'},"tomcat","webapps","fedoragsearch");
     241    return $fedoragsearch_webapp if (&FileUtils::directoryExists($fedoragsearch_webapp));
    241242    }
    242243
     
    287288
    288289    if (opendir(DIR, $full_dir)) {
    289     my @sub_dirs = grep { ($_ !~ /^\./) && (-d &util::filename_cat($full_dir,$_)) } readdir(DIR);
     290    my @sub_dirs = grep { ($_ !~ /^\./) && (-d &FileUtils::filenameConcatenate($full_dir,$_)) } readdir(DIR);
    290291    closedir DIR;
    291292
     
    294295   
    295296    foreach my $hd (@hash_dirs) {
    296         my $full_hash_dir = &util::filename_cat($full_dir,$hd);
     297        my $full_hash_dir = &FileUtils::filenameConcatenate($full_dir,$hd);
    297298        push(@$all_dirs,$full_hash_dir);
    298299    }
    299300
    300301    foreach my $rd (@rec_dirs) {
    301         my $full_rec_dir = &util::filename_cat($full_dir,$rd);
     302        my $full_rec_dir = &FileUtils::filenameConcatenate($full_dir,$rd);
    302303        rec_get_all_hash_dirs($full_rec_dir,$all_dirs);
    303304    }       
     
    329330    my $hash_id = undef;
    330331
    331     my $docmets_filename = &util::filename_cat($hash_dir,"docmets.xml");
     332    my $docmets_filename = &FileUtils::filenameConcatenate($hash_dir,"docmets.xml");
    332333
    333334    if (open(DIN,"<$docmets_filename"))
     
    372373    # to temporarily set CATALINA_HOME to fedora's tomcat. (Catalina is undefined for GS2.)
    373374    my $gs_catalina_home = $ENV{'CATALINA_HOME'} if defined $ENV{'CATALINA_HOME'};
    374     $ENV{'CATALINA_HOME'} = &util::filename_cat($ENV{'FEDORA_HOME'}, "tomcat");
     375    $ENV{'CATALINA_HOME'} = &FileUtils::filenameConcatenate($ENV{'FEDORA_HOME'}, "tomcat");
    375376   
    376377    # 1. Find out which folder to write to: fedora_host or localhost
    377378    # whichever contains fedora.xml is the one we want (if none, exit with error value?)
    378379    my $fedora_home = $ENV{'FEDORA_HOME'};
    379     my $base_path = &util::filename_cat($fedora_home, "tomcat", "conf", "Catalina");
    380 
    381     my $host_path = &util::filename_cat($base_path, $fedora_host);
    382     my $xmlFile = &util::filename_cat($host_path, "fedora.xml");
     380    my $base_path = &FileUtils::filenameConcatenate($fedora_home, "tomcat", "conf", "Catalina");
     381
     382    my $host_path = &FileUtils::filenameConcatenate($base_path, $fedora_host);
     383    my $xmlFile = &FileUtils::filenameConcatenate($host_path, "fedora.xml");
    383384    if (!-e $xmlFile) {
    384385    # check if the folder localhost contains fedoraXML
    385     $host_path = &util::filename_cat($base_path, "localhost");
    386     $xmlFile = &util::filename_cat($host_path, "fedora.xml");
     386    $host_path = &FileUtils::filenameConcatenate($base_path, "localhost");
     387    $xmlFile = &FileUtils::filenameConcatenate($host_path, "fedora.xml");
    387388    if(!-e $xmlFile) {
    388389        # try putting gsdl in this folder, but still print a warning
     
    405406    # 3. If there is already a gsdl.xml file in host_path, compare the string we
    406407    # want to write with what is already in there. If they're the same, we can return
    407     $xmlFile = &util::filename_cat($host_path, "gsdl.xml");
     408    $xmlFile = &FileUtils::filenameConcatenate($host_path, "gsdl.xml");
    408409    if(-e $xmlFile) {
    409410    # such a file exists, so read the contents
     
    428429    # a. First stop the fedora server
    429430    my $script_ext = ($ENV{'GSDLOS'} =~ m/^windows/) ? ".bat" : ".sh";
    430     my $stop_tomcat = &util::filename_cat($fedora_home, "tomcat", "bin", "shutdown".$script_ext);
     431    my $stop_tomcat = &FileUtils::filenameConcatenate($fedora_home, "tomcat", "bin", "shutdown".$script_ext);
    431432    # execute the command
    432433    $! = 0; # does this initialise the return value?
     
    447448
    448449    # c. Restart the fedora server
    449     my $start_tomcat = &util::filename_cat($fedora_home, "tomcat", "bin", "startup".$script_ext);
     450    my $start_tomcat = &FileUtils::filenameConcatenate($fedora_home, "tomcat", "bin", "startup".$script_ext);
    450451    $! = 0;
    451452    $status = system($start_tomcat);
     
    458459    $ENV{'CATALINA_HOME'} = $gs_catalina_home if defined $gs_catalina_home;
    459460   
     461    # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?)
     462    &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set
     463
    460464    # Starting up the Fedora server takes a long time. We need to wait for the server to be
    461465    # ready before import can continue, because g2f-import relies on an up-and-running Fedora
Note: See TracChangeset for help on using the changeset viewer.