[Apache-dispatch-devel] SF.net SVN: apache-dispatch: [64] trunk
Brought to you by:
geoffrey_young,
phred_moyer
|
From: <phr...@us...> - 2008-06-22 11:03:01
|
Revision: 64
http://apache-dispatch.svn.sourceforge.net/apache-dispatch/?rev=64&view=rev
Author: phred_moyer
Date: 2008-06-20 17:05:27 -0700 (Fri, 20 Jun 2008)
Log Message:
-----------
Testing replacement of the bootstrapping yuckiness with Apache::Bootstrap
Modified Paths:
--------------
trunk/Changes
trunk/Makefile.PL
trunk/lib/Apache/Dispatch.pm
trunk/lib/Apache2/Dispatch.pm
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2008-01-08 19:14:39 UTC (rev 63)
+++ trunk/Changes 2008-06-21 00:05:27 UTC (rev 64)
@@ -1,5 +1,8 @@
Revision history for Perl extension Apache::Dispatch
+0.11
+ - use Apache::Bootstrap to bootstrap mod_perl version
+
0.10 01.08.2008
- steal the RELEASE doc from Apache::Reload and adapt it - fred
- steal the Makefile.PL from A::R, and merge it with our needed custom
Modified: trunk/Makefile.PL
===================================================================
--- trunk/Makefile.PL 2008-01-08 19:14:39 UTC (rev 63)
+++ trunk/Makefile.PL 2008-06-21 00:05:27 UTC (rev 64)
@@ -5,22 +5,33 @@
use Config;
-my %prereqs = ();
+BEGIN {
+ my $AB_VER = 0.02;
+ my $fail_msg = "Warning: prerequisite Apache::Bootstrap $AB_VER not found.";
+
+ eval { require Apache::Bootstrap };
+ die $fail_msg . "\n" if $@;
+
+ die $fail_msg . " We have $Apache::Bootstrap::VERSION.\n"
+ if $Apache::Bootstrap::VERSION < $AB_VER;
+}
+
+my %prereqs = ( );
my %mp2 = ( mod_perl2 => 1.99022 );
my %mp1 = ( mod_perl => 0 );
my $mp_gen;
if ( $ENV{MOD_PERL_2_BUILD} ) {
push @ARGV, "-apxs $ENV{MP_APXS}";
- my $mp_gen = satisfy_mp_generation(2);
+ my $mp_gen = Apache::Bootstrap->satisfy_mp_generation(2);
}
else {
- $mp_gen = satisfy_mp_generation();
+ $mp_gen = Apache::Bootstrap->satisfy_mp_generation();
}
%prereqs = ( $mp_gen == 1 ? %mp1 : %mp2 );
-my $HAS_APACHE_TEST = check_for_apache_test();
+my $HAS_APACHE_TEST = Apache::Bootstrap->check_for_apache_test();
my %common_opts = (
PREREQ_PM => \%prereqs,
@@ -86,157 +97,6 @@
pop @ARGV;
}
-sub check_for_apache_test {
- return unless eval {
- require Apache::Test;
- require Apache::TestMM;
- require Apache::TestRunPerl;
- 1;
- };
-
- Apache::TestMM::filter_args();
-
- my %args;
- {
- no warnings;
- %args = @Apache::TestMM::Argv;
- }
-
- return 0
- unless (
- (
- Apache::TestConfig->can('custom_config_path')
- and -f Apache::TestConfig->custom_config_path()
- )
- or $args{apxs}
- or $args{httpd}
- or $ENV{APACHE_TEST_HTTPD}
- or $ENV{APACHE_TEST_APXS}
- );
-
- Apache::TestRunPerl->generate_script();
-
- return 1;
-}
-
-# If a specific generation was passed as an argument,
-# if satisfied
-# return the same generation
-# else
-# die
-# else @ARGV and %ENV will be checked for specific orders
-# if the specification will be found
-# if satisfied
-# return the specified generation
-# else
-# die
-# else if any mp generation is found
-# return it
-# else
-# die
-
-sub satisfy_mp_generation {
- my $wanted = shift || wanted_mp_generation();
-
- unless ( $wanted == 1 || $wanted == 2 ) {
- die "don't know anything about mod_perl generation: $wanted\n"
- . "currently supporting only generations 1 and 2";
- }
-
- my $selected = 0;
-
- if ( $wanted == 1 ) {
- require_mod_perl();
- if ( $mod_perl::VERSION >= 1.99 ) {
-
- # so we don't pick 2.0 version if 1.0 is wanted
- die "You don't seem to have mod_perl 1.0 installed";
- }
- $selected = 1;
- }
- elsif ( $wanted == 2 ) {
-
- #warn "Looking for mod_perl 2.0";
- require_mod_perl();
- if ( $mod_perl::VERSION < 2.0 ) {
- die "You don't seem to have mod_perl 2.0 installed";
- }
- $selected = 2;
- }
- else {
- require_mod_perl();
- $selected = $mod_perl::VERSION >= 1.99 ? 2 : 1;
- warn "Using $mod_perl::VERSION\n";
- }
-
- return $selected;
-}
-
-sub require_mod_perl {
- eval { require mod_perl };
- eval { require mod_perl2 } if ($@);
- die "Can't find mod_perl installed\nThe error was: $@" if $@;
-}
-
-# the function looks at %ENV and Makefile.PL option to figure out
-# whether a specific mod_perl generation was requested.
-# It uses the following logic:
-# via options:
-# perl Makefile.PL MOD_PERL=2
-# or via %ENV:
-# env MOD_PERL=1 perl Makefile.PL
-#
-# return value is:
-# 1 or 2 if the specification was found (mp 1 and mp 2 respectively)
-# 0 otherwise
-sub wanted_mp_generation {
-
- # check if we have a command line specification
- # flag: 0: unknown, 1: mp1, 2: mp2
- my $flag = 0;
- foreach my $key (@ARGV) {
- if ( $key =~ /^MOD_PERL=(\d)$/ ) {
- $flag = $1;
- }
- }
-
- # check %ENV
- my $env = exists $ENV{MOD_PERL} ? $ENV{MOD_PERL} : 0;
-
- # check for contradicting requirements
- if ( $env && $flag && $flag != $env ) {
- die <<EOF;
-Can\'t decide which mod_perl version should be used, since you have
-supplied contradicting requirements:
- enviroment variable MOD_PERL=$env
- Makefile.PL option MOD_PERL=$flag
-EOF
- }
-
- my $wanted = 0;
- $wanted = 2 if $env == 2 || $flag == 2;
- $wanted = 1 if $env == 1 || $flag == 1;
-
- unless ($wanted) {
-
- # if still unknown try to require mod_perl.pm
- eval { require mod_perl };
- if ($@) {
-
- # if we don't have mp1, check for mp2
- eval { require mod_perl2 } if ($@);
- unless ($@) {
- $wanted = 2;
- }
- }
- else {
- $wanted = 1;
- }
- }
-
- return $wanted;
-}
-
package MY;
sub postamble {
Modified: trunk/lib/Apache/Dispatch.pm
===================================================================
--- trunk/lib/Apache/Dispatch.pm 2008-01-08 19:14:39 UTC (rev 63)
+++ trunk/lib/Apache/Dispatch.pm 2008-06-21 00:05:27 UTC (rev 64)
@@ -11,7 +11,7 @@
use strict;
use warnings;
-our $VERSION = '0.10';
+our $VERSION = '0.11';
use mod_perl 1.2401;
use Apache::Constants qw(OK DECLINED SERVER_ERROR);
Modified: trunk/lib/Apache2/Dispatch.pm
===================================================================
--- trunk/lib/Apache2/Dispatch.pm 2008-01-08 19:14:39 UTC (rev 63)
+++ trunk/lib/Apache2/Dispatch.pm 2008-06-21 00:05:27 UTC (rev 64)
@@ -9,7 +9,7 @@
use strict;
use warnings;
-$Apache2::Dispatch::VERSION = '0.10';
+$Apache2::Dispatch::VERSION = '0.11';
use mod_perl2 1.99023;
use Apache2::Const -compile => qw(OK DECLINED SERVER_ERROR);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|