[interchange-cvs] interchange - heins modified 4 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Sun Feb 27 03:29:19 EST 2005
User: heins
Date: 2005-02-27 08:29:17 GMT
Modified: . Makefile.PL hints.pl test.pl
Modified: scripts interchange.PL
Log:
* Allow Interchange to install and run on a threaded system without
manual installation.
1. Query on installation with a threaded Perl. If you answer
"yes" it will create the file _allow_threads and then build
and test.
2. Added an os hint that inserts the MV_GETPPID_BROKEN
fix if on Linux and running threads.
3. Once you have installed with threads, and the _allow_threads
file is in the IC root, you don't need to set the environment
variable anymore. You will get a warning.
4. Put in a check for Perl 5.8.5 to be allowed to run with
threads. There were several ithreads bugs fixed in that version.
Revision Changes Path
2.51 +35 -5 interchange/Makefile.PL
rev 2.51, prev_rev 2.50
Index: Makefile.PL
===================================================================
RCS file: /var/cvs/interchange/Makefile.PL,v
retrieving revision 2.50
retrieving revision 2.51
diff -u -r2.50 -r2.51
--- Makefile.PL 24 Jan 2005 22:08:13 -0000 2.50
+++ Makefile.PL 27 Feb 2005 08:29:17 -0000 2.51
@@ -59,10 +59,6 @@
$ENV{PERL_RL} = 'Perl';
}
-if(! $ENV{MINIVEND_FORCE_THREADS} and $Config{usethreads} || $Config{useithreads} || $Config{use5005threads}) {
- die "Interchange will not work with a thread-enabled perl.\n";
-}
-
my $term;
if($TermRead) {
eval {
@@ -360,6 +356,29 @@
close UID;
}
+ $Global::TryingThreads = $Config{usethreads}
+ || $Config{useithreads}
+ || $Config{use5005threads};
+
+ if($Global::TryingThreads and ! -f '_allow_threads') {
+ print <<EOF;
+It is not recommended that you run Interchange with a thread-enabled perl,
+which you have called this installer with. Either rerun with
+
+ /path/to/non-threaded/perl Makefile.PL
+
+or accept the possible problems that come with running on an experimental
+software system.
+EOF
+
+ my $ans = my_prompt("Do you want to try running with threads? ", 'n');
+ exit if $ans !~ /^\s*y/i;
+ open(THR, ">_allow_threads")
+ or die "Can't write allow threads file: $!\n";
+ print THR "I agree not to hold anyone but myself responsible for the results of running an experimental system.\n";
+ close THR;
+ }
+
#warn "Got past open UID file , uid=$uid user=$>\n";
GETUID: {
@@ -583,12 +602,23 @@
"$realdir/$_";
}
}
+
+ ALLOWTHREADS: {
+ unlink "$realdir/_allow_threads";
+ last ALLOWTHREADS unless $Global::TryingThreads;
+ open(THR, ">$realdir/_allow_threads")
+ or die "Can't write allow threads file: $!\n";
+ print THR "I agree not to hold anyone but myself responsible for the results of running an experimental system.\n";
+ close THR;
+ }
+
if($MV::Default{LSB}) {
my $d = cwd();
print "Doing LSB install...\n";
do './install_lsb.pl';
print "Done with LSB install.\n";
}
+
if(@remove_old) {
if($MV::Default{UNLINK}) {
print "Removing old files....";
@@ -860,7 +890,7 @@
NAME => "Interchange",
DISTNAME => "interchange",
clean => {
- FILES => "lib/IniConf.pm _uid _db_storable _session_storable lib/File/CounterFile.pm scripts/initp.pl scripts/compile_link scripts/config_prog scripts/configdump scripts/dump scripts/expire scripts/localize scripts/expireall scripts/makecat scripts/ic_mod_perl scripts/interchange scripts/offline scripts/restart scripts/update",
+ FILES => "lib/IniConf.pm _uid _db_storable _allow_threads _session_storable lib/File/CounterFile.pm scripts/initp.pl scripts/compile_link scripts/config_prog scripts/configdump scripts/dump scripts/expire scripts/localize scripts/expireall scripts/makecat scripts/ic_mod_perl scripts/interchange scripts/offline scripts/restart scripts/update",
},
dist => {
2.1 +24 -0 interchange/hints.pl
rev 2.1, prev_rev 2.0
Index: hints.pl
===================================================================
RCS file: /var/cvs/interchange/hints.pl,v
retrieving revision 2.0
retrieving revision 2.1
diff -u -r2.0 -r2.1
--- hints.pl 18 Jul 2001 02:20:33 -0000 2.0
+++ hints.pl 27 Feb 2005 08:29:17 -0000 2.1
@@ -32,6 +32,30 @@
};
push @out, [ $condition, $routine ];
+ $condition = sub { $Global::TryingThreads && $^O =~ /linux/i };
+ $routine = sub {
+ my $fn = 'interchange.cfg.dist';
+ rename $fn, "$fn.bak";
+ open HINTIN, "$fn.bak"
+ or die "cannot open $fn.bak: $!\n";
+ open HINTOUT, ">$fn"
+ or die "cannot write $fn: $!\n";
+ while(<HINTIN>) {
+ print HINTOUT $_;
+ }
+ print HINTOUT <<EOF;
+
+## Added because threaded Perl on linux has broken getppid() as
+## of this distribution
+Variable MV_GETPPID_BROKEN 1
+EOF
+ close HINTIN;
+ close HINTOUT;
+ unlink "$fn.bak";
+ return 1;
+ };
+ push @out, [ $condition, $routine ];
+
return @out;
}
2.4 +11 -0 interchange/test.pl
rev 2.4, prev_rev 2.3
Index: test.pl
===================================================================
RCS file: /var/cvs/interchange/test.pl,v
retrieving revision 2.3
retrieving revision 2.4
diff -u -r2.3 -r2.4
--- test.pl 1 Aug 2003 15:05:54 -0000 2.3
+++ test.pl 27 Feb 2005 08:29:17 -0000 2.4
@@ -16,6 +16,16 @@
$ENV{MINIVEND_ROOT} = "$cur_dir/blib";
$ENV{MINIVEND_PORT} = 8786 unless defined $ENV{MINIVEND_PORT};
+my $extra_cfg = '';
+
+if(-f '_allow_threads') {
+ open(THR, ">$ENV{MINIVEND_ROOT}/_allow_threads")
+ or die "Can't write allow threads file: $!\n";
+ print THR "I agree not to hold anyone but myself responsible for the results of running an experimental system.\n";
+ close THR;
+ $^O =~ /linux/i and $extra_cfg = 'Variable MV_GETPPID_BROKEN 1';
+}
+
open(CONFIG, ">$ENV{MINIVEND_ROOT}/interchange.cfg")
or die "open: $!\n";
@@ -24,6 +34,7 @@
TcpMap $ENV{MINIVEND_PORT} -
TagDir 0
TagDir etc
+$extra_cfg
EOF
open(CONFIG, ">$ENV{MINIVEND_ROOT}/catalog.cfg")
2.83 +44 -8 interchange/scripts/interchange.PL
rev 2.83, prev_rev 2.82
Index: interchange.PL
===================================================================
RCS file: /var/cvs/interchange/scripts/interchange.PL,v
retrieving revision 2.82
retrieving revision 2.83
diff -u -r2.82 -r2.83
--- interchange.PL 24 Jan 2005 22:08:14 -0000 2.82
+++ interchange.PL 27 Feb 2005 08:29:17 -0000 2.83
@@ -3,7 +3,7 @@
#
# Interchange version 5.3.1
#
-# $Id: interchange.PL,v 2.82 2005/01/24 22:08:14 jon Exp $
+# $Id: interchange.PL,v 2.83 2005/02/27 08:29:17 mheins Exp $
#
# Copyright (C) 2002-2005 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -38,13 +38,6 @@
use Config;
-BEGIN {
- if(! $ENV{MINIVEND_FORCE_THREADS}
- && ($Config{usethreads} || $Config{useithreads} || $Config{use5005threads})) {
- die "Interchange will not work with a thread-enabled perl.\n";
- }
-}
-
## Comment this back in when we remove support for Perl 5.6.0
#no Config;
@@ -64,6 +57,16 @@
$Global::VendRoot = $Global::VendRoot || '/usr/local/interchange';
# $Global::VendRoot = $Global::VendRoot || '~_~INSTALLARCHLIB~_~';
+ -f "$Global::VendRoot/_allow_threads" and $ENV{MINIVEND_FORCE_THREADS} = 1;
+
+ if( ($Config{usethreads} || $Config{useithreads} || $Config{use5005threads}) ) {
+ $Global::TryingThreads = 1;
+ }
+
+ if( $Global::TryingThreads and ! $ENV{MINIVEND_FORCE_THREADS} ) {
+ die "Interchange will not work with a thread-enabled perl.\n";
+ }
+
if(-f "$Global::VendRoot/interchange.cfg") {
$Global::ExeName = 'interchange';
$Global::ConfigFile = 'interchange.cfg';
@@ -847,6 +850,39 @@
chomp $msg;
logGlobal($msg);
}
+ }
+
+ THREADCHECK: {
+ last THREADCHECK unless $Global::TryingThreads;
+ my $high_enough;
+ eval {
+ require 5.8.5;
+ $high_enough = 1;
+ };
+
+ unless($high_enough) {
+ die "Your Perl version is not high enough to run threads, needs 5.8.5.\n";
+ }
+
+ my $msg = <<EOF;
+***************************************************************
+***************************************************************
+**** ****
+**** You are running a Perl with threads enabled -- this ****
+**** is not recommended for a production environment. ****
+**** ****
+**** If the Interchange daemon does not start, add this ****
+**** line to interchange.cfg: ****
+**** ****
+**** Variable MV_GETPPID_BROKEN 1 ****
+**** ****
+**** Then restart the server. ****
+**** ****
+***************************************************************
+***************************************************************
+EOF
+ chomp $msg;
+ logGlobal($msg);
}
# The global configuration set up which catalogs exist.
More information about the interchange-cvs
mailing list