source: trunk/gsdl/bin/script/nightly.pl@ 2785

Last change on this file since 2785 was 2785, checked in by sjboddie, 23 years ago

The build process now creates a summary of how many files were included,
which were rejected, etc. A link to a page containing this summary is
provided from the final page of the collector (once the collection is built
successfully) and from the default "about this collection" text for
collections built by the collector.

Also did a little bit of tidying in a couple of places

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.1 KB
Line 
1#!/usr/bin/perl -w
2
3###########################################################################
4#
5# nightly.pl
6#
7# A component of the Greenstone digital library software
8# from the New Zealand Digital Library Project at the
9# University of Waikato, New Zealand.
10#
11# Copyright (C) 1999 New Zealand Digital Library Project
12#
13# This program is free software; you can redistribute it and/or modify
14# it under the terms of the GNU General Public License as published by
15# the Free Software Foundation; either version 2 of the License, or
16# (at your option) any later version.
17#
18# This program is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21# GNU General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with this program; if not, write to the Free Software
25# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26#
27###########################################################################
28
29
30# This program will find all the collections under $GSDLHOME/collect
31# and use the update.pl script to update them all. It should be run
32# every night to keep mirror collections up-to-date.
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 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/plugins");
40 unshift (@INC, "$ENV{'GSDLHOME'}/perllib/classify");
41}
42
43use arcinfo;
44use colcfg;
45use plugin;
46use docprint;
47use util;
48use parsargv;
49
50sub print_usage {
51 print STDERR "\n";
52 print STDERR "nightly.pl: Attempts to update all Greenstone collections found on\n";
53 print STDERR " the local filesystem by calling update.pl for each of\n";
54 print STDERR " them.\n\n";
55 print STDERR " usage: $0 [options]\n\n";
56 print STDERR " options:\n";
57 print STDERR " -verbosity number 0=none, 3=lots\n";
58 print STDERR " -importdir directory Where to place the mirrored material\n";
59 print STDERR " -archivedir directory Where the converted material ends up\n";
60}
61
62
63&main ();
64
65sub main {
66 my ($verbosity, $collectdir, $name, $collection);
67
68 if (!parsargv::parse(\@ARGV,
69 'verbosity/\d+/2', \$verbosity )) {
70 &print_usage();
71 die "\n";
72 }
73
74
75 # get the contents of the collect directory
76 $collectdir = &util::filename_cat($ENV{'GSDLHOME'}, "collect");
77 opendir(CDIR, $collectdir) || die "Cannot open $collectdir: $!";
78 my @files = readdir(CDIR);
79 closedir CDIR;
80
81
82 # update each collection
83 foreach $name (@files) {
84
85 $collection = &util::filename_cat($collectdir, $name);
86
87 # igore entries for "." and ".."
88 next unless ($name =~ /[^\.]/);
89
90 # ignore modelcol
91 next if ($name eq "modelcol");
92
93 # ignore entries that are not directories
94 next unless (-d $collection);
95
96 # ignore directories that do not have a subdir called etc
97 next unless (-d &util::filename_cat($collection, "etc"));
98
99 print "Updating: $name\n";
100 print `update.pl $name`;
101
102 }
103
104}
Note: See TracBrowser for help on using the repository browser.