Changeset 1678


Ignore:
Timestamp:
2000-11-20T14:00:34+13:00 (23 years ago)
Author:
sjboddie
Message:

Re-added some recent changes that got lost when the cvs repository was
moved. This was mostly changes to the collector and building code

Location:
trunk/gsdl
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/build

    r1507 r1678  
    2424use util;
    2525use cfgread;
     26
     27# set up path - this allows for paths not to be supplied to system calls
     28# and overcomes problems when GSDLHOME contains spaces (double quoting
     29# the call doesn't work on win2k and probably other variants of winnt)
     30my $path_separator = ":";
     31$path_separator = ";" if $ENV{'GSDLOS'} =~ /^windows$/;
     32$ENV{'PATH'} = &util::filename_cat($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}) .
     33    $path_separator . &util::filename_cat($ENV{'GSDLHOME'}, "bin", "script") .
     34    $path_separator . $ENV{'PATH'};
    2635
    2736&parse_args (\@ARGV);
     
    149158        if (-e $download_dir) {
    150159            # copy download_dir and all it contains to the import directory
    151             my $download_cmd = "perl " . &util::filename_cat ($bindir, "script", "filecopy.pl");
     160            my $download_cmd = "perl -S filecopy.pl";
    152161            $download_cmd .= " -collectdir \"$collectdir\"" if $collectdir =~ /\w/;
    153162            $download_cmd .= " -out \"$outfile.download\"" if $use_out;
     
    226235    print $out "importing the $collection collection\n\n";
    227236
    228     my $import_cmd = "perl " . &util::filename_cat ($bindir, "script", "import.pl");
     237    my $import_cmd = "perl -S import.pl";
    229238    $import_cmd .= " -out \"$outfile.import\"" if $use_out;
    230239    $import_cmd .= " -removeold" unless $append;
     
    252261    print $out "building the $collection collection\n\n";
    253262
    254     my $build_cmd = "perl " . &util::filename_cat ($bindir, "script", "buildcol.pl");
     263    my $build_cmd = "perl -S buildcol.pl";
    255264    $build_cmd .= " -out \"$outfile.build\"" if $use_out;
    256265    $build_cmd .= " -collectdir \"$collectdir\"" if $collectdir =~ /\w/;
  • trunk/gsdl/lib/gsdltools.cpp

    r1456 r1678  
    2626#include "gsdltools.h"
    2727
     28#if defined(__WIN32__)
     29#include <windows.h>
     30#include <process.h>
     31#endif
     32
    2833bool littleEndian() {
    2934  char s[2] = {'\xFE', '\xEF'};
     
    5257// characters (e.g. '&') should be quoted with ""
    5358
    54 // on unix systems youcan get the same effext as this function by doing a
    55 // system call and putting the spawned process in the background
    56 // (e.g. system (funcname options &);
    57 
    5859#if defined (__WIN32__)
    59 #include <windows.h>
    6060void gsdl_system (char *cmd, ostream &logout) {
    6161
     
    101101  }
    102102}
     103#endif
    103104
     105
     106// gsdl_call_perl executes the perl script perl_cmd, passing it all the
     107// arguments provided.
     108
     109// Arguments should be char*'s, the last argument should be NULL
     110
     111// perl_cmd shouldn't contain the path to the script as we use "perl -S"
     112// to find it. This means that the PATH environment variable of the calling
     113// process should contain the directory where the perl_cmd script lives.
     114
     115// Uses a standard system() call on unix and a synchronous _spawn() on windows.
     116// We use the _spawn() because windows 9* doesn't seem to pass the
     117// environment of the calling process to the new process when using
     118// system (which we need to do).
     119
     120// all arguments will be quoted with double quotes [""] so they should be unquoted
     121// when passed in.
     122
     123// returns the exit status of the called process (-1 if system() or _spawn() failed)
     124
     125int gsdl_call_perl (char *perl_cmd, ...) {
     126
     127  va_list argn;
     128  char *thisarg = perl_cmd;
     129
     130#if defined(__WIN32__) && !defined (__GNUC__)
     131  int i = 2;
     132#define GSDL_MAX_ARGS 20
     133  char *args[GSDL_MAX_ARGS];
     134  args[0] = "perl";
     135  args[1] = "-S";
     136#else
     137  text_t cmd = "perl -S";
    104138#endif
     139
     140  // get arguments
     141  va_start(argn, perl_cmd);
     142  while(thisarg != NULL) {
     143#if defined(__WIN32__) && !defined (__GNUC__)
     144    if (i >= GSDL_MAX_ARGS) break;
     145    text_t tmp = thisarg;
     146    tmp = "\"" + tmp + "\"";
     147    args[i] = tmp.getcstr();
     148    i++;
     149#else
     150    cmd += " \"";
     151    cmd += thisarg;
     152    cmd.push_back ('"');
     153#endif
     154    thisarg = va_arg(argn, char *);
     155  }
     156  va_end(argn);
     157
     158#if defined(__WIN32__) && !defined (__GNUC__)
     159  args[i] = NULL;
     160  int rv = _spawnvp (_P_WAIT, "perl", args);
     161  while (--i > 2) delete (args[i]);
     162#else
     163  char *cmdc = cmd.getcstr();
     164  int rv = system (cmdc);
     165  delete (cmdc);
     166#endif
     167  return rv;
     168}
  • trunk/gsdl/lib/gsdltools.h

    r1456 r1678  
    3636bool littleEndian();
    3737
     38
    3839// escapes '\' and '_' characters with '\'
    3940// note that single '\' characters occurring
     
    4647// program continues and terminates normally). Arguments containing special
    4748// characters (e.g. '&') should be quoted with ""
     49void gsdl_system (char *cmd, ostream &logout);
    4850
    49 // on unix systems youcan get the same effext as this function by doing a
    50 // system call and putting the spawned process in the background
    51 // (e.g. system (funcname options &);
    52 //#if defined (__WIN32__)
    53 void gsdl_system (char *cmd, ostream &logout);
    54 //#endif
     51
     52// gsdl_call_perl executes the perl script perl_cmd, passing it all the
     53// arguments provided.
     54
     55// Arguments should be text_t's, the last argument should be an empty text_t.
     56
     57// perl_cmd shouldn't contain the path to the script as we use "perl -S"
     58// to find it. This means that the PATH environment variable of the calling
     59// process should contain the directory where the perl_cmd script lives.
     60
     61// Uses a standard system() call on unix and a synchronous _spawn() on windows.
     62// We use the _spawn() because windows 9* doesn't seem to pass the
     63// environment of the calling process to the new process when using
     64// system (which we need to do).
     65
     66// all arguments will be quoted with double quotes [""] so they should be unquoted
     67// when passed in.
     68
     69// returns the exit status of the called process (-1 if system() or _spawn() failed)
     70int gsdl_call_perl (char *perl_cmd, ...);
     71
    5572
    5673#endif
  • trunk/gsdl/macros/collect.dm

    r1655 r1678  
    982982deleted. Possible causes are:
    983983<ul>
    984 <li> Greenstone does not have permission to delete the gsdl/collect/_cgibc1dirname_
     984<li> Greenstone does not have permission to delete the _gsdlhome_/collect/_cgiargbc1dirname_
    985985directory.
    986986</ul>
     
    10271027directory. Possible causes are:
    10281028<ul>
    1029 <li> Greenstone does not have read/write access to the gsdl/tmp
     1029<li> Greenstone does not have read/write access to the _gsdlhome_/tmp
    10301030     directory.
    10311031</ul>
     
    10401040collection (mkcol.pl failed). Possible causes are:
    10411041<ul>
    1042 <li> Greenstone does not have permission to write to the gsdl/tmp
     1042<li> Greenstone does not have permission to write to the _gsdlhome_/tmp
    10431043     directory.
    10441044<li> mkcol.pl perl script errors.
     
    10771077Possible causes are:
    10781078<ul>
    1079 <li> Greenstone does not have permission to write to the gsdl/collect
     1079<li> Greenstone does not have permission to write to the _gsdlhome_/collect
    10801080     directory.
    1081 <li> A _cgiargsbc1dirname_ collection already exists in the gsdl/collect
     1081<li> A _cgiargbc1dirname_ collection already exists in the _gsdlhome_/collect
    10821082     directory.
    10831083</ul>
Note: See TracChangeset for help on using the changeset viewer.