1 | #!/usr/bin/perl -w
|
---|
2 |
|
---|
3 |
|
---|
4 | BEGIN {
|
---|
5 | die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
|
---|
6 | unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
|
---|
7 | }
|
---|
8 |
|
---|
9 |
|
---|
10 | # create_distributions.pl creates the following distribution source directories
|
---|
11 | # from the gsdl directory pointed to by $GSDLHOME (although it uses the
|
---|
12 | # main CVS repository to get the latest source code distribution).
|
---|
13 |
|
---|
14 | # CDROM - main distribution source: gsdl-x.xx-cdrom
|
---|
15 | # UNIX - some additional unix specific stuff: gsdl-x.xx-unix
|
---|
16 | # These first two rely on InstallShield X installer to create the actual distributions (Windows/LInux/Mac, web and CD-ROM)
|
---|
17 | # Source - a source distribution, which just needs to be tarred and gzipped up.
|
---|
18 |
|
---|
19 | # creates ChangeLog using `cvs2cl.pl -P -F trunk -r -S -l "-d'date<tomorrow'"
|
---|
20 | # where date of last distribution is read from the last line of
|
---|
21 | # $GSDLHOME/DistDates or from -ChangeLogDate command line option
|
---|
22 | # should use something like cvs2cl.pl ... -l "-r'last_tag' -r'this_tag'" but
|
---|
23 | # I can't get cvs to ignore files which contain neither last_tag or this_tag
|
---|
24 | # so ChangeLog contains lots of ancient stuff
|
---|
25 |
|
---|
26 | # creates a copy of everything in cvs repository in $tmpdir
|
---|
27 |
|
---|
28 | # edits /tmp/gsdl/etc/VERSION, /tmp/gsdl/src/w32server/fnord.cpp
|
---|
29 | # and /tmp/gsdl/cgi-bin/gsdlsite.cfg to use new version number
|
---|
30 | # and default GSDLHOME
|
---|
31 |
|
---|
32 | # temporary working directory
|
---|
33 | my $tmpdir = '/tmp/';
|
---|
34 |
|
---|
35 | # docs directory - up-to-date copy of everything to go in the docs directory
|
---|
36 | # (including the README.txt) is expected to live here
|
---|
37 | my $docs_dir = '/home/nzdl/gsdl-docs';
|
---|
38 |
|
---|
39 | my $for_distributions_dir = '/home/nzdl/for-distributions';
|
---|
40 |
|
---|
41 | # where the windows binaries live (including library.exe and server.exe)
|
---|
42 | # this currently relies on being a directory ending in "windows"
|
---|
43 | my $winbin = "$ENV{'GSDLHOME'}/bin/windows";
|
---|
44 |
|
---|
45 | # ditto for linux binaries (don't forget getpw)
|
---|
46 | my $linuxbin = "$ENV{'GSDLHOME'}/bin/linux";
|
---|
47 |
|
---|
48 | # ditto for Mac OS/X binaries
|
---|
49 | my $macosxbin = "$ENV{'GSDLHOME'}/bin/darwin";
|
---|
50 |
|
---|
51 | my $cvsanon = ':pserver:[email protected]:2402/usr/local/global-cvs/gsdl-src';
|
---|
52 |
|
---|
53 |
|
---|
54 | use strict;
|
---|
55 | use parsargv;
|
---|
56 | use util;
|
---|
57 |
|
---|
58 | use Cwd;
|
---|
59 |
|
---|
60 |
|
---|
61 | sub print_usage {
|
---|
62 | print STDERR "\n";
|
---|
63 | print STDERR "create_distributions.pl: Packages up Greenstone distributions.\n\n";
|
---|
64 | print STDERR " usage: $0 [options]\n\n";
|
---|
65 | print STDERR " options:\n";
|
---|
66 | print STDERR " -tmpdir temporary directory to use instead of $tmpdir\n";
|
---|
67 | print STDERR " -output_dir directory to output distributions to\n";
|
---|
68 | print STDERR " -version_num version number of distribution (x.xx)\n";
|
---|
69 | print STDERR " -cvs_tag cvs tag from which to create distributions\n";
|
---|
70 | print STDERR " - if not set latest versions will be used.\n";
|
---|
71 | print STDERR " -unesco create unesco style release, i.e. only 4 languages enabled\n";
|
---|
72 | print STDERR " -NoChangeLog don't create ChangeLog\n";
|
---|
73 | print STDERR " -UseExistingLog use $ENV{'GSDLHOME'}/ChangeLog rather than creating one\n";
|
---|
74 | print STDERR " -ChangeLogDate date from which to begin ChangeLog - note that ChangeLog\n";
|
---|
75 | print STDERR " will always run from date to most recent commits, even if\n";
|
---|
76 | print STDERR " cvs_tag is for a previous revision\n\n";
|
---|
77 | }
|
---|
78 |
|
---|
79 | &main ();
|
---|
80 |
|
---|
81 | my $newtmpdir;
|
---|
82 | my $version_num;
|
---|
83 | my $cvs_tag;
|
---|
84 | my $unesco;
|
---|
85 | my $nochangelog;
|
---|
86 | my $useexistinglog;
|
---|
87 | my $changelogdate;
|
---|
88 | my $output_dir;
|
---|
89 |
|
---|
90 | sub main
|
---|
91 | {
|
---|
92 | if (!parsargv::parse(\@ARGV,
|
---|
93 | 'tmpdir/.*/', \$newtmpdir,
|
---|
94 | 'version_num/\d\.\d\d[a-z]?', \$version_num,
|
---|
95 | 'cvs_tag/.*/', \$cvs_tag,
|
---|
96 | 'unesco', \$unesco,
|
---|
97 | 'NoChangeLog', \$nochangelog,
|
---|
98 | 'UseExistingLog', \$useexistinglog,
|
---|
99 | 'ChangeLogDate/.*/', \$changelogdate,
|
---|
100 | 'output_dir/.*/', \$output_dir)) {
|
---|
101 | &print_usage();
|
---|
102 | die "\n";
|
---|
103 | }
|
---|
104 |
|
---|
105 | $tmpdir = $newtmpdir if (defined $newtmpdir && -d $newtmpdir);
|
---|
106 | $output_dir = "." unless $output_dir =~ /\w/;
|
---|
107 | mkdir ($output_dir, 0777) unless -d $output_dir;
|
---|
108 |
|
---|
109 | if ($cvs_tag !~ /\w/) {
|
---|
110 | $cvs_tag = $version_num;
|
---|
111 | $cvs_tag =~ s/\./\_/g;
|
---|
112 | $cvs_tag = "gsdl-" . $cvs_tag . "-distribution";
|
---|
113 | }
|
---|
114 |
|
---|
115 | &create_changelog() unless ($nochangelog || $useexistinglog);
|
---|
116 |
|
---|
117 | # Export gsdl to $tmpdir
|
---|
118 | print STDERR "\nexporting gsdl to $tmpdir\n\n";
|
---|
119 | chdir($tmpdir);
|
---|
120 | `cvs -d $cvsanon export -D "1 second ago" gsdl`;
|
---|
121 | # use something like the following if you want a previous version
|
---|
122 | #`cvs -d $cvsanon export -r gsdl-2_70-distribution-branch gsdl`;
|
---|
123 |
|
---|
124 | # Export gli to $tmpdir/gli
|
---|
125 | print STDERR "\nexporting gli to " . &util::filename_cat($tmpdir, "gsdl") . "\n\n";
|
---|
126 | chdir(&util::filename_cat($tmpdir, "gsdl"));
|
---|
127 | `cvs -d $cvsanon export -D "1 second ago" gli`;
|
---|
128 | # use something like the following if you want a previous version
|
---|
129 | #`cvs -d $cvsanon export -r gsdl-2_70-distribution-branch gli`;
|
---|
130 |
|
---|
131 | # Compile gli
|
---|
132 | &compile_gli();
|
---|
133 |
|
---|
134 | # Remove bits used by none of the distributions
|
---|
135 | &util::rm(&util::filename_cat($tmpdir, "gsdl", "packages", "cpan", "XML-Parser-2.27.tar.gz"));
|
---|
136 |
|
---|
137 | # copy ChangeLog into $tmpdir/gsdl
|
---|
138 | &util::cp(&util::filename_cat($ENV{'GSDLHOME'}, "ChangeLog"),
|
---|
139 | &util::filename_cat($tmpdir, "gsdl")) unless $nochangelog;
|
---|
140 |
|
---|
141 | # edit the VERSION and fnord.cpp files
|
---|
142 | &edit_files();
|
---|
143 |
|
---|
144 | &create_unix_distribution();
|
---|
145 | &create_source_distribution();
|
---|
146 | &create_cdrom_distribution();
|
---|
147 | }
|
---|
148 |
|
---|
149 |
|
---|
150 | sub compile_gli
|
---|
151 | {
|
---|
152 | print STDERR "\ncompiling gli...\n";
|
---|
153 | chdir(&util::filename_cat($tmpdir, "gsdl", "gli"));
|
---|
154 | `./makegli.sh`;
|
---|
155 |
|
---|
156 | # JAR up the gli, then delete the class files
|
---|
157 | print STDERR "jarring gli...\n";
|
---|
158 | `./makejar.sh`;
|
---|
159 | &util::rm_r(&util::filename_cat($tmpdir, "gsdl", "gli", "jar"));
|
---|
160 | &util::rm(&util::filename_cat($tmpdir, "gsdl", "gli", "metadata.zip"));
|
---|
161 | &util::rm_r(&util::filename_cat($tmpdir, "gsdl", "gli", "classes", "org"));
|
---|
162 |
|
---|
163 | # Move the GLIServer.jar file created by makejar.sh into bin/java
|
---|
164 | &util::mv(&util::filename_cat($tmpdir, "gsdl", "gli", "GLIServer.jar"),
|
---|
165 | &util::filename_cat($tmpdir, "gsdl", "bin", "java"));
|
---|
166 |
|
---|
167 | # Make the gli-client.zip file
|
---|
168 | chdir($tmpdir);
|
---|
169 |
|
---|
170 | # take a copy of GLI directory
|
---|
171 | &util::cp_r(&util::filename_cat($tmpdir, "gsdl", "gli"), $tmpdir);
|
---|
172 |
|
---|
173 | my $client_dirname = "gli-client-" . $version_num;
|
---|
174 | rename ("gli", $client_dirname);
|
---|
175 | chdir(&util::filename_cat($tmpdir, $client_dirname));
|
---|
176 |
|
---|
177 |
|
---|
178 | # delete unnecessary stuff
|
---|
179 | `rm -rf clean.* document.* gems.* gli*.sh gli*.bat make*.sh make*.bat lib src`;
|
---|
180 | # make sure permissions are ok
|
---|
181 | `chmod a+x client-gli.sh client-gli.bat`;
|
---|
182 | chdir($tmpdir);
|
---|
183 |
|
---|
184 | # zip up the client
|
---|
185 | &zip($client_dirname, $client_dirname, $tmpdir, 1);
|
---|
186 |
|
---|
187 | # Move the zip file to the destination directory
|
---|
188 |
|
---|
189 | &util::cp(&util::filename_cat($tmpdir, "$client_dirname.zip"), $output_dir);
|
---|
190 | &util::rm_r(&util::filename_cat($tmpdir, $client_dirname));
|
---|
191 | &util::rm(&util::filename_cat($tmpdir, "$client_dirname.zip"));
|
---|
192 |
|
---|
193 | }
|
---|
194 |
|
---|
195 | sub create_unix_distribution
|
---|
196 | {
|
---|
197 | print STDERR "Creating Unix distribution...\n";
|
---|
198 |
|
---|
199 | my $unix_dist_dir = &util::filename_cat($output_dir, "gsdl-" . $version_num . "-unix");
|
---|
200 | mkdir ($unix_dist_dir, 0777);
|
---|
201 |
|
---|
202 | # Web release has a slightly customised version of Install.sh
|
---|
203 | &util::cp(&util::filename_cat($tmpdir, "gsdl", "Install.sh"), $unix_dist_dir);
|
---|
204 | my $Install_sh_file = &util::filename_cat($unix_dist_dir, "Install.sh");
|
---|
205 | open (INSTALL_SH, $Install_sh_file) || die "Failed to open $Install_sh_file\n";
|
---|
206 | my $found = 0; my $line = ""; my $file = "";
|
---|
207 | while (defined ($line = <INSTALL_SH>)) {
|
---|
208 | if ($line =~ /^iscdrom=\"/) {
|
---|
209 | $line = "iscdrom=\"no\"\n";
|
---|
210 | $found = 1;
|
---|
211 | }
|
---|
212 | $file .= $line;
|
---|
213 | }
|
---|
214 | close INSTALL_SH;
|
---|
215 |
|
---|
216 | if ($found != 1) {
|
---|
217 | die "Error while editing $Install_sh_file\n";
|
---|
218 | }
|
---|
219 |
|
---|
220 | open (INSTALL_SH, ">$Install_sh_file") || die;
|
---|
221 | print INSTALL_SH $file;
|
---|
222 | close INSTALL_SH;
|
---|
223 | }
|
---|
224 |
|
---|
225 |
|
---|
226 | sub create_source_distribution
|
---|
227 | {
|
---|
228 | print STDERR "Creating Source distribution...\n";
|
---|
229 |
|
---|
230 | my $source_dist_dir = &util::filename_cat($output_dir, "gsdl-" . $version_num . "-src");
|
---|
231 | mkdir($source_dist_dir, 0777);
|
---|
232 |
|
---|
233 | my $gsdldir = &util::filename_cat ($source_dist_dir, "gsdl");
|
---|
234 |
|
---|
235 | # Copy the entire contents of the exported GSDL directory
|
---|
236 | my $tmpgsdldir = &util::filename_cat($tmpdir, "gsdl");
|
---|
237 | `cp -r $tmpgsdldir $source_dist_dir`;
|
---|
238 |
|
---|
239 | # We want the COPYING file in the source distribution too
|
---|
240 | &util::cp(&util::filename_cat($docs_dir, "COPYING"), $gsdldir);
|
---|
241 |
|
---|
242 | # We shouldn't distribute the GLI applet signed by us
|
---|
243 | if (-e &util::filename_cat($source_dist_dir, "gsdl", "bin", "java", "SignedGatherer.jar")) {
|
---|
244 | &util::rm(&util::filename_cat($source_dist_dir, "gsdl", "bin", "java", "SignedGatherer.jar"));
|
---|
245 | }
|
---|
246 |
|
---|
247 | # We don't want the compiled GLI classes in the source distribution (or the GS3 scripts)
|
---|
248 | &util::rm(&util::filename_cat($source_dist_dir, "gsdl", "gli", ".greenstonestore"));
|
---|
249 | &util::rm(&util::filename_cat($source_dist_dir, "gsdl", "gli", "GLI.jar"));
|
---|
250 | &util::rm(&util::filename_cat($source_dist_dir, "gsdl", "gli", "gli4gs3.bat"));
|
---|
251 | &util::rm(&util::filename_cat($source_dist_dir, "gsdl", "gli", "gli4gs3.sh"));
|
---|
252 |
|
---|
253 | }
|
---|
254 |
|
---|
255 |
|
---|
256 | sub create_cdrom_distribution
|
---|
257 | {
|
---|
258 | print STDERR "Creating CD-ROM distribution...\n";
|
---|
259 |
|
---|
260 | my $cdrom_dist_dir = &util::filename_cat ($output_dir, "gsdl-" . $version_num . "-cdrom");
|
---|
261 | mkdir ($cdrom_dist_dir, 0777);
|
---|
262 |
|
---|
263 | # docs directory
|
---|
264 | &install_docs ($cdrom_dist_dir, 0);
|
---|
265 |
|
---|
266 | # gsdl directory
|
---|
267 | &install_gsdl ($cdrom_dist_dir);
|
---|
268 |
|
---|
269 | # gli directory (in gsdl)
|
---|
270 | &install_gli($cdrom_dist_dir, "cdrom");
|
---|
271 |
|
---|
272 | # src directory
|
---|
273 | &install_src ($cdrom_dist_dir, "cdrom");
|
---|
274 |
|
---|
275 | # Windows directory
|
---|
276 | &install_windows_specific ($cdrom_dist_dir, 1);
|
---|
277 |
|
---|
278 | # Unix directory
|
---|
279 | &install_unix_specific ($cdrom_dist_dir);
|
---|
280 |
|
---|
281 | # for the cd-rom we want to include the unbuilt bits of the demo collection too
|
---|
282 | #my $demodir = &util::filename_cat($cdrom_dist_dir, "gsdl", "collect", "demo");
|
---|
283 | #my $tmpdemo = &util::filename_cat($tmpdir, "gsdl", "collect", "demo");
|
---|
284 | #die "oops, no demo dir\n" unless -d $demodir;
|
---|
285 | #&util::cp (&util::filename_cat ($tmpdemo, "demo.col"), $demodir);
|
---|
286 | #&util::cp_r (&util::filename_cat ($tmpdemo, "import"), $demodir);
|
---|
287 | #&util::cp_r (&util::filename_cat ($tmpdemo, "metadata"), $demodir);
|
---|
288 |
|
---|
289 | # collect directory, with documented example collections
|
---|
290 | my $cdrom_collect_dir = &util::filename_cat ($cdrom_dist_dir, "collect");
|
---|
291 | mkdir($cdrom_collect_dir, 0777);
|
---|
292 |
|
---|
293 | my $source_collect_dir = &util::filename_cat($for_distributions_dir, "collect");
|
---|
294 | my $target_collect_dir = &util::filename_cat($cdrom_dist_dir, "collect");
|
---|
295 |
|
---|
296 | &util::cp_r(&util::filename_cat($source_collect_dir, "MARC-e"), $target_collect_dir);
|
---|
297 | &util::cp_r(&util::filename_cat($source_collect_dir, "authen-e"), $target_collect_dir);
|
---|
298 | &util::cp_r(&util::filename_cat($source_collect_dir, "cltbib-e"), $target_collect_dir);
|
---|
299 | &util::cp_r(&util::filename_cat($source_collect_dir, "cltext-e"), $target_collect_dir);
|
---|
300 | &util::cp_r(&util::filename_cat($source_collect_dir, "dls-e"), $target_collect_dir);
|
---|
301 | &util::cp_r(&util::filename_cat($source_collect_dir, "garish"), $target_collect_dir);
|
---|
302 | &util::cp_r(&util::filename_cat($source_collect_dir, "gsarch-e"), $target_collect_dir);
|
---|
303 | &util::cp_r(&util::filename_cat($source_collect_dir, "image-e"), $target_collect_dir);
|
---|
304 | &util::cp_r(&util::filename_cat($source_collect_dir, "isis-e"), $target_collect_dir);
|
---|
305 | &util::cp_r(&util::filename_cat($source_collect_dir, "oai-e"), $target_collect_dir);
|
---|
306 | &util::cp_r(&util::filename_cat($source_collect_dir, "wrdpdf-e"), $target_collect_dir);
|
---|
307 | &util::cp_r(&util::filename_cat($source_collect_dir, "dspace-e"), $target_collect_dir);
|
---|
308 | &util::cp_r(&util::filename_cat($source_collect_dir, "style-e"), $target_collect_dir);
|
---|
309 | &util::cp_r(&util::filename_cat($source_collect_dir, "pagedimg-e"), $target_collect_dir);
|
---|
310 |
|
---|
311 | # Make sure the whole thing is user-writeable
|
---|
312 | `chmod -R u+rw $cdrom_dist_dir`;
|
---|
313 | }
|
---|
314 |
|
---|
315 |
|
---|
316 | # isweb is 1 if it's one of the web distributions (i.e. if we don't
|
---|
317 | # want to install the manuals) - this shouldn't be called at all for
|
---|
318 | # windows web installation as it doesn't use docs at all (not much
|
---|
319 | # point for self-extracting exe).
|
---|
320 | sub install_docs {
|
---|
321 | my ($install_dir, $isweb) = @_;
|
---|
322 |
|
---|
323 | # COPYING, README*.txt and Support.htm
|
---|
324 | &util::cp (&util::filename_cat($docs_dir, "COPYING"), $install_dir);
|
---|
325 | &util::cp (&util::filename_cat($docs_dir, "READMEen.txt"), $install_dir);
|
---|
326 | &util::cp (&util::filename_cat($docs_dir, "READMEes.txt"), $install_dir);
|
---|
327 | &util::cp (&util::filename_cat($docs_dir, "READMEfr.txt"), $install_dir);
|
---|
328 | &util::cp (&util::filename_cat($docs_dir, "READMEru.txt-cp1251"), $install_dir);
|
---|
329 | &util::cp (&util::filename_cat($docs_dir, "READMEru.txt-koi8-r"), $install_dir);
|
---|
330 | &util::cp (&util::filename_cat($docs_dir, "Support.htm"), $install_dir);
|
---|
331 |
|
---|
332 | &force_windows_line_endings(&util::filename_cat($install_dir, "COPYING"));
|
---|
333 | &force_windows_line_endings(&util::filename_cat($install_dir, "READMEen.txt"));
|
---|
334 | &force_windows_line_endings(&util::filename_cat($install_dir, "READMEes.txt"));
|
---|
335 | &force_windows_line_endings(&util::filename_cat($install_dir, "READMEfr.txt"));
|
---|
336 |
|
---|
337 | # The web distributions don't have any of the manuals
|
---|
338 | return if ($isweb);
|
---|
339 |
|
---|
340 | # docs directory, but not any of the Word files or Latex files
|
---|
341 | &util::cp_r (&util::filename_cat($docs_dir, "docs"), $install_dir);
|
---|
342 | my $en_docs = &util::filename_cat ($install_dir, "docs", "english", "*.doc");
|
---|
343 | `rm $en_docs`;
|
---|
344 | my $es_docs = &util::filename_cat ($install_dir, "docs", "spanish", "*.doc");
|
---|
345 | `rm $es_docs`;
|
---|
346 | my $ru_docs = &util::filename_cat ($install_dir, "docs", "russian", "*.doc");
|
---|
347 | `rm $ru_docs`;
|
---|
348 | my $fr_latex = &util::filename_cat ($install_dir, "docs", "french", "latex");
|
---|
349 | `rm -r $fr_latex`;
|
---|
350 | }
|
---|
351 |
|
---|
352 |
|
---|
353 | sub install_gsdl {
|
---|
354 | my ($install_dir) = @_;
|
---|
355 |
|
---|
356 | my $gsdldir = &util::filename_cat ($install_dir, "gsdl");
|
---|
357 | mkdir ($gsdldir, 0777);
|
---|
358 |
|
---|
359 | my $gsdlbindir = &util::filename_cat ($gsdldir, "bin");
|
---|
360 | mkdir ($gsdlbindir, 0777);
|
---|
361 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "bin", "script"), $gsdlbindir);
|
---|
362 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "bin", "java"), $gsdlbindir);
|
---|
363 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "cgi-bin"), $gsdldir);
|
---|
364 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "collect"), $gsdldir);
|
---|
365 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "etc"), $gsdldir);
|
---|
366 |
|
---|
367 | #Get the modified main.cfg file with only core language interfaces enabled
|
---|
368 | if ($unesco) {
|
---|
369 | &util::cp(&util::filename_cat($for_distributions_dir, "etc", "main.cfg"), &util::filename_cat($gsdldir, "etc"));
|
---|
370 | }
|
---|
371 | # Make sure everything in bin/script is executable
|
---|
372 | my $bin_script_dir = &util::filename_cat($gsdldir, "bin", "script");
|
---|
373 | `chmod a+x $bin_script_dir/*`;
|
---|
374 |
|
---|
375 | # Make sure cgi scripts are executable
|
---|
376 | my $gliserver_script = &util::filename_cat($gsdldir, "cgi-bin", "gliserver.pl");
|
---|
377 | `chmod a+x $gliserver_script`;
|
---|
378 | # should we be doing these ones - usability feedback scripts ??
|
---|
379 | #my $perl_script = &util::filename_cat($gsdldir, "cgi-bin", "perl.cgi");
|
---|
380 | #`chmod a+x $perl_script`;
|
---|
381 | #my $readresults_script = &util::filename_cat($gsdldir, "cgi-bin", "readresults.cgi");
|
---|
382 | #`chmod a+x $readresults_script`;
|
---|
383 | #my $trackreport_script = &util::filename_cat($gsdldir, "cgi-bin", "trackreport.cgi");
|
---|
384 | #`chmod a+x $trackreport_script`;
|
---|
385 |
|
---|
386 | &force_windows_line_endings(&util::filename_cat($gsdldir, "cgi-bin", "gsdlsite.cfg"));
|
---|
387 | &force_windows_line_endings(&util::filename_cat($gsdldir, "etc", "main.cfg"));
|
---|
388 | &force_windows_line_endings(&util::filename_cat($gsdldir, "etc", "oai.cfg"));
|
---|
389 |
|
---|
390 | # Make sure certain files in the etc directory are writeable by everyone
|
---|
391 | my $error_txt_file = &util::filename_cat($gsdldir, "etc", "error.txt");
|
---|
392 | `chmod a+w $error_txt_file`;
|
---|
393 | my $history_db_file = &util::filename_cat($gsdldir, "etc", "history.db");
|
---|
394 | `chmod a+w $history_db_file`;
|
---|
395 | my $key_db_file = &util::filename_cat($gsdldir, "etc", "key.db");
|
---|
396 | `chmod a+w $key_db_file`;
|
---|
397 | my $main_cfg_file = &util::filename_cat($gsdldir, "etc", "main.cfg");
|
---|
398 | `chmod a+w $main_cfg_file`;
|
---|
399 | my $usage_txt_file = &util::filename_cat($gsdldir, "etc", "usage.txt");
|
---|
400 | `chmod a+w $usage_txt_file`;
|
---|
401 | my $users_db_file = &util::filename_cat($gsdldir, "etc", "users.db");
|
---|
402 | `chmod a+rw $users_db_file`; # Readable too
|
---|
403 |
|
---|
404 | # We shouldn't distribute the GLI applet signed by us
|
---|
405 | if (-e &util::filename_cat($gsdlbindir, "java", "SignedGatherer.jar")) {
|
---|
406 | &util::rm(&util::filename_cat($gsdlbindir, "java", "SignedGatherer.jar"));
|
---|
407 | }
|
---|
408 |
|
---|
409 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "images"), $gsdldir);
|
---|
410 | &util::cp_r(&util::filename_cat ($tmpdir, "gsdl", "macros"), $gsdldir);
|
---|
411 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "mappings"), $gsdldir);
|
---|
412 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "perllib"), $gsdldir);
|
---|
413 |
|
---|
414 | # Rename perllib/strings.properties to perllib/strings_en.properties
|
---|
415 | my $stringsrbfile = &util::filename_cat ($gsdldir, "perllib", "strings.properties");
|
---|
416 | &util::cp ($stringsrbfile, &util::filename_cat ($gsdldir, "perllib", "strings_en.properties"));
|
---|
417 | &util::rm ($stringsrbfile);
|
---|
418 | `touch $stringsrbfile`;
|
---|
419 |
|
---|
420 | # Untar Ping.tgz and XML-Parser.tar.gz
|
---|
421 | my $wd = cwd;
|
---|
422 | chdir (&util::filename_cat($gsdldir, "perllib", "cpan"));
|
---|
423 | `tar xvzf Ping.tgz`;
|
---|
424 | unlink ("Ping.tgz");
|
---|
425 | &util::cp(&util::filename_cat($for_distributions_dir, "perllib", "cpan", "XML-Parser.tar.gz"),
|
---|
426 | &util::filename_cat($gsdldir, "perllib", "cpan"));
|
---|
427 | `tar xvzf XML-Parser.tar.gz`;
|
---|
428 | unlink ("XML-Parser.tar.gz");
|
---|
429 | chdir ($wd);
|
---|
430 |
|
---|
431 | # make sure that modelcol collection contains all the right
|
---|
432 | # empty directories
|
---|
433 | my $modelindex = &util::filename_cat ($gsdldir, "collect", "modelcol", "index");
|
---|
434 | &util::mk_all_dir ($modelindex) unless -d $modelindex;
|
---|
435 | my $modelbuilding = &util::filename_cat ($gsdldir, "collect", "modelcol", "building");
|
---|
436 | &util::mk_all_dir ($modelbuilding) unless -d $modelbuilding;
|
---|
437 | my $modelarchives = &util::filename_cat ($gsdldir, "collect", "modelcol", "archives");
|
---|
438 | &util::mk_all_dir ($modelarchives) unless -d $modelarchives;
|
---|
439 | my $modelimport = &util::filename_cat ($gsdldir, "collect", "modelcol", "import");
|
---|
440 | &util::mk_all_dir ($modelimport) unless -d $modelimport;
|
---|
441 | my $modelperllib = &util::filename_cat ($gsdldir, "collect", "modelcol", "perllib");
|
---|
442 | &util::mk_all_dir ($modelperllib) unless -d $modelperllib;
|
---|
443 | my $modelimages = &util::filename_cat ($gsdldir, "collect", "modelcol", "images");
|
---|
444 | &util::mk_all_dir ($modelimages) unless -d $modelimages;
|
---|
445 |
|
---|
446 | # demo collection needs to be pre-built
|
---|
447 | my $collectdir = &util::filename_cat ($gsdldir, "collect");
|
---|
448 | &util::rm_r (&util::filename_cat($collectdir, "demo"));
|
---|
449 | if (!&get_built_collection ("demo", $collectdir)) {
|
---|
450 | die "Couldn't get built version of demo collection\n";
|
---|
451 | }
|
---|
452 | #******
|
---|
453 | if ($unesco) {
|
---|
454 | # Get modified version of demo collect.cfg file with only core language strings
|
---|
455 | &util::cp(&util::filename_cat($for_distributions_dir, "collect", "demo", "etc", "collect.cfg"),
|
---|
456 | &util::filename_cat($collectdir, "demo", "etc"));
|
---|
457 | }
|
---|
458 | }
|
---|
459 |
|
---|
460 |
|
---|
461 | sub install_gli
|
---|
462 | {
|
---|
463 | my ($install_dir, $type) = @_;
|
---|
464 |
|
---|
465 | # Copy the Greenstone Librarian Interface
|
---|
466 | my $source_dir = &util::filename_cat($tmpdir, "gsdl", "gli");
|
---|
467 | my $target_dir = &util::filename_cat($install_dir, "gsdl");
|
---|
468 | &util::cp_r($source_dir, $target_dir);
|
---|
469 |
|
---|
470 | my $gli_dir = &util::filename_cat($target_dir, "gli");
|
---|
471 | &force_windows_line_endings(&util::filename_cat($gli_dir, "READMEen.txt"));
|
---|
472 | &force_windows_line_endings(&util::filename_cat($gli_dir, "READMEes.txt"));
|
---|
473 | &force_windows_line_endings(&util::filename_cat($gli_dir, "READMEfr.txt"));
|
---|
474 |
|
---|
475 | # Make Unix scripts executable
|
---|
476 | `chmod a+x $gli_dir/*.sh`;
|
---|
477 |
|
---|
478 | # Copy dictionary.properties to dictionary_en.properties to prevent problems with non-English machines
|
---|
479 | &util::cp(&util::filename_cat($gli_dir, "classes", "dictionary.properties"),
|
---|
480 | &util::filename_cat($gli_dir, "classes", "dictionary_en.properties"));
|
---|
481 |
|
---|
482 | if ($unesco) {
|
---|
483 | # Copy the customised languages.xml file with only core languages enabled
|
---|
484 | &util::cp(&util::filename_cat($for_distributions_dir, "gli", "classes", "xml", "languages.xml"),
|
---|
485 | &util::filename_cat($gli_dir, "classes", "xml"));
|
---|
486 | }
|
---|
487 | # Remove unwanted stuff - all distributions
|
---|
488 | &util::rm(&util::filename_cat($gli_dir, ".greenstonestore"));
|
---|
489 |
|
---|
490 | # Don't need Greenstone 3 scripts
|
---|
491 | &util::rm(&util::filename_cat($gli_dir, "gli4gs3.bat"));
|
---|
492 | &util::rm(&util::filename_cat($gli_dir, "gli4gs3.sh"));
|
---|
493 |
|
---|
494 | # Remove unwanted stuff - Unix distributions
|
---|
495 | if ($type eq "unix") {
|
---|
496 | # Don't need Windows scripts
|
---|
497 | &util::rm(&util::filename_cat($gli_dir, "clean.bat"));
|
---|
498 | &util::rm(&util::filename_cat($gli_dir, "document.bat"));
|
---|
499 | &util::rm(&util::filename_cat($gli_dir, "gems.bat"));
|
---|
500 | &util::rm(&util::filename_cat($gli_dir, "gli.bat"));
|
---|
501 | &util::rm(&util::filename_cat($gli_dir, "makegli.bat"));
|
---|
502 |
|
---|
503 | # Don't need Windows utilities
|
---|
504 | &util::rm_r(&util::filename_cat($gli_dir, "winutil"));
|
---|
505 |
|
---|
506 | # Don't need Windows README file
|
---|
507 | &util::rm(&util::filename_cat($gli_dir, "READMEru.txt-cp1251"));
|
---|
508 |
|
---|
509 | # Rename Unix README file
|
---|
510 | &util::cp(&util::filename_cat($gli_dir, "READMEru.txt-koi8-r"),
|
---|
511 | &util::filename_cat($gli_dir, "READMEru.txt"));
|
---|
512 | &util::rm(&util::filename_cat($gli_dir, "READMEru.txt-koi8-r"));
|
---|
513 | }
|
---|
514 |
|
---|
515 | # Remove unwanted stuff - Windows distributions
|
---|
516 | if ($type eq "windows") {
|
---|
517 | # Don't need Unix scripts
|
---|
518 | &util::rm(&util::filename_cat($gli_dir, "clean.sh"));
|
---|
519 | &util::rm(&util::filename_cat($gli_dir, "document.sh"));
|
---|
520 | &util::rm(&util::filename_cat($gli_dir, "gems.sh"));
|
---|
521 | &util::rm(&util::filename_cat($gli_dir, "gli.sh"));
|
---|
522 | &util::rm(&util::filename_cat($gli_dir, "makegli.sh"));
|
---|
523 | &util::rm(&util::filename_cat($gli_dir, "makejar.sh"));
|
---|
524 | }
|
---|
525 | }
|
---|
526 |
|
---|
527 |
|
---|
528 | sub install_src {
|
---|
529 | my ($install_dir, $type) = @_;
|
---|
530 |
|
---|
531 | my $srcdir = &util::filename_cat ($install_dir, "src");
|
---|
532 | my $srcwindir = &util::filename_cat ($srcdir, "Windows");
|
---|
533 | my $srcunixdir = &util::filename_cat ($srcdir, "Unix");
|
---|
534 | mkdir ($srcdir, 0777);
|
---|
535 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "lib"), $srcdir);
|
---|
536 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "packages"), $srcdir);
|
---|
537 | &util::cp_r (&util::filename_cat ($tmpdir, "gsdl", "src"), $srcdir);
|
---|
538 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "Install.txt"), $srcdir);
|
---|
539 | &force_windows_line_endings(&util::filename_cat($srcdir, "Install.txt"));
|
---|
540 |
|
---|
541 | if ($type ne "unix") {
|
---|
542 | mkdir ($srcwindir, 0777);
|
---|
543 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "setup.bat"), $srcwindir);
|
---|
544 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "win32.mak"), $srcwindir);
|
---|
545 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "WIN32cfg.h"), $srcwindir);
|
---|
546 | }
|
---|
547 |
|
---|
548 | if ($type ne "windows") {
|
---|
549 | mkdir ($srcunixdir, 0777);
|
---|
550 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "Makefile.in"), $srcunixdir);
|
---|
551 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "acconfig.h"), $srcunixdir);
|
---|
552 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "aclocal.m4"), $srcunixdir);
|
---|
553 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "config.h.in"), $srcunixdir);
|
---|
554 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "configtest.pl"), $srcunixdir);
|
---|
555 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "configure"), $srcunixdir);
|
---|
556 | # make sure configure and setup scripts are executable
|
---|
557 | my $configure_script = &util::filename_cat ($srcunixdir , "configure");
|
---|
558 | `chmod a+x $configure_script`;
|
---|
559 |
|
---|
560 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "configure.in"), $srcunixdir);
|
---|
561 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "config.sub"), $srcunixdir);
|
---|
562 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "config.guess"), $srcunixdir);
|
---|
563 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "install-sh"), $srcunixdir);
|
---|
564 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "setup.bash"), $srcunixdir);
|
---|
565 | &util::cp (&util::filename_cat ($tmpdir, "gsdl", "setup.csh"), $srcunixdir);
|
---|
566 | `chmod a+x $srcunixdir/setup.*`;
|
---|
567 |
|
---|
568 | # get all the configure scripts
|
---|
569 | `cd $srcdir; find -name "configure" -exec chmod a+x {} \\; ; cd -`
|
---|
570 |
|
---|
571 | }
|
---|
572 | }
|
---|
573 |
|
---|
574 | sub install_windows_specific {
|
---|
575 | my ($install_dir, $cd_rom) = @_;
|
---|
576 |
|
---|
577 | my $windir = &util::filename_cat ($install_dir, "Windows");
|
---|
578 | my $winbindir = &util::filename_cat ($windir, "bin");
|
---|
579 | mkdir ($windir, 0777);
|
---|
580 | mkdir ($winbindir, 0777);
|
---|
581 | &util::cp_r ($winbin, $winbindir);
|
---|
582 |
|
---|
583 | # make sure there aren't any CVS directories laying around
|
---|
584 | &remove_cvs_dirs ($windir);
|
---|
585 | }
|
---|
586 |
|
---|
587 | sub install_unix_specific {
|
---|
588 | my ($install_dir) = @_;
|
---|
589 |
|
---|
590 | my $unixdir = &util::filename_cat ($install_dir, "Unix");
|
---|
591 | my $unixbindir = &util::filename_cat ($unixdir, "bin");
|
---|
592 | mkdir ($unixdir, 0777);
|
---|
593 | mkdir ($unixbindir, 0777);
|
---|
594 | &util::cp (&util::filename_cat($tmpdir, "gsdl", "Install.sh"), $unixdir);
|
---|
595 |
|
---|
596 | # make sure Install.sh is executable
|
---|
597 | my $install_sh = &util::filename_cat($unixdir, "Install.sh");
|
---|
598 | `chmod a+x $install_sh`;
|
---|
599 |
|
---|
600 | # Get Linux binaries, and make sure they're all executable
|
---|
601 | &util::cp_r ($linuxbin, $unixbindir);
|
---|
602 | my $linuxbindir = &util::filename_cat($unixbindir, 'linux');
|
---|
603 | `chmod -R a+x $linuxbindir`;
|
---|
604 |
|
---|
605 | # remove the non-static mgquery_old program from distributions
|
---|
606 | &util::rm(&util::filename_cat($linuxbindir, "mgquery_old"));
|
---|
607 |
|
---|
608 | # Get Mac OS/X binaries, and make sure they're all executable
|
---|
609 | &util::cp_r ($macosxbin, $unixbindir);
|
---|
610 | my $macosxbindir = &util::filename_cat($unixbindir, 'darwin');
|
---|
611 | `chmod -R a+x $macosxbindir`;
|
---|
612 |
|
---|
613 | # make sure there aren't any CVS directories laying around
|
---|
614 | &remove_cvs_dirs ($unixdir);
|
---|
615 | }
|
---|
616 |
|
---|
617 |
|
---|
618 | # gets all the right bits of a built collection from
|
---|
619 | # $GSDLHOME/collect and copies them to $collect_dir
|
---|
620 | # returns 1 if successful, 0 if not
|
---|
621 | sub get_built_collection {
|
---|
622 | my ($colname, $collect_dir) = @_;
|
---|
623 |
|
---|
624 | my $from_dir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $colname);
|
---|
625 | if (!-d $from_dir) {
|
---|
626 | print STDERR "\nERROR: No collection at $from_dir\n";
|
---|
627 | return 0;
|
---|
628 | }
|
---|
629 |
|
---|
630 | my $to_dir = &util::filename_cat ($collect_dir, $colname);
|
---|
631 | mkdir ($to_dir, 0777) unless -d $to_dir;
|
---|
632 |
|
---|
633 | # get the built indexes
|
---|
634 | my $index_dir = &util::filename_cat ($from_dir, "index");
|
---|
635 | if (-d $index_dir) {
|
---|
636 | # if build.cfg exists we'll assume collection is built ok
|
---|
637 | if (-e &util::filename_cat ($index_dir, "build.cfg")) {
|
---|
638 | &util::cp_r ($index_dir, $to_dir);
|
---|
639 | } else {
|
---|
640 | print STDERR "\nERROR: no build.cfg at $index_dir (collection not built?)\n";
|
---|
641 | rmdir ($to_dir);
|
---|
642 | return 0;
|
---|
643 | }
|
---|
644 | } else {
|
---|
645 | print STDERR "\nERROR: collection at $from_dir appears unbuilt (no index directory)\n";
|
---|
646 | return 0;
|
---|
647 | }
|
---|
648 | &util::cp_r ($index_dir, $to_dir);
|
---|
649 |
|
---|
650 | # get the collect.cfg file
|
---|
651 | mkdir (&util::filename_cat($to_dir, "etc"), 0777);
|
---|
652 | &util::cp (&util::filename_cat($from_dir, "etc", "collect.cfg"),
|
---|
653 | &util::filename_cat($to_dir, "etc"));
|
---|
654 |
|
---|
655 | # get the .col file
|
---|
656 | &util::cp (&util::filename_cat($from_dir, "$colname.col"),
|
---|
657 | $to_dir);
|
---|
658 | # get any other directories - import, metadata, images, macros, perllib
|
---|
659 | my $from_import = &util::filename_cat ($from_dir, "import");
|
---|
660 | &util::cp_r ($from_import, $to_dir) if -d $from_import;
|
---|
661 | my $from_metadata = &util::filename_cat ($from_dir, "metadata");
|
---|
662 | &util::cp_r ($from_metadata, $to_dir) if -d $from_metadata;
|
---|
663 | my $from_images = &util::filename_cat ($from_dir, "images");
|
---|
664 | &util::cp_r ($from_images, $to_dir) if -d $from_images;
|
---|
665 | my $from_macros = &util::filename_cat ($from_dir, "macros");
|
---|
666 | &util::cp_r ($from_macros, $to_dir) if -d $from_macros;
|
---|
667 | my $from_perllib = &util::filename_cat ($from_dir, "perllib");
|
---|
668 | &util::cp_r ($from_perllib, $to_dir) if -d $from_perllib;
|
---|
669 |
|
---|
670 | # make sure there aren't any CVS directories laying around
|
---|
671 | &remove_cvs_dirs ($to_dir);
|
---|
672 |
|
---|
673 | return 1;
|
---|
674 | }
|
---|
675 |
|
---|
676 | sub force_windows_line_endings
|
---|
677 | {
|
---|
678 | my ($filepath) = @_;
|
---|
679 |
|
---|
680 | open(IN, "<$filepath");
|
---|
681 | my $text = join('', <IN>);
|
---|
682 | close(IN);
|
---|
683 |
|
---|
684 | $text =~ s/\n\x0A/\n\x0D\x0A/g;
|
---|
685 | $text =~ s/([^\x0D])\x0A/$1\x0D\x0A/g;
|
---|
686 |
|
---|
687 | open(OUT, ">$filepath");
|
---|
688 | print OUT "$text";
|
---|
689 | close(OUT);
|
---|
690 | }
|
---|
691 |
|
---|
692 |
|
---|
693 | sub create_changelog {
|
---|
694 |
|
---|
695 | my ($tag, $date, $file);
|
---|
696 |
|
---|
697 | my $datefile = &util::filename_cat ($for_distributions_dir, "DistDates");
|
---|
698 | if ($changelogdate !~ /\w/) {
|
---|
699 | # get date from for-distributions/DistDates (and update DistDates)
|
---|
700 | open (DATES, $datefile) || die "can't open $datefile\n";
|
---|
701 | my $line = "";
|
---|
702 | while (defined ($line = <DATES>)) {
|
---|
703 | if ($line =~ /\w/) {
|
---|
704 | ($tag, $date) = $line =~ /^(\S+)\t(.*)$/;
|
---|
705 | $changelogdate = $date unless ($tag eq $cvs_tag);
|
---|
706 | }
|
---|
707 | $file .= $line;
|
---|
708 | }
|
---|
709 | close DATES;
|
---|
710 | }
|
---|
711 |
|
---|
712 | if ((!defined $tag) || ($tag ne $cvs_tag)) {
|
---|
713 | open (DATES, ">$datefile") || die;
|
---|
714 | print DATES $file if defined $file;
|
---|
715 | print DATES "$cvs_tag\t" . `date`;
|
---|
716 | close DATES;
|
---|
717 | }
|
---|
718 |
|
---|
719 | print STDERR "Creating ChangeLog from $changelogdate to most recent\n";
|
---|
720 |
|
---|
721 | chdir($ENV{'GSDLHOME'});
|
---|
722 | my $cmd = "$for_distributions_dir/bin/script/cvs2cl.pl -P -F trunk -r -S -l \"-d'$changelogdate<tomorrow'\"";
|
---|
723 | system ($cmd);
|
---|
724 | }
|
---|
725 |
|
---|
726 | # simply recurses directory structure beginning at $dir
|
---|
727 | # and deletes any CVS administrative directories it comes
|
---|
728 | # across
|
---|
729 | sub remove_cvs_dirs {
|
---|
730 | my ($dir) = @_;
|
---|
731 |
|
---|
732 | if (!-d $dir) {return;}
|
---|
733 |
|
---|
734 | opendir (DIR, $dir) || die;
|
---|
735 | my @files = readdir DIR;
|
---|
736 | closedir DIR;
|
---|
737 |
|
---|
738 | foreach my $file (@files) {
|
---|
739 | next if $file =~ /^\.\.?$/;
|
---|
740 | my $fullpath = &util::filename_cat ($dir, $file);
|
---|
741 | if (-d $fullpath) {
|
---|
742 | if ($file eq "CVS") {
|
---|
743 | &util::rm_r ($fullpath);
|
---|
744 | } else {
|
---|
745 | &remove_cvs_dirs ($fullpath);
|
---|
746 | }
|
---|
747 | }
|
---|
748 | }
|
---|
749 | }
|
---|
750 |
|
---|
751 | # mode is 0 to create .zip and .tgz, 1 to create .zip only, and 2 to create
|
---|
752 | # .tgz only
|
---|
753 | sub zip {
|
---|
754 | my ($zip_to, $zip_from, $dir, $mode) = @_;
|
---|
755 |
|
---|
756 | chdir ($dir);
|
---|
757 |
|
---|
758 | if ($mode != 2) {
|
---|
759 | my $to = $zip_to . ".zip";
|
---|
760 | unlink ($to) if -e $to;
|
---|
761 | print STDERR "zipping up $to\n";
|
---|
762 | `zip -r $to $zip_from`;
|
---|
763 | }
|
---|
764 | if ($mode != 1) {
|
---|
765 | my $to = $zip_to . ".tgz";
|
---|
766 | unlink ($to) if -e $to;
|
---|
767 | print STDERR "tarring and gzipping $to\n";
|
---|
768 | print STDERR "tar cvzf $to $zip_from\n";
|
---|
769 | system ("tar cvzf $to $zip_from");
|
---|
770 | }
|
---|
771 | }
|
---|
772 |
|
---|
773 | sub edit_files {
|
---|
774 | # edit VERSION file
|
---|
775 | my $version_file = &util::filename_cat ($tmpdir, "gsdl", "etc" , "VERSION");
|
---|
776 | open (VERSION, $version_file) || die "failed to open $version_file\n";
|
---|
777 | my $found = 0; my $line = ""; my $file = "";
|
---|
778 | while (defined ($line = <VERSION>)) {
|
---|
779 | if ($line =~ s/(gsdl version: )x\.xx/$1$version_num/) {
|
---|
780 | $found ++;
|
---|
781 | } elsif ($line =~ s/(cvs tag: )gsdl-x_xx-distribution/$1$cvs_tag/) {
|
---|
782 | $found ++;
|
---|
783 | }
|
---|
784 | $file .= $line;
|
---|
785 | }
|
---|
786 | close VERSION;
|
---|
787 | if ($found != 2) {
|
---|
788 | die "error while editing $version_file\n";
|
---|
789 | }
|
---|
790 |
|
---|
791 | open (VERSION, ">$version_file") || die;
|
---|
792 | print VERSION $file;
|
---|
793 | close VERSION;
|
---|
794 |
|
---|
795 | # edit gsdlconf.h
|
---|
796 | my $gsdlconf_file = &util::filename_cat ($tmpdir, "gsdl", "lib", "gsdlconf.h");
|
---|
797 | open (GSDLCONF, $gsdlconf_file) || die;
|
---|
798 | $found = 0; $line = ""; $file = "";
|
---|
799 | while (defined ($line = <GSDLCONF>)) {
|
---|
800 | if ($line =~ s/(\#define GSDL_VERSION \")x\.xx(\")/$1$version_num$2/) {
|
---|
801 | $found ++;
|
---|
802 | }
|
---|
803 | $file .= $line;
|
---|
804 | }
|
---|
805 | close GSDLCONF;
|
---|
806 | if (!$found) {
|
---|
807 | die "error while editing $gsdlconf_file\n";
|
---|
808 | }
|
---|
809 |
|
---|
810 | open (GSDLCONF, ">$gsdlconf_file") || die;
|
---|
811 | print GSDLCONF $file;
|
---|
812 | close GSDLCONF;
|
---|
813 | }
|
---|
814 |
|
---|
815 | END {
|
---|
816 | # remove any temporary files we created
|
---|
817 | print STDERR "\ndeleting temporary files\n";
|
---|
818 | my $tmp_gsdlsite_file = &util::filename_cat ($tmpdir, "gsdlsite.cfg");
|
---|
819 | if (-e $tmp_gsdlsite_file) {
|
---|
820 | print STDERR "$tmp_gsdlsite_file\n";
|
---|
821 | unlink($tmp_gsdlsite_file);
|
---|
822 | }
|
---|
823 | my $tmp_gsdlhome = &util::filename_cat ($tmpdir, "gsdl");
|
---|
824 | if (-d $tmp_gsdlhome) {
|
---|
825 | print STDERR "$tmp_gsdlhome\n";
|
---|
826 | &util::rm_r ($tmp_gsdlhome);
|
---|
827 | }
|
---|
828 | }
|
---|