Changeset 1679 for trunk/gsdl
- Timestamp:
- 2000-11-20T14:03:26+13:00 (24 years ago)
- Location:
- trunk/gsdl
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/doc.pm
r1388 r1679 220 220 $ENV{'GSDLOS'},"hashfile$osexe"); 221 221 my $result = "NULL"; 222 222 223 223 if (-e "$hashfile_exe") { 224 $result = `$hashfile_exe \"$filename\"`; 224 # $result = `\"$hashfile_exe\" \"$filename\"`; 225 $result = `hashfile$osexe \"$filename\"`; 225 226 ($result) = $result =~ /:\s*([0-9a-f]+)/i; 226 227 … … 252 253 253 254 } else { 254 255 print STDERR "doc::set_OID source filename undefined/non-existant (continuing)\n"; 255 256 # this warning causes more confusion than it's worth I think 257 # -- sorry Gordon. 258 # print STDERR "doc::set_OID source filename undefined/non-existant (continuing)\n"; 256 259 257 260 $filename = &util::get_tmp_filename(); -
trunk/gsdl/perllib/mgbuilder.pm
r1483 r1679 203 203 } else { 204 204 if (!-e "$mg_passes_exe" || 205 !open (PIPEOUT, "| $mg_passes_exe -f $fulltextprefix -b $maxdocsize -T1 $osextra")) { 205 # !open (PIPEOUT, "| \"$mg_passes_exe\" -f \"$fulltextprefix\" -b $maxdocsize -T1 $osextra")) { 206 !open (PIPEOUT, "| mg_passes$exe -f \"$fulltextprefix\" -b $maxdocsize -T1 $osextra")) { 206 207 die "mgbuilder::compress_text - couldn't run $mg_passes_exe\n"; 207 208 } … … 234 235 die "mgbuilder::compress_text - couldn't run $mg_compression_dict_exe\n"; 235 236 } 236 system ("$mg_compression_dict_exe -f $fulltextprefix -S -H -2 -k 5120 $osextra"); 237 # system ("\"$mg_compression_dict_exe\" -f \"$fulltextprefix\" -S -H -2 -k 5120 $osextra"); 238 system ("mg_compression_dict$exe -f \"$fulltextprefix\" -S -H -2 -k 5120 $osextra"); 237 239 238 240 # -b $maxdocsize sets the maximum document size to be 12 meg 239 241 if (!-e "$mg_passes_exe" || 240 !open ($handle, "| $mg_passes_exe -f $fulltextprefix -b $maxdocsize -T2 $osextra")) { 242 # !open ($handle, "| \"$mg_passes_exe\" -f \"$fulltextprefix\" -b $maxdocsize -T2 $osextra")) { 243 !open ($handle, "| mg_passes$exe -f \"$fulltextprefix\" -b $maxdocsize -T2 $osextra")) { 241 244 die "mgbuilder::compress_text - couldn't run $mg_passes_exe\n"; 242 245 } … … 484 487 } else { 485 488 if (!-e "$mg_passes_exe" || 486 !open (PIPEOUT, "| $mg_passes_exe -f $fullindexprefix -b $maxdocsize " . 489 # !open (PIPEOUT, "| \"$mg_passes_exe\" -f \"$fullindexprefix\" -b $maxdocsize " . 490 !open (PIPEOUT, "| mg_passes$exe -f \"$fullindexprefix\" -b $maxdocsize " . 487 491 "-$index_level -m 32 -s 0 -G -t 10 -N1 $osextra")) { 488 492 die "mgbuilder::build_index - couldn't run $mg_passes_exe\n"; … … 509 513 die "mgbuilder::build_index - couldn't run $mg_perf_hash_build_exe\n"; 510 514 } 511 system ("$mg_perf_hash_build_exe -f $fullindexprefix $osextra"); 515 # system ("\"$mg_perf_hash_build_exe\" -f \"$fullindexprefix\" $osextra"); 516 system ("mg_perf_hash_build$exe -f \"$fullindexprefix\" $osextra"); 512 517 513 518 if (!-e "$mg_passes_exe" || 514 !open ($handle, "| $mg_passes_exe -f $fullindexprefix -b $maxdocsize " . 519 # !open ($handle, "| \"$mg_passes_exe\" -f \"$fullindexprefix\" -b $maxdocsize " . 520 !open ($handle, "| mg_passes$exe -f \"$fullindexprefix\" -b $maxdocsize " . 515 521 "-$index_level -c 3 -G -t 10 -N2 $osextra")) { 516 522 die "mgbuilder::build_index - couldn't run $mg_passes_exe\n"; … … 536 542 die "mgbuilder::build_index - couldn't run $mg_weights_build_exe\n"; 537 543 } 538 system ("$mg_weights_build_exe -f $fullindexprefix -t $fulltextprefix $osextra"); 544 # system ("\"$mg_weights_build_exe\" -f \"$fullindexprefix\" -t \"$fulltextprefix\" $osextra"); 545 system ("mg_weights_build$exe -f \"$fullindexprefix\" -t \"$fulltextprefix\" $osextra"); 539 546 540 547 # create 'on-disk' stemmed dictionary … … 543 550 die "mgbuilder::build_index - couldn't run $mg_invf_dict_exe\n"; 544 551 } 545 system ("$mg_invf_dict_exe -f $fullindexprefix $osextra"); 552 # system ("\"$mg_invf_dict_exe\" -f \"$fullindexprefix\" $osextra"); 553 system ("mg_invf_dict$exe -f \"$fullindexprefix\" $osextra"); 546 554 547 555 … … 551 559 die "mgbuilder::build_index - couldn't run $mg_stem_idx_exe\n"; 552 560 } 553 system ("$mg_stem_idx_exe -b 4096 -s1 -f $fullindexprefix $osextra"); 554 system ("$mg_stem_idx_exe -b 4096 -s2 -f $fullindexprefix $osextra"); 555 system ("$mg_stem_idx_exe -b 4096 -s3 -f $fullindexprefix $osextra"); 561 # system ("\"$mg_stem_idx_exe\" -b 4096 -s1 -f \"$fullindexprefix\" $osextra"); 562 system ("mg_stem_idx$exe -b 4096 -s1 -f \"$fullindexprefix\" $osextra"); 563 # system ("\"$mg_stem_idx_exe\" -b 4096 -s2 -f \"$fullindexprefix\" $osextra"); 564 system ("mg_stem_idx$exe -b 4096 -s2 -f \"$fullindexprefix\" $osextra"); 565 # system ("\"$mg_stem_idx_exe\" -b 4096 -s3 -f \"$fullindexprefix\" $osextra"); 566 system ("mg_stem_idx$exe -b 4096 -s3 -f \"$fullindexprefix\" $osextra"); 556 567 557 568 … … 603 614 $handle = STDOUT; 604 615 } else { 605 if (!-e "$txt2db_exe" || !open (PIPEOUT, "| $txt2db_exe $fulldbname")) { 616 # if (!-e "$txt2db_exe" || !open (PIPEOUT, "| \"$txt2db_exe\" \"$fulldbname\"")) { 617 if (!-e "$txt2db_exe" || !open (PIPEOUT, "| txt2db$exe \"$fulldbname\"")) { 606 618 die "mgbuilder::make_infodatabase - couldn't run $txt2db_exe\n"; 607 619 } … … 679 691 my $mgstat_exe = &util::filename_cat($exedir, "mgstat$exe"); 680 692 my $input_file = &util::filename_cat ("text", $self->{'collection'}); 681 if (!-e "$mgstat_exe" || !open (PIPEIN, "$mgstat_exe -d $self->{'build_dir'} -f $input_file |")) { 693 # if (!-e "$mgstat_exe" || !open (PIPEIN, "\"$mgstat_exe\" -d \"$self->{'build_dir'}\" -f \"$input_file\" |")) { 694 if (!-e "$mgstat_exe" || !open (PIPEIN, "mgstat$exe -d \"$self->{'build_dir'}\" -f \"$input_file\" |")) { 682 695 print $outhandle "Warning: Couldn't open pipe to $mgstat_exe to get additional stats\n"; 683 696 } else { -
trunk/gsdl/src/recpt/collectoraction.cpp
r1660 r1679 48 48 gsdlosc = NULL; 49 49 gsdlhomec = NULL; 50 pathc = NULL; 50 51 51 52 cgiarginfo arg_ainfo; … … 217 218 if (gsdlosc != NULL) delete gsdlosc; 218 219 if (gsdlhomec != NULL) delete gsdlhomec; 220 if (pathc != NULL) delete pathc; 219 221 } 220 222 221 223 bool collectoraction::init (ostream & /*logout*/) { 222 224 223 // set up GSDLOS and GSDLHOME environment variables 224 text_t gsdlos; 225 // set up GSDLOS, GSDLHOME and PATH environment variables 226 text_t gsdlos, path; 227 unsigned int path_separator = ':'; 225 228 #if defined (__WIN32__) 226 229 gsdlos = "windows"; 230 path_separator = ';'; 227 231 #else 228 232 utsname *buf = new utsname(); … … 233 237 lc (gsdlos); 234 238 #endif 235 239 240 pathc = getenv ("PATH"); 241 path = filename_cat (gsdlhome, "bin", gsdlos); 242 path.push_back (path_separator); 243 path += filename_cat (gsdlhome, "bin", "script"); 244 if (pathc != NULL) { 245 path.push_back (path_separator); 246 path += pathc; 247 } 248 path = "PATH=" + path; 249 236 250 gsdlos = "GSDLOS=" + gsdlos; 237 251 text_t setgsdlhome = "GSDLHOME=" + gsdlhome; … … 240 254 gsdlosc = gsdlos.getcstr(); 241 255 gsdlhomec = setgsdlhome.getcstr(); 256 pathc = path.getcstr(); 242 257 243 258 putenv (gsdlosc); 244 259 putenv (gsdlhomec); 260 putenv (pathc); 245 261 246 262 return true; … … 272 288 // partially built collection laying about -- may need to think about doing 273 289 // this in the background). 274 text_t cleantmp_cmd = "perl " + filename_cat (gsdlhome, "bin", "script", "cleantmp.pl"); 275 char *cleantmp_cmdc = cleantmp_cmd.getcstr(); 276 system (cleantmp_cmdc); 277 delete cleantmp_cmdc; 290 gsdl_call_perl ("cleantmp.pl", NULL); 278 291 } 279 292 … … 798 811 // _header_ -- may be set for pages that require it 799 812 // _faillog_ - set to last 6 lines of .bld file if build failed 813 // _gsdlhome_ - the gsdlhome path (dm_safe) 800 814 801 815 text_t &collector_page = args["cp"]; … … 930 944 here ++; 931 945 } 932 disp.setmacro ("faillog", "collector", faillog);946 disp.setmacro ("faillog", "collector", dm_safe(faillog)); 933 947 } 934 948 … … 942 956 if (collector_page == "bildstatus") 943 957 set_statusline (disp, args, logout); 958 959 disp.setmacro ("gsdlhome", "collector", dm_safe(gsdlhome)); 944 960 } 945 961 … … 974 990 975 991 } else { 976 977 text_t delete_cmd = "perl " + filename_cat (gsdlhome, "bin", "script", "delcol.pl"); 978 delete_cmd += " -f " + collection; 979 char *delete_cmdc = delete_cmd.getcstr(); 980 int rv = system (delete_cmdc); 981 delete delete_cmdc; 992 // first we need to free up the collection's collection server 993 // we must do this for the local library (and I guess when using 994 // fastcgi too) as you can't delete the gdbm file while it's 995 // being kept open by the collection server 996 remove_colservr (collection, logout); 997 998 char *collectionc = collection.getcstr(); 999 int rv = gsdl_call_perl ("delcol.pl", "-f", collectionc, NULL); 1000 delete collectionc; 982 1001 if (rv != 0) { 983 1002 // deletion failed -- permissions? … … 1152 1171 if (file_exists (createfile)) { 1153 1172 return; 1173 } 1174 1175 // set up options 1176 text_t options = "-creator \"" + args["bc1contactemail"] + "\""; 1177 options += " -title \"" + args["bc1fullname"] + "\""; 1178 options += " -about \"" + carriage_replace (args["bc1aboutdesc"], 0) + "\""; 1179 options += " -collectdir \"" + tmpdir + "\" "; 1180 text_t optionfile = filename_cat (tmpdir, "mkcol.opt"); 1181 char *optionfilec = optionfile.getcstr(); 1182 ofstream ofile_out (optionfilec); 1183 if (!ofile_out) { 1184 message = "tmpfail"; 1185 delete optionfilec; 1186 return; 1187 } 1188 outconvertclass text_t2ascii; 1189 ofile_out << text_t2ascii << options << "\n"; 1190 ofile_out.close(); 1191 1192 char *collectionc = collection.getcstr(); 1193 1194 // this is just an ordinary system call running in the foreground. we're assuming (hoping??) 1195 // that mkcol.pl will run through fast enough that nothing more elaborate is required. 1196 gsdl_call_perl ("mkcol.pl", "-optionfile", optionfilec, collectionc, NULL); 1197 1198 delete optionfilec; 1199 delete collectionc; 1200 1201 // make sure it went ok 1202 text_t cfgfile = filename_cat (tmpdir, collection, "etc", "collect.cfg"); 1203 if (!file_writable (cfgfile)) { 1204 message = "mkcolfail"; 1154 1205 } else { 1155 1206 // create the .create file (this file is just a place holder to let any future … … 1165 1216 return; 1166 1217 } 1167 }1168 1169 // set up options1170 text_t options = "-creator \"" + args["bc1contactemail"] + "\"";1171 options += " -title \"" + args["bc1fullname"] + "\"";1172 options += " -about \"" + carriage_replace (args["bc1aboutdesc"], 0) + "\"";1173 options += " -collectdir \"" + tmpdir + "\" ";1174 text_t optionfile = filename_cat (tmpdir, "mkcol.opt");1175 char *optionfilec = optionfile.getcstr();1176 ofstream ofile_out (optionfilec);1177 delete optionfilec;1178 if (!ofile_out) {1179 message = "tmpfail";1180 return;1181 }1182 outconvertclass text_t2ascii;1183 ofile_out << text_t2ascii << options << "\n";1184 ofile_out.close();1185 1186 // set up the mkcol.pl command1187 text_t mkcol_cmd = "perl ";1188 mkcol_cmd += filename_cat (gsdlhome, "bin", "script", "mkcol.pl");1189 mkcol_cmd += " -optionfile \"" + optionfile + "\" " + collection;1190 char *mkcol_cmdc = mkcol_cmd.getcstr();1191 1192 // just an ordinary system call running in the foreground. we're assuming (hoping??)1193 // that mkcol.pl will run through fast enough that nothing more elaborate is required.1194 system (mkcol_cmdc);1195 delete mkcol_cmdc;1196 1197 // make sure it went ok1198 text_t cfgfile = filename_cat (tmpdir, collection, "etc", "collect.cfg");1199 if (!file_writable (cfgfile)) {1200 message = "mkcolfail";1201 1218 } 1202 1219 } … … 1255 1272 options += " -download \"" + args["bc1inputdir4"] + "\""; 1256 1273 text_t optionfile = filename_cat (tmpdir, "build.opt"); 1257 char *optionfile t= optionfile.getcstr();1258 ofstream ofile_out (optionfile t);1259 delete optionfile t;1274 char *optionfilec = optionfile.getcstr(); 1275 ofstream ofile_out (optionfilec); 1276 delete optionfilec; 1260 1277 if (!ofile_out) { 1261 1278 message = "tmpfail"; … … 1267 1284 1268 1285 // set up the build command 1269 text_t build_cmd = "perl " + filename_cat (gsdlhome, "bin", "script", "build"); 1270 build_cmd += " -optionfile \"" + optionfile + "\" " + collection; 1271 #if !defined (__WIN32__) 1272 // run in background on unix systems 1273 // build_cmd += " &"; 1274 #endif 1286 // Can't seem to get "perl -S" to work properly here on windows 95... 1287 //text_t build_cmd = "perl -S build -optionfile \"" + optionfile + "\" " + collection; 1288 text_t build_cmd = "perl \"" + filename_cat(gsdlhome, "bin", "script", "build") + 1289 "\" -optionfile \"" + optionfile + "\" " + collection; 1275 1290 char *build_cmdc = build_cmd.getcstr(); 1276 // #if defined (__WIN32__)1291 // run build command in background 1277 1292 gsdl_system (build_cmdc, logout); 1278 //#else1279 // system (build_cmdc);1280 //#endif1281 1293 delete build_cmdc; 1282 1294 } … … 1286 1298 // c++ code. I ran into some problems though (like how do you write a portable 1287 1299 // "rm -r" in c++?). One day I'll spend some time sorting it out ... maybe. 1288 text_t cancel_cmd = "perl " + filename_cat (gsdlhome, "bin", "script", "cancel_build.pl"); 1289 cancel_cmd += " -collectdir \"" + filename_cat (gsdlhome, "tmp", args["bc1tmp"]) + 1290 "\" " + args["bc1dirname"]; 1291 char *cancel_cmdc = cancel_cmd.getcstr(); 1292 system (cancel_cmdc); 1293 delete (cancel_cmdc); 1300 text_t collectdir = filename_cat (gsdlhome, "tmp", args["bc1tmp"]); 1301 char *collectdirc = collectdir.getcstr(); 1302 char *collectionc = args["bc1dirname"].getcstr(); 1303 1304 gsdl_call_perl ("cancel_build.pl", "-collectdir", collectdirc, collectionc, NULL); 1305 delete (collectdirc); 1306 delete (collectionc); 1294 1307 } 1295 1308 … … 1375 1388 logout << "collectoraction::create_colserver: no valid nullproto found\n"; 1376 1389 } 1390 1391 // delete a collection server from the null protocol 1392 void collectoraction::remove_colservr (const text_t &collection, ostream &logout) { 1393 1394 recptprotolistclass *protos = recpt->get_recptprotolist_ptr(); 1395 recptprotolistclass::iterator rprotolist_here = protos->begin(); 1396 recptprotolistclass::iterator rprotolist_end = protos->end(); 1397 while (rprotolist_here != rprotolist_end) { 1398 if ((*rprotolist_here).p != NULL) { 1399 if ((*rprotolist_here).p->get_protocol_name () == "nullproto") { 1400 (*rprotolist_here).p->remove_collection (collection, logout); 1401 return; 1402 } 1403 } 1404 rprotolist_here ++; 1405 } 1406 1407 logout << "collectoraction::create_colserver: no valid nullproto found\n"; 1408 } -
trunk/gsdl/src/recpt/collectoraction.h
r1649 r1679 38 38 char *gsdlosc; 39 39 char *gsdlhomec; 40 char *pathc; 40 41 41 42 text_t message; … … 79 80 void create_colserver (const text_t &collection, ostream &logout); 80 81 82 void remove_colservr (const text_t &collection, ostream &logout); 83 81 84 public: 82 85 collectoraction (); -
trunk/gsdl/src/recpt/nullproto.cpp
r1649 r1679 151 151 } 152 152 153 // remove_collection deletes the collection server of collection. 154 // This only needs to be called if a collectionserver is to be 155 // removed while the library is running. The destructor function 156 // cleans up all collectservers when the program exits. 157 void nullproto::remove_collection (const text_t &collection, ostream &logout) { 158 collectservermapclass::iterator here = cservers.begin(); 159 collectservermapclass::iterator end = cservers.end(); 160 161 while (here != end) { 162 if ((*here).second.c != NULL && (*here).first == collection) { 163 delete (*here).second.c; 164 cservers.erase (here); 165 return; 166 } 167 here ++; 168 } 169 outconvertclass text_t2ascii; 170 logout << text_t2ascii << "nullproto::remove_collection: failed to remove collectserver for " 171 << collection << "\n"; 172 } 173 153 174 // this configure will configure each of the collection servers 154 175 void nullproto::configure (const text_t &key, const text_tarray &cfgline) { -
trunk/gsdl/src/recpt/nullproto.h
r1649 r1679 49 49 {cservers.addcollectserver(thecserver);} 50 50 51 // remove_collection deletes the collection server of collection. 52 // This only needs to be called if a collectionserver is to be 53 // removed while the library is running as the destructor function 54 // cleans up all collectservers when the program exits. 55 void remove_collection (const text_t &collection, ostream &logout); 56 51 57 // this configure will configure each of the collection servers 52 58 void configure (const text_t &key, const text_tarray &cfgline); -
trunk/gsdl/src/recpt/recptproto.cpp
r1649 r1679 31 31 void recptproto::add_collection (const text_t &/*collection*/, void * /*recpt*/, 32 32 const text_t &/*gsdlhome*/, const text_t &/*gdbmhome*/) { 33 } 34 35 void recptproto::remove_collection (const text_t &/*collection*/, ostream &/*logout*/) { 33 36 } 34 37 -
trunk/gsdl/src/recpt/recptproto.h
r1649 r1679 57 57 virtual void add_collection (const text_t &collection, void *recpt, 58 58 const text_t &gsdlhome, const text_t &gdbmhome); 59 60 virtual void remove_collection (const text_t &collection, ostream &logout); 59 61 60 62 // configure should be called for each line in the configuration file -
trunk/gsdl/src/w32server/cgiwrapper.cpp
r1649 r1679 659 659 RequestInfoT *RequestInfo, 660 660 RequestFieldsT *RequestFields) { 661 char tmpstr[ 1024];662 char tailstr[MAX_URL_SIZE ];661 char tmpstr[MAX_URL_SIZE+1024]; 662 char tailstr[MAX_URL_SIZE+16]; 663 663 664 664 // do any url adjustments necessary … … 722 722 } 723 723 724 int ExamineURIStr(char *URIStr, RequestInfoT *RequestInfo,724 int ExamineURIStr(char *URIStr, RequestInfoT *RequestInfo, 725 725 RequestFieldsT *RequestFields) 726 726 { … … 740 740 } 741 741 URIStr[len] = '\0'; 742 } else { 743 MessageBox (NULL, "POST data too long", "Greenstone Digital Library Software", MB_OK); 742 744 } 743 745 }
Note:
See TracChangeset
for help on using the changeset viewer.