[LON-CAPA-cvs] cvs: modules /matthew/systemperl prepare_systemperl.pl
matthew
lon-capa-cvs@mail.lon-capa.org
Mon, 19 Jul 2004 18:12:07 -0000
This is a MIME encoded message
--matthew1090260727
Content-Type: text/plain
matthew Mon Jul 19 14:12:07 2004 EDT
Modified files:
/modules/matthew/systemperl prepare_systemperl.pl
Log:
Added command line options, new modules for 3.11, new functionality, less
obnoxiousness in general.
--matthew1090260727
Content-Type: text/plain
Content-Disposition: attachment; filename="matthew-20040719141207.txt"
Index: modules/matthew/systemperl/prepare_systemperl.pl
diff -u modules/matthew/systemperl/prepare_systemperl.pl:1.7 modules/matthew/systemperl/prepare_systemperl.pl:1.8
--- modules/matthew/systemperl/prepare_systemperl.pl:1.7 Wed Jun 30 11:31:42 2004
+++ modules/matthew/systemperl/prepare_systemperl.pl Mon Jul 19 14:12:07 2004
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
#
-# $Id: prepare_systemperl.pl,v 1.7 2004/06/30 15:31:42 matthew Exp $
+# $Id: prepare_systemperl.pl,v 1.8 2004/07/19 18:12:07 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -24,12 +24,64 @@
#
use strict;
use CPAN;
+use Getopt::Long;
-my $basedir = "/root/systemperl/systemperl-3.10-rh7";
+#
+# Options
+my ($clean,$nodownload,$no_libs,$no_modules,$printcmds,$help)=
+ (0,0,0,0,undef,0);
+my $option_results = GetOptions("clean" => \$clean,
+ "nodownload" => \$nodownload,
+ "nolibs" => \$no_libs,
+ "nomodules" => \$no_modules,
+ "printcmds=s" => \$printcmds,
+ "help" => \$help);
+
+if (! $option_results) {
+ $help = 1;
+}
+
+if ($help) {
+ print <<"ENDHELP";
+$0
+Prepare perl modules for LON-CAPA systemperl.
+ -clean Clean build target and module directories
+ -nodownload Do not download and extract the modules
+ -nolibs Do not install the libraries needed for building the modules
+ -nomodules Do not build & install the modules in the target directory
+ -printcmds arg Print out the commands to build all packages matching 'arg'
+ENDHELP
+
+ exit;
+}
+
+my $download = ! $nodownload;
+my $install_libs = ! $no_libs;
+my $install_modules = ! $no_modules;
+if (defined($printcmds)) {
+ $clean = 0;
+ $download = 0;
+ $install_libs = 0;
+ $install_modules = 0;
+}
+
+
+my $basedir = "/root/systemperl/systemperl-3.11-rh7";
my $builddir = $basedir."/modules";
-system("mkdir -p $builddir") if (! -e $builddir);
my $targetdir = $basedir."/root/usr";
+
+if ($clean) {
+ if (-e $targetdir) {
+ print "Removing ".$targetdir.$/;
+ system('rm -rf '.$targetdir);
+ }
+ if (-e $builddir) {
+ print "Removing ".$builddir.$/;
+ system('rm -rf '.$builddir);
+ }
+}
system("mkdir -p $targetdir") if (! -e $targetdir);
+system("mkdir -p $builddir") if (! -e $builddir);
my %CPAN_config = (
build_cache => 1000,
@@ -46,7 +98,8 @@
my $default_sysperl_install =
"perl ./Makefile.PL PREFIX=$targetdir < /dev/null; make; make install;";
# No comment ...
-my $NetSSLeay_install = "perl ./Makefile.PL -- PREFIX=$targetdir; make; make install;";
+my $NetSSLeay_install = "perl ./Makefile.PL -- PREFIX=$targetdir; make; make ins
+tall;";
my @Modules = ({ src => "Algorithm::Diff",
dirname=> "Algorithm-Diff-*",
@@ -81,6 +134,7 @@
{ src=>"GD::Graph3d",
dirname => "GD-Graph3d-*",
compile => $sysperl_install },
+ # Last time I did this I had to do the patching by hand.
{ src=>"HTML::Parser",
dirname => "HTML-Parser-*",
compile => 'patch < ../../hparser_patch;'.$sysperl_install },
@@ -104,7 +158,7 @@
{ src=>"Authen::Krb5",
dirname=>"Krb5-*",
compile => 'patch < ../../Krb5_patch;'.$sysperl_install },
- { src=>"SBURKE/Locale-Maketext-1.05.tar.gz", #Locale::Maketext
+ { src=>"Locale::Maketext",
dirname => "Locale-Maketext-*",
compile => $sysperl_install },
{ src=>"LWP",
@@ -139,9 +193,10 @@
compile=>$sysperl_install },
# String::Similarity 1.0 does not work w/ perl 5.6
#
- { src=>"String::Similarity",
- dirname=>"String-Similarity-*",
- compile=>$sysperl_install },
+ { extract => 'String-Similarity-0.02.tar'
+ src=>"String::Similarity",
+ dirname=>"String-Similarity-*",
+ compile=>$sysperl_install },
{ src=>"Text::Query",
dirname=>"Text-Query-*",
compile=>$sysperl_install },
@@ -157,9 +212,16 @@
{ src=>"Net::SSLeay",
dirname=>"Net_SSLeay*",
compile=>$NetSSLeay_install },
- { src=>"IO::Socket::SSL",
- dirname=>"IO-Socket-SSL-*",
+ { src=>"IO::Socket::SSL",
+ dirname=>"IO-Socket-SSL-*",
+ compile=>$sysperl_install },
+ { src=>"MIME::Lite",
+ dirname=>"MIME-Lite-*",
+ compile=>$sysperl_install },
+ { src=>"MIME::Types",
+ dirname=>"MIME-Types-*",
compile=>$sysperl_install },
+
);
my @Libraries = (
@@ -173,57 +235,64 @@
'make;'.
'make install;'}
);
-print <<"END";
-##
-## This script performs ABSOLUTELY NO ERROR CHECKING OR TESTS!
-## If I were you, I'd pay attention to the stream of text that it produces.
-## If you don't like this message, feel free to add some error checks.
-##
-## You need to have configured CPAN before running this script. Run
-##
-## perl -MCPAN -e shell
-##
-## to configure it.
-##
-## Hit enter to begin the process by retrieving the CPAN modules
-##
-END
-while (! <>) {};
-
-foreach my $modinfo (@Modules) {
- my $Mod = CPAN::Shell->expandany( ($modinfo->{'src'}) );
- #
- # Set CPAN configuration options
- while (my ($param,$newvalue) = each(%CPAN_config)) {
- $CPAN::Config->{$param} = $newvalue;
- print "set $param = $newvalue\n";
- }
- $Mod->get();
-}
-
-print "\n\nReady to begin installing libraries - hit enter to proceed\n\n";
-while (! <>) {};
-
-foreach my $library (@Libraries) {
- # open up the library
- if (exists($library->{'src'})) {
- my $extract_command = 'cd '.$builddir.'/'.$library->{'dirname'}.';'.
- 'tar zxf '.$library->{'src'}.';';
- system($extract_command);
- }
- my $compile_command = 'cd '.$builddir.'/'.$library->{'dirname'}.';'.
- $library->{'compile'};
- system($compile_command);
-}
-
-print "\n\nReady to begin compiling and installing modules -".
- " hit enter to proceed\n\n";
-while (! <>) {};
-
-foreach my $modinfo (@Modules) {
- next if ($modinfo->{'compile'} =~ /^(nonstandard|no|manual)$/);
- my $compile_commands = 'cd '.$builddir.'/'.$modinfo->{'dirname'}.';'.
- $modinfo->{'compile'};
- system($compile_commands);
+if ($download) {
+ print "Retrieving perl modules".$/;
+ foreach my $modinfo (@Modules) {
+ if (exists($modinfo->{'extract'})) {
+ # (experimental code)
+ # Extract locally instead of downloading
+ system('cd '.$builddir.';'.
+ 'tar xf '.$basedir.'/'.$modinf->{'extract'}.';'.
+ 'cd '.$basedir);
+ next;
+ }
+ my $Mod = CPAN::Shell->expandany( ($modinfo->{'src'}) );
+ if (! defined($Mod)) {
+ print "Unable to get ".$modinfo->{'src'}."\n";
+ next;
+ }
+ #
+ # Set CPAN configuration options
+ while (my ($param,$newvalue) = each(%CPAN_config)) {
+ $CPAN::Config->{$param} = $newvalue;
+ print "set $param = $newvalue\n";
+ }
+ $Mod->get();
+ }
+}
+
+if ($install_libs) {
+ print "Installing libraries needed for compilation".$/;
+ foreach my $library (@Libraries) {
+ # open up the library
+ if (exists($library->{'src'})) {
+ my $extract_command = 'cd '.$builddir.'/'.$library->{'dirname'}.';'.
+ 'tar zxf '.$library->{'src'}.';';
+ system($extract_command);
+ }
+ my $compile_command = 'cd '.$builddir.'/'.$library->{'dirname'}.';'.
+ $library->{'compile'};
+ system($compile_command);
+ }
+}
+
+if ($install_modules) {
+ print "compiling and installing modules".$/;
+ foreach my $modinfo (@Modules) {
+ next if ($modinfo->{'compile'} =~ /^(nonstandard|no|manual)$/);
+ my $compile_commands = 'cd '.$builddir.'/'.$modinfo->{'dirname'}.';'.
+ $modinfo->{'compile'};
+ system($compile_commands);
+ }
+}
+
+if (defined($printcmds)) {
+ print "Printing commands required for '".$printcmds."'".$/;
+ foreach my $modinfo (@Modules) {
+ next if ($modinfo->{'src'} !~ /$printcmds/);
+ my $compile_commands = 'cd '.$builddir.'/'.$modinfo->{'dirname'}.';'.
+ $modinfo->{'compile'};
+ print $compile_commands.$/;
+ }
}
--matthew1090260727--