Changeset 28560 for main/trunk/greenstone2/perllib
- Timestamp:
- 2013-10-30T20:54:49+13:00 (11 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/classify/Phind.pm
r27905 r28560 167 167 168 168 # Ensure the Phind generate scripts are in place 169 170 # the suffix binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 171 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 172 169 173 my $file1 = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "suffix"); 170 174 $file1 .= ".exe" if $ENV{'GSDLOS'} =~ /^windows$/; -
main/trunk/greenstone2/perllib/doc.pm
r27538 r28560 373 373 my $hashfile_exe = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"bin", 374 374 $ENV{'GSDLOS'},"hashfile$osexe"); 375 376 &util::set_gnomelib_env(); # gnomelib_env (particularly lib/libiconv2.dylib) required to run the hashfile executable on Mac Lions 377 # The subroutine will set the gnomelib env once for each subshell launched, by first testing if GEXTGNOME is not already set 375 378 376 379 my $result = "NULL"; -
main/trunk/greenstone2/perllib/downloaders/WgetDownload.pm
r28250 r28560 35 35 use strict; 36 36 use Cwd; 37 use util; 37 38 use IPC::Open3; 38 39 use IO::Select; … … 139 140 140 141 my $self = new BaseDownload($getlist,$inputargs,$hashArgOptLists); 142 143 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 144 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 141 145 142 146 return bless $self, $class; -
main/trunk/greenstone2/perllib/g2futil.pm
r26440 r28560 9 9 } 10 10 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"); 12 12 &util::envvar_append("PATH",$fedora_client_bin); 13 13 } … … 15 15 use strict; 16 16 use util; 17 use FileUtils; 17 18 18 19 sub run_cmd_old … … 186 187 #$ENV{'fgsPassword'} = $options->{'password'}; 187 188 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"); 190 191 191 192 my $gsearch_commands = "updateIndex deletePid"; # deletePID … … 214 215 #$ENV{'fgsPassword'} = $options->{'password'}; 215 216 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"); 218 219 219 220 my $gsearch_commands = "updateIndex fromPid"; # fromPID … … 231 232 # if GS3, first look for a fedoragsearch webapp installed in Greenstone's tomcat 232 233 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)); 235 236 } 236 237 237 238 # next look for a fedoragsearch webapp installed in Fedora's tomcat 238 239 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)); 241 242 } 242 243 … … 287 288 288 289 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); 290 291 closedir DIR; 291 292 … … 294 295 295 296 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); 297 298 push(@$all_dirs,$full_hash_dir); 298 299 } 299 300 300 301 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); 302 303 rec_get_all_hash_dirs($full_rec_dir,$all_dirs); 303 304 } … … 329 330 my $hash_id = undef; 330 331 331 my $docmets_filename = & util::filename_cat($hash_dir,"docmets.xml");332 my $docmets_filename = &FileUtils::filenameConcatenate($hash_dir,"docmets.xml"); 332 333 333 334 if (open(DIN,"<$docmets_filename")) … … 372 373 # to temporarily set CATALINA_HOME to fedora's tomcat. (Catalina is undefined for GS2.) 373 374 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"); 375 376 376 377 # 1. Find out which folder to write to: fedora_host or localhost 377 378 # whichever contains fedora.xml is the one we want (if none, exit with error value?) 378 379 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"); 383 384 if (!-e $xmlFile) { 384 385 # 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"); 387 388 if(!-e $xmlFile) { 388 389 # try putting gsdl in this folder, but still print a warning … … 405 406 # 3. If there is already a gsdl.xml file in host_path, compare the string we 406 407 # 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"); 408 409 if(-e $xmlFile) { 409 410 # such a file exists, so read the contents … … 428 429 # a. First stop the fedora server 429 430 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); 431 432 # execute the command 432 433 $! = 0; # does this initialise the return value? … … 447 448 448 449 # 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); 450 451 $! = 0; 451 452 $status = system($start_tomcat); … … 458 459 $ENV{'CATALINA_HOME'} = $gs_catalina_home if defined $gs_catalina_home; 459 460 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 460 464 # Starting up the Fedora server takes a long time. We need to wait for the server to be 461 465 # ready before import can continue, because g2f-import relies on an up-and-running Fedora -
main/trunk/greenstone2/perllib/giget.pm
r24601 r28560 80 80 81 81 if ((!-e $downloadto_fname) || (-z $downloadto_fname)) { 82 83 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 84 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 85 82 86 my $cmd = "wget -nv -T 10 -nc -U \"Mozilla\" -O \"$downloadto_fname\" \"$full_url\""; 83 87 ## print STDERR "*** wget cmd:\n $cmd\n"; -
main/trunk/greenstone2/perllib/plugins/LOMPlugin.pm
r24971 r28560 37 37 use MetadataRead; 38 38 use util; 39 use FileUtils; 39 40 use XMLParser; 40 41 use Cwd; … … 582 583 my $output_dir = $self->{'output_dir'}; 583 584 584 $output_dir = & util::filename_cat($output_dir,"_gsdldown.all");585 $output_dir = &FileUtils::filenameConcatenate($output_dir,"_gsdldown.all"); 585 586 586 587 if (! -d $output_dir) { … … 596 597 $file_url .= "index.html" if ($file_url =~ m/\/$/); 597 598 598 my $full_file_url = & util::filename_cat($output_dir,$file_url);599 my $full_file_url = &FileUtils::filenameConcatenate($output_dir,$file_url); 599 600 # the path to srcdoc will be used later in extrametadata to associate 600 601 # the lom metadata with the document. Needs to be relative to current 601 602 # directory. 602 my $srcdoc_path = & util::filename_cat("_gsdldown.all", $file_url);603 my $srcdoc_path = &FileUtils::filenameConcatenate("_gsdldown.all", $file_url); 603 604 my $check_timestamp = $self->{'check_timestamp'}; 604 605 my $status; … … 628 629 } 629 630 ##print STDERR "**** wget = $wget_cmd\n"; 630 631 632 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 633 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 631 634 632 635 $status = system($wget_cmd); -
main/trunk/greenstone2/perllib/plugins/MediaWikiPlugin.pm
r19123 r28560 35 35 use HTMLPlugin; 36 36 use unicode; 37 use util; 38 use FileUtils; 37 39 38 40 use strict; # every perl program should have this! … … 218 220 $css_files[$css_file_count++] = $2 if defined $2; 219 221 } 222 223 # Set the env for wget once, outside the for loop 224 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 225 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 220 226 221 227 # download the stylesheets if we haven't downloaded them yet … … 238 244 $css_file =~ s/\?(.+)$//isg; 239 245 240 my $css_file_path = & util::filename_cat($base_dir, $css_file);246 my $css_file_path = &FileUtils::filenameConcatenate($base_dir, $css_file); 241 247 242 248 # do nothing if we have already downloaded the css files … … 251 257 mkdir($path_check) if (! -d $path_check ); 252 258 } 253 259 254 260 # NOTE: wget needs configuration to directly access Internet 255 261 # These files should already downloaded if we used the MediaWikiDownload … … 293 299 $style_dir =~ s/import$/style/; 294 300 $css_file =~ m/(.*)\/(.*)$/; 295 $style_dir = & util::filename_cat($style_dir, $2);301 $style_dir = &FileUtils::filenameConcatenate($style_dir, $2); 296 302 297 303 if(open(OUTPUT, ">$style_dir")){ … … 477 483 my $macro_path = $base_dir; 478 484 $macro_path =~ s/import$/macros/; 479 my $extradm_file = & util::filename_cat($macro_path, "extra.dm");485 my $extradm_file = &FileUtils::filenameConcatenate($macro_path, "extra.dm"); 480 486 481 487 my $extra_dm = ""; … … 644 650 my $self = shift(@_); 645 651 646 my $about_macro_file = & util::filename_cat($ENV{'GSDLHOME'}, "macros", "about.dm");652 my $about_macro_file = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "macros", "about.dm"); 647 653 my $about_page_content = ""; 648 654 if (open(INPUT, "<$about_macro_file")){ -
main/trunk/greenstone2/perllib/util.pm
r28460 r28560 1650 1650 } 1651 1651 1652 # Sets the gnomelib_env. Based on the logic in wvware.pl which can perhaps be replaced with a call to this function in future 1653 sub set_gnomelib_env 1654 { 1655 ## SET THE ENVIRONMENT AS DONE IN SETUP.BASH/BAT OF GNOME-LIB 1656 # Though this is only needed for darwin Lion at this point (and android, though that is untested) 1657 1658 my $env_vars=""; 1659 1660 my $libext = "so"; 1661 if ($ENV{'GSDLOS'} =~ m/^windows$/i) { 1662 #return $env_vars; 1663 return; 1664 } elsif ($ENV{'GSDLOS'} =~ m/^darwin$/i) { 1665 $libext = "dylib"; 1666 } 1667 1668 if (!defined $ENV{'GEXTGNOME'}) { 1669 ##print STDERR "@@@ Setting GEXTGNOME env\n"; 1670 1671 my $gnome_dir = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"ext","gnome-lib-minimal"); 1672 1673 if(! -d $gnome_dir) { 1674 $gnome_dir = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"ext","gnome-lib"); 1675 1676 if(! -d $gnome_dir) { 1677 $gnome_dir = ""; 1678 } 1679 } 1680 1681 # now set other the related env vars, 1682 # IF we've found the gnome-lib dir installed in the ext folder 1683 1684 if ($gnome_dir ne "" && -f &FileUtils::filenameConcatenate($gnome_dir, $ENV{'GSDLOS'}, "lib", "libiconv.$libext")) { 1685 $ENV{'GEXTGNOME'} = $gnome_dir; 1686 $ENV{'GEXTGNOME_INSTALLED'}=&FileUtils::filenameConcatenate($ENV{'GEXTGNOME'}, $ENV{'GSDLOS'}); 1687 1688 my $gnomelib_bin = &FileUtils::filenameConcatenate($ENV{'GEXTGNOME_INSTALLED'}, "bin"); 1689 if(-d $gnomelib_bin) { # no bin subfolder in GS binary's cutdown gnome-lib-minimal folder 1690 &util::envvar_prepend("PATH", $gnomelib_bin); 1691 #$env_vars = "export PATH=".$ENV{'PATH'}.";"; 1692 } 1693 1694 # util's prepend will create LD/DYLD_LIB_PATH if it doesn't exist yet 1695 my $gextlib = &FileUtils::filenameConcatenate($ENV{'GEXTGNOME_INSTALLED'}, "lib"); 1696 1697 if($ENV{'GSDLOS'} eq "linux") { 1698 &util::envvar_prepend("LD_LIBRARY_PATH", $gextlib); 1699 #$env_vars .= "export LD_LIBRARY_PATH=".$ENV{'LD_LIBRARY_PATH'}; 1700 } 1701 elsif ($ENV{'GSDLOS'} eq "darwin") { 1702 #&util::envvar_prepend("DYLD_LIBRARY_PATH", $gextlib); 1703 &util::envvar_prepend("DYLD_FALLBACK_LIBRARY_PATH", $gextlib); 1704 #$env_vars .= "export DYLD_FALLBACK_LIBRARY_PATH=".$ENV{'DYLD_FALLBACK_LIBRARY_PATH'}; 1705 } 1706 } 1707 1708 # Above largely mimics the setup.bash of the gnome-lib-minimal. 1709 # Not doing the devel-srcpack that gnome-lib-minimal's setup.bash used to set 1710 # Not exporting GSDLEXTS variable either 1711 } 1712 1713 # print STDERR "@@@@@ GEXTGNOME: ".$ENV{'GEXTGNOME'}."\n\tINSTALL".$ENV{'GEXTGNOME_INSTALLED'}."\n"; 1714 # print STDERR "\tPATH".$ENV{'PATH'}."\n"; 1715 # print STDERR "\tLD_LIB_PATH".$ENV{'LD_LIBRARY_PATH'}."\n" if $ENV{'LD_LIBRARY_PATH}; 1716 # print STDERR "\tDYLD_FALLBACK_LIB_PATH".$ENV{'DYLD_FALLBACK_LIBRARY_PATH'}."\n" if $ENV{'DYLD_FALLBACK_LIBRARY_PATH}; 1717 1718 # if no GEXTGNOME, maybe users didn't need gnome-lib to run gnomelib/libiconv dependent binaries like hashfile, suffix, wget 1719 # (wvware is launched in a gnomelib env from its own script, but could possibly go through this script in future) 1720 1721 #return $env_vars; #print STDOUT $env_vars; 1722 } 1723 1724 1652 1725 1653 1726 ## @function augmentINC()
Note:
See TracChangeset
for help on using the changeset viewer.