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/bin/script/importfrom.pl

    r17198 r28560  
    4040use colcfg;
    4141use util;
     42use FileUtils;
    4243use parsargv;
    4344use FileHandle;
     
    6263    print STDERR "   -debug                 Print imported text to STDOUT\n";
    6364    print STDERR "   -collectdir directory  Collection directory (defaults to " .
    64     &util::filename_cat ($ENV{'GSDLHOME'}, "collect") . ")\n";
     65    &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "collect") . ")\n";
    6566    print STDERR "   -out                   Filename or handle to print output status to.\n";
    6667    print STDERR "                          The default is STDERR\n\n";
     
    9697{
    9798    my ($wget_cmd,$out,$verbosity) = @_;
     99
     100    # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?)
     101    &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set
    98102
    99103    if ($verbosity>2) {
     
    210214    print $out "Getting document $doc_url\n";
    211215
    212     &util::mk_dir($output_dir)  if (!-e "$output_dir");
    213 
    214     my $full_id_fname = &util::filename_cat($output_dir,$id_fname);
     216    &FileUtils::makeDirectory($output_dir)  if (!-e "$output_dir");
     217
     218    my $full_id_fname = &FileUtils::filenameConcatenate($output_dir,$id_fname);
    215219
    216220    my $wget_cmd = "wget $wgetopt --quiet -O \"$full_id_fname\" \"$doc_url\"";
     221
     222    # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?)
     223    &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set
    217224
    218225    if (system($wget_cmd)!=0) {
     
    245252    my $i_os = $i; #convert OAI set separators (:) to OS dir sep
    246253    $i_os =~ s/:/$ds/g;
    247     my $file_i = &util::filename_cat($output_dir,"$i_os.oai");
     254    my $file_i = &FileUtils::filenameConcatenate($output_dir,"$i_os.oai");
    248255
    249256    # obtain record
    250257    my $wget_cmd = "wget $wgetopt -q -O - \"$url\"";
     258
     259    # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?)
     260    &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set
    251261
    252262    open (OAIIN,"$wget_cmd|")
     
    267277    my ($i_dir,$unused) = dir_file_split($file_i_url);
    268278
    269     &util::mk_all_dir($i_dir);
     279    &FileUtils::makeAllDirectories($i_dir);
    270280
    271281    # look out for identifier tag in metadata section
     
    286296##          $revised_doc_url =~ s/hdl\.handle\.net/mcgonagall.cs.waikato.ac.nz:8080\/dspace\/handle/;
    287297           
    288             my $srcdocs_dir = &util::filename_cat($i_dir,"srcdocs");
     298            my $srcdocs_dir = &FileUtils::filenameConcatenate($i_dir,"srcdocs");
    289299
    290300            if (get_oai_document($revised_doc_url,$srcdocs_dir, $out)) {               
     
    360370    # get acquire list
    361371    my $acquire = [];
    362     $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg");
     372    $configfilename = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg");
    363373    if (-e $configfilename) {
    364374    $collectcfg = &colcfg::read_collect_cfg ($configfilename);
     
    383393    # fill in the default import directory if none
    384394    # were supplied, turn all \ into / and remove trailing /
    385     $importdir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq "";
     395    $importdir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'}, "import") if $importdir eq "";
    386396    $importdir =~ s/[\\\/]+/\//g;
    387397    $importdir =~ s/\/$//;
     
    391401    print $out "Warning - removing current contents of the import directory\n";
    392402    print $out "          in preparation for the acquire\n";
    393     &util::rm_r ($importdir);
     403    &FileUtils::removeFilesRecursive($importdir);
    394404    }
    395405
Note: See TracChangeset for help on using the changeset viewer.