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