[Apache-dispatch-devel] SF.net SVN: apache-dispatch: [59] trunk
Brought to you by:
geoffrey_young,
phred_moyer
|
From: <phr...@us...> - 2007-12-25 05:21:11
|
Revision: 59
http://apache-dispatch.svn.sourceforge.net/apache-dispatch/?rev=59&view=rev
Author: phred_moyer
Date: 2007-12-24 21:21:13 -0800 (Mon, 24 Dec 2007)
Log Message:
-----------
Steal the Makefile.PL from Apache::Reload, and merge it with the needed
custom config directive generating code.
Steal the RELEASE document also.
Modified Paths:
--------------
trunk/Changes
trunk/Makefile.PL
Added Paths:
-----------
trunk/RELEASE
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2007-08-06 01:01:40 UTC (rev 58)
+++ trunk/Changes 2007-12-25 05:21:13 UTC (rev 59)
@@ -1,11 +1,16 @@
Revision history for Perl extension Apache::Dispatch
+0.10-dev
+ - 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
+ config directive generation, it detects the version more reliably - fred
+
0.10_03
- - use the :withtestmore feature correctly
- - use like() instead of ok( $foo =~ m/bar/ )
+ - use the :withtestmore feature correctly - fred, thanks to geoff for the spot
+ - use like() instead of ok( $foo =~ m/bar/ ) - fred
0.10_02 07.19.2007
- - fix the unadvertised feature which allows handling <Location />
+ - fix the unadvertised feature which allows handling <Location /> - fred
0.10_01 10.23.2006
- move common methods to Apache::Dispatch::Util and adjust @ISA for
Modified: trunk/Makefile.PL
===================================================================
--- trunk/Makefile.PL 2007-08-06 01:01:40 UTC (rev 58)
+++ trunk/Makefile.PL 2007-12-25 05:21:13 UTC (rev 59)
@@ -1,101 +1,47 @@
package Apache::Dispatch;
-require 5.005;
-
use strict;
+use warnings;
-use lib 'lib';
+use Config;
-use Apache::Dispatch::Util;
-use ExtUtils::MakeMaker;
+my %prereqs = ();
+my %mp2 = ( mod_perl2 => 1.99022 );
+my %mp1 = ( mod_perl => 0 );
-my $HAS_APACHE_TEST = eval {
- require Apache::Test;
- require Apache::TestMM;
-
- Apache::TestMM->import(qw(test clean));
- Apache::TestMM::filter_args();
-
- my %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::TestMM::generate_script('t/TEST');
- return 1;
-};
-
-sub MY::test {
-
- eval { require Test::More } or return <<EOF;
-test::
-\t\@echo
-\t\@echo sorry, cannot run tests without Test::More
-\t\@echo
-EOF
-
- return $HAS_APACHE_TEST if $HAS_APACHE_TEST;
-
- return <<EOF
-test::
-\t\@echo
-\t\@echo sorry, cannot run tests without a properly
-\t\@echo configured Apache-Test environment
-\t\@echo
-EOF
+my $mp_gen;
+if ( $ENV{MOD_PERL_2_BUILD} ) {
+ push @ARGV, "-apxs $ENV{MP_APXS}";
+ my $mp_gen = satisfy_mp_generation(2);
}
-
-sub MY::clean {
-
- if ($HAS_APACHE_TEST) {
- require Apache::TestMM;
-
- return Apache::TestMM::clean(@_);
- }
-
- return shift->MM::clean(@_);
+else {
+ $mp_gen = satisfy_mp_generation();
}
-## which mp version ( 1.2x or 2.0.x)
-my ( $mp_wanted, $mp_ver ) = &get_mp_ver();
+%prereqs = ( $mp_gen == 1 ? %mp1 : %mp2 );
-print STDERR "Using mod_perl/$mp_ver\n\n";
+my $HAS_APACHE_TEST = check_for_apache_test();
-my %prereq = ();
+my %common_opts = (
+ PREREQ_PM => \%prereqs,
+ clean => { FILES => 't/TEST' },
+);
-my %makefile_params = ( 'VERSION' => '0.10_02', );
+if ( $mp_gen == 1 ) {
-if ( $mp_wanted == 2 ) { # mod_perl2 specific makefile
- $prereq{'mod_perl2'} = 1.99023; # this covers the naming change
- $makefile_params{'NAME'} = 'Apache2::Dispatch';
- $makefile_params{'PREREQ_PM'} = \%prereq;
+ # Build directives using xs or PerlSetVar
+ my %makefile_params = ();
- WriteMakefile(%makefile_params);
-}
-
-elsif ( $mp_wanted == 1 ) { # mod_perl1 specific makefile
eval {
require Apache::ExtUtils;
require Apache::src;
- };
+ };
- # Build directives using xs or PerlSetVar
- my $pureperl;
-
if ( $@ || $ENV{DISPATCH_PUREPERL} ) {
print
"Building without Custom Apache Directives, use 'PerlSetVar' for configuration.\n\n";
-
$makefile_params{'PL_FILES'} = { 'set_pureperl.PL' => '1' };
- $makefile_params{'C'} = [];
+ $makefile_params{'C'} = [];
}
else {
@@ -106,6 +52,8 @@
$makefile_params{'clean'} = { FILES => '*.xs*' };
import Apache::ExtUtils qw(command_table);
+ use lib 'lib';
+ require Apache::Dispatch::Util;
my @directives = Apache::Dispatch::Util->directives();
command_table( \@directives );
@@ -113,71 +61,144 @@
die "Can't find mod_perl header files installed" unless $inc;
$makefile_params{'INC'} = $inc;
}
- $makefile_params{'PREREQ_PM'} = { mod_perl => 1.2401 };
- WriteMakefile(
- NAME => __PACKAGE__,
- PREREQ_PM => \%prereq,
+
+ require ExtUtils::MakeMaker;
+ ExtUtils::MakeMaker::WriteMakefile(
+ %common_opts,
%makefile_params,
+ VERSION_FROM => "lib/Apache/Dispatch.pm",
+ NAME => "Apache::Dispatch",
+ ABSTRACT_FROM => 'lib/Apache/Dispatch.pm',
);
+
}
+else {
+ require ModPerl::MM;
+ ModPerl::MM::WriteMakefile(
+ %common_opts,
+ VERSION_FROM => "lib/Apache2/Dispatch.pm",
+ NAME => "Apache2::Dispatch",
+ ABSTRACT_FROM => 'lib/Apache2/Dispatch.pm',
+ );
+}
-# The next sub inspired by Apache::Peek 1.05
+if ( $ENV{MOD_PERL_2_BUILD} ) {
+ pop @ARGV;
+}
-sub get_mp_ver {
+sub check_for_apache_test {
+ return unless eval {
+ require Apache::Test;
+ require Apache::TestMM;
+ require Apache::TestRunPerl;
+ 1;
+ };
- my $at_ver;
- my %at_args;
- if ($HAS_APACHE_TEST) {
- %at_args = @Apache::TestMM::Argv;
- } elsif ( @ARGV ) {
- %at_args = @ARGV;
- $at_args{'httpd'} = $at_args{'-httpd'};
- $at_args{'apxs'} = $at_args{'-apxs'};
- }
+ Apache::TestMM::filter_args();
- if ( $at_args{'apxs'} && $at_args{'httpd'} ) {
+ my %args;
+ {
+ no warnings;
+ %args = @Apache::TestMM::Argv;
+ }
- # probably mp2
- ($at_ver) = `$at_args{'httpd'} -v` =~ m!Apache\/(\d{1})!;
- if ( $at_ver == 1 ) {
- die <<EOF;
-Sorry dynamic builds are not supported for mod_perl 1
-EOF
- } elsif (!$at_ver) {
- die <<EOF;
-Couldn't determine an apache version from your -httpd argument
-EOF
- }
- }
- elsif ( $at_args{'httpd'} ) {
+ 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}
+ );
- # probably mp1
- ($at_ver) = `$at_args{'httpd'} -v` =~ m!Apache\/(\d{1})!;
- if ( $at_ver == 2 ) { # static build for mp2 not supported
- die <<EOF;
-You specified -httpd, and httpd version is 2, but static
-builds in mp2 are not yet supported. Please see INSTALL
-or specify a -apxs /path/to/apxs option.
-EOF
+ 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";
}
- unless ( $at_ver == 1 ) {
- die <<EOF;
-Couldn't determine an apache version from your -httpd argument
-EOF
- }
- }
+ $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;
- my @args = ();
-
- while ( my $arg = shift @ARGV ) {
- if ( $arg =~ /^MOD_PERL=([12])$/ ) {
+ foreach my $key (@ARGV) {
+ if ( $key =~ /^MOD_PERL=(\d)$/ ) {
$flag = $1;
}
- else {
- push @args, $arg;
- }
}
- @ARGV = @args;
# check %ENV
my $env = exists $ENV{MOD_PERL} ? $ENV{MOD_PERL} : 0;
@@ -192,59 +213,63 @@
EOF
}
- my $wanted;
- $wanted = 2 if $env == 2 || $flag == 2 || $at_ver == 2;
- $wanted = 1 if $env == 1 || $flag == 1 || $at_ver == 1;
+ 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_perl2 };
+ eval { require mod_perl };
if ($@) {
# if we don't have mp1, check for mp2
- eval { require mod_perl } if ($@);
+ eval { require mod_perl2 } if ($@);
unless ($@) {
- $wanted = 1;
+ $wanted = 2;
}
}
else {
- $wanted = 2;
+ $wanted = 1;
}
}
- if ( !$wanted ) {
- die "can't determine your mod_perl version, see INSTALL\n";
- }
- elsif ( !( $wanted == 1 || $wanted == 2 ) ) {
- die "don't know anything about mod_perl generation: $wanted\n"
- . "currently supporting only generations 1 and 2";
- }
+ return $wanted;
+}
- my $mp_ver;
+package MY;
- if ( $wanted == 2 ) {
- eval { require mod_perl2 };
- my $req_ver = 1.999022;
- if ( $mod_perl2::VERSION < $req_ver || $@ ) {
- die
-"mod_perl2 required version is $req_ver, you have $mod_perl2::VERSION. Please upgrade to continue.";
- }
- else {
- $mp_ver = $mod_perl2::VERSION;
- }
- }
- elsif ( $wanted == 1 ) {
- eval { require mod_perl };
- no warnings qw(uninitialized);
- if ( $@ ) {
- die "You don't seem to have mod_perl 1.0 installed, see INSTALL\n";
- }
- else {
- $mp_ver = $mod_perl::VERSION;
- }
- }
+sub postamble {
+ my $self = shift;
- return ( $wanted, $mp_ver );
+ my $string = $self->SUPER::postamble;
+
+ $string .= <<'EOF';
+tag :
+ svn copy https://apache-dispatch.svn.sourceforge.net/svnroot/apache-dispatch/trunk https://apache-dispatch.svn.sourceforge.net/svnroot/apache-dispatch/tags/$(VERSION_SYM)
+ @echo update lib/Apache/Dispatch.pm VERSION now
+EOF
+
+ return $string;
}
+sub test {
+ my $self = shift;
+
+ eval { require Test::More } or return <<EOF;
+test::
+\t\@echo sorry, cannot run tests without Test::More
+EOF
+
+ return $self->Apache::TestMM::test(@_) if $HAS_APACHE_TEST;
+
+ return $self->SUPER::test(@_);
+}
+
+sub clean {
+ my $self = shift;
+
+ return $self->Apache::TestMM::clean(@_) if $HAS_APACHE_TEST;
+
+ return $self->SUPER::clean(@_);
+}
Added: trunk/RELEASE
===================================================================
--- trunk/RELEASE (rev 0)
+++ trunk/RELEASE 2007-12-25 05:21:13 UTC (rev 59)
@@ -0,0 +1,84 @@
+Instructions for Apache-Dispatch Release Manager
+
+1. 'make dist' - to make sure nothing is missing from the manifest,
+ etc. Now test this generated package (not svn) with as many
+ configurations as possible on as many platforms as possible.
+
+ a. edit ./Changes:
+ - find lib -type f -name "*.pm" | \
+ xargs perl -pi -e 's,0.10-dev,0.10-rc1,g'
+ - perl -pi -e 's,0.10-dev,0.10-rc1,g' Changes
+
+ - don't commit these (see dev@ archives)
+
+ b. nuke any preinstalled Apache-Dispatch libs and run 'make test'
+
+ c. test that you can 'make install' and then run 'make test' again
+
+ d. test whether we still 100% OK on systems with no LWP:
+
+ % APACHE_TEST_PRETEND_NO_LWP=1 make test
+
+2. once confident that the package is good, upload a release candidate
+ to people.apache.org/~username and post 24 hour-ish candidate alert
+ to the various lists
+
+ o dev/perl.apache.org
+ o modperl/perl.apache.org
+
+ Subject: [RELEASE CANDIDATE] Apache-Dispatch 0.10 RC\d+
+
+ (or maybe longer to give most people a chance to catch up). no need
+ to tag this package
+
+ a. if problems are detected during stage 2, repeat stages 1 and 2.
+
+3. when the package has been reported to be good, prepare a new
+ package to be released
+
+ a. edit ./Changes:
+ - remove -rc\d+
+ - add release date
+
+ b. rerun:
+ % perl Makefile.PL
+ make sure tag looks right
+ % make -n tag
+
+ c. commit Changes
+ % svn ci Changes
+
+ d. tag
+ % make tag
+
+ e. create the final package
+ % make dist
+
+ f. test the final package again at least once
+
+4. Upload the package to CPAN
+
+5. Announce the package
+
+ a. post ... to the modperl, announce lists
+ Subject: [ANNOUNCE] Apache-Dispatch 0.10
+ include
+ - MD5 sig (as it comes from CPAN upload announce).
+ - the latest Changes
+
+6. Prepare for the next cycle
+
+ a. increment version in lib/Apache/Dispatch.pm
+
+ b. edit ./Changes:
+ - start a new item with incremented version + '-dev'
+
+ =item 0.11-dev
+
+ c. bump up version numbers in this file to make it easier to do the
+ next release.
+
+ $ perl -pi -e 's/(\d+)\.(\d+)/join(".", $1, $2+1)/eg' RELEASE
+
+ d. commit Changes
+ % svn ci -m "start 0.11-dev cycle" Changes RELEASE lib/Apache/Dispatch.pm
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|