source: gsdl/trunk/bin/script/incremental-rebuild.pl@ 19410

Last change on this file since 19410 was 19410, checked in by ak19, 15 years ago

Further modifications to launching perl on windows in the new incremental and full building scripts: Removed the check inside the BEGIN statement that insisted on PERLPATH being defined. Now the code uses PERLPATH for launching Perl on Windows if this is defined, otherwise it refers to just perl (assuming it is on the PATH already).

  • Property svn:executable set to *
File size: 3.0 KB
Line 
1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# incremental-rebuild.pl --
6# A component of the Greenstone digital library software
7# from the New Zealand Digital Library Project at the
8# University of Waikato, New Zealand.
9#
10# Copyright (C) 2009 New Zealand Digital Library Project
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25#
26###########################################################################
27
28
29# This program will incrementally rebuild a collection
30# Runs: incremental-import.pl -incremental ...
31# Followed by: incremental-buildcol.pl -incremental -builddir index ...
32# (assumming import.pl did not end with an error)
33
34
35BEGIN {
36 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
37 die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
38 unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
39}
40
41
42use strict;
43
44use util;
45
46sub main
47{
48 my ($argc,@argv) = @_;
49
50 if (($argc==0) || (($argc==1) && ($argv[0] =~ m/^--?h(elp)?$/))) {
51 my ($progname) = ($0 =~ m/^.*\/(.*?)$/);
52
53 print STDERR "\n";
54 print STDERR "Usage: $progname [shared import.pl and buildcol.pl options] collection\n";
55 print STDERR "\n";
56
57 exit(-1);
58 }
59
60
61 my $collect = pop @argv;
62
63 my $quoted_argv = join(" ", map { "\"$_\"" } @argv);
64
65 my $final_status = 0;
66
67 my $launch_cmd = "";
68 if($ENV{'GSDLOS'} =~ m/windows/) {
69 if($ENV{'PERLPATH'}) {
70 $launch_cmd = "$ENV{'PERLPATH'}\\Perl.exe -S ";
71 } else {
72 $launch_cmd = "perl -S ";
73 }
74 }
75
76 print "\n";
77 print "************************\n";
78 print "* Running Import Stage\n";
79 print "************************\n";
80
81 my $import_cmd = $launch_cmd . "incremental-import.pl $quoted_argv \"$collect\"";
82
83 my $import_status = system($import_cmd)/256;
84
85 if ($import_status == 0) {
86 print "\n";
87 print "************************\n";
88 print "* Running Buildcol Stage\n";
89 print "************************\n";
90
91
92 my $buildcol_cmd = $launch_cmd . "incremental-buildcol.pl $quoted_argv \"$collect\"";
93 my $buildcol_status = system($buildcol_cmd)/256;
94 if ($buildcol_status != 0) {
95 $final_status = $buildcol_status;
96 }
97 }
98 else {
99 $final_status = $import_status;
100 }
101
102 exit($final_status);
103}
104
105&main(scalar(@ARGV),@ARGV);
106
Note: See TracBrowser for help on using the repository browser.