You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-dev@httpd.apache.org by Stas Bekman <st...@stason.org> on 2003/06/16 08:42:31 UTC
Re: resolving Apache::Test vs. Apache::test collision
OK, here is the patch that nukes Apache/test.pm. Please test it on
case-insensitive systems (if you don't have Apache/test.pm, please add it just
to test). Once you confirm that it works, I release Apache::Test 1.03, so we
can go ahead with the new libapreq release.
Index: Changes
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Changes,v
retrieving revision 1.26
diff -u -r1.26 Changes
--- Changes 6 Jun 2003 01:46:13 -0000 1.26
+++ Changes 16 Jun 2003 06:40:03 -0000
@@ -8,6 +8,11 @@
=item 1.03-dev -
+Instrumented Makefile.PL to unconditionally remove any old
+pre-installed occurrences of Apache/test.pm, which has been renamed to
+Apache/testold.pm in mod_perl 1.28 to avoid collisions with
+Apache/Test.pm on case-insensitive systems. [Stas]
+
Apache::TestClient now handles correctly responses with no body and
its response header() method is no longer case-sensitive [Stas]
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Makefile.PL,v
retrieving revision 1.8
diff -u -r1.8 Makefile.PL
--- Makefile.PL 29 Apr 2003 06:37:47 -0000 1.8
+++ Makefile.PL 16 Jun 2003 06:40:03 -0000
@@ -7,6 +7,8 @@
my $VERSION;
+use File::Spec::Functions qw(catfile catdir);
+
use Apache::Test5005compat;
use Apache::TestMM qw(test); #enable 'make test'
@@ -21,6 +23,8 @@
set_version();
+nuke_Apache__test();
+
WriteMakefile(
NAME => 'Apache::Test',
VERSION => $VERSION,
@@ -59,3 +63,47 @@
return $string;
}
+
+# on Case-Insensitive systems Apache/Test.pm can't coexist with
+# Apache/test.pm, since Apache::test is now deprecated (was renamed to
+# Apache/testold.pm in mod_perl 1.28, we need to find and remove any
+# occurrences of this file. CPAN authors should
+# s/Apache::test/Apache::testold/ and can either require mod_perl 1.28
+# which already carries it or simply bundle it. The best option is to
+# port the test suite to use Apache::Test which works with both
+# mod_perl generations.
+#
+# we could have done this cleanup only for case-insensitive systems,
+# but I feel that doing it for all systems, will speedup the
+# transitions from Apache::test to either Apache::Test or
+# Apache::testold.
+#
+sub nuke_Apache__test {
+
+ my @convicts = ();
+ foreach (@INC) {
+ my $dir = catdir $_, "Apache";
+ next unless -d $dir;
+ opendir DIR, $dir or die "Cannot opendir $dir: $!\n";
+ my @matches = grep /^test.pm$/, readdir DIR;
+ closedir DIR;
+ push @convicts, map { catfile $dir, $_ } @matches if @matches;
+ }
+
+ if (@convicts) {
+ print <<EOI;
+Makefile.PL has found old copies of Apache/test.pm which will
+be removed to prevent collisions with Apache::Test.
+
+CPAN authors are advised to either use Apache::testold or port their
+test suite to Apache::Test which works with both mod_perl generations.
+EOI
+ }
+
+ for (@convicts) {
+ print "unlink $_\n";
+ chmod 0666, $_;
+ unlink $_
+ or warn "!!! Failed to delete $_, please make sure to delete $_";
+ }
+}
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: resolving Apache::Test vs. Apache::test collision
Posted by Stas Bekman <st...@stason.org>.
David Wheeler wrote:
> On Wednesday, June 18, 2003, at 07:30 AM, Stas Bekman wrote:
>
>>> Now just awaiting a confirmation from David and I'll put Apache::Test
>>> 1.03 on CPAN.
>>
>>
>> David, if you see this before tomorrow, simpy try the latest cvs, I
>> have already committed the needed change. Hopefully it does do the
>> right thing for you.
>
>
> It does. Well done.
Thanks David, posting Apache::Test to CPAN.
Hopefully this post concludes this *very* long thread ;)
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: resolving Apache::Test vs. Apache::test collision
Posted by David Wheeler <da...@wheeler.net>.
On Wednesday, June 18, 2003, at 07:30 AM, Stas Bekman wrote:
>> Now just awaiting a confirmation from David and I'll put Apache::Test
>> 1.03 on CPAN.
>
> David, if you see this before tomorrow, simpy try the latest cvs, I
> have already committed the needed change. Hopefully it does do the
> right thing for you.
It does. Well done.
Regards,
David
--
David Wheeler AIM: dwTheory
david@kineticode.com ICQ: 15726394
http://kineticode.com/ Yahoo!: dew7e
Jabber: Theory@jabber.org
Kineticode. Setting knowledge in motion.[sm]
Re: resolving Apache::Test vs. Apache::test collision
Posted by Stas Bekman <st...@stason.org>.
> Now just awaiting a confirmation from David and I'll put Apache::Test
> 1.03 on CPAN.
David, if you see this before tomorrow, simpy try the latest cvs, I have
already committed the needed change. Hopefully it does do the right thing for you.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: resolving Apache::Test vs. Apache::test collision
Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Tue, 17 Jun 2003, Stas Bekman wrote:
>
> [ .. ]
>
>>David, please test this patch. This version performs the
>>cleanup only during 'make install'. what I'm not sure about is
>>whether it handles correctly some weird paths when creating the
>>packlist. I think it should work, since nothing is passed via
>>shell, but goes perl-2-perl.
>
> [ .. ]
>
> I had problems applying the original patch to httpd-test;
> manually applying it worked except for an error about
> a missing string terminator in the nuke_Apache__test target
> (Win32 is picky about using quotes within commands).
> This diff:
[...]
> worked for me on Win32 in uninstalling an existing test.pm in all
> possible @INC locations before installing the new Test.pm.
Thank you, Randy. I've committed your fixed version. It works for me as well.
Now just awaiting a confirmation from David and I'll put Apache::Test 1.03 on
CPAN.
--
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: resolving Apache::Test vs. Apache::test collision
Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Tue, 17 Jun 2003, Stas Bekman wrote:
[ .. ]
> David, please test this patch. This version performs the
> cleanup only during 'make install'. what I'm not sure about is
> whether it handles correctly some weird paths when creating the
> packlist. I think it should work, since nothing is passed via
> shell, but goes perl-2-perl.
[ .. ]
I had problems applying the original patch to httpd-test;
manually applying it worked except for an error about
a missing string terminator in the nuke_Apache__test target
(Win32 is picky about using quotes within commands).
This diff:
===================================================================
Index: Makefile.PL
===================================================================
RCS file: /home/cvspublic/httpd-test/perl-framework/Apache-Test/Makefile.PL,v
retrieving revision 1.8
diff -u -r1.8 Makefile.PL
--- Makefile.PL 29 Apr 2003 06:37:47 -0000 1.8
+++ Makefile.PL 18 Jun 2003 02:38:58 -0000
@@ -1,16 +1,21 @@
use 5.005;
+use strict;
+
use ExtUtils::MakeMaker;
use Symbol;
use lib qw(lib);
my $VERSION;
+use File::Spec::Functions qw(catfile catdir);
use Apache::Test5005compat;
use Apache::TestMM qw(test); #enable 'make test'
+my $cleanup_packlist = ".mypacklist";
+
Apache::TestMM::filter_args();
my @scripts = qw(t/TEST);
@@ -21,6 +26,8 @@
set_version();
+nuke_Apache__test();
+
WriteMakefile(
NAME => 'Apache::Test',
VERSION => $VERSION,
@@ -59,3 +66,74 @@
return $string;
}
+
+# on Case-Insensitive systems Apache/Test.pm can't coexist with
+# Apache/test.pm, since Apache::test is now deprecated (was renamed to
+# Apache/testold.pm in mod_perl 1.28, we need to find and remove any
+# occurrences of this file. CPAN authors should
+# s/Apache::test/Apache::testold/ and can either require mod_perl 1.28
+# which already carries it or simply bundle it. The best option is to
+# port the test suite to use Apache::Test which works with both
+# mod_perl generations.
+#
+# we could have done this cleanup only for case-insensitive systems,
+# but I feel that doing it for all systems, will speedup the
+# transitions from Apache::test to either Apache::Test or
+# Apache::testold.
+#
+sub nuke_Apache__test {
+
+ my @convicts = ();
+ foreach (@INC) {
+ my $dir = catdir $_, "Apache";
+ next unless -d $dir;
+ opendir DIR, $dir or die "Cannot opendir $dir: $!\n";
+ my @matches = grep /^test.pm$/, readdir DIR;
+ closedir DIR;
+ push @convicts, map { catfile $dir, $_ } @matches if @matches;
+ }
+
+ if (@convicts) {
+ print <<EOI;
+!!! Makefile.PL has found old copies of Apache/test.pm which will
+be removed during 'make install' to prevent collisions with Apache::Test:
+
+@{[join "\n", @convicts]}
+
+CPAN authors are advised to either use Apache::testold or port their
+test suite to Apache::Test which works with both mod_perl generations.
+EOI
+ }
+
+ open PACKLIST, ">$cleanup_packlist"
+ or die "Can't open $cleanup_packlist: $!";
+ print PACKLIST join "", map "$_\n", @convicts;
+ close PACKLIST;
+}
+
+sub MY::install {
+ my $self = shift;
+
+ my $string = $self->MM::install(@_);
+ add_dep(\$string, pure_install => 'nuke_Apache__test');
+
+ $string;
+}
+
+sub MY::top_targets {
+ my $self = shift;
+ my $string = $self->MY::top_targets;
+
+ $string .= <<EOF;
+
+nuke_Apache__test:
+\t\$(PERLRUN) -MExtUtils::Install -e "uninstall(qq{$cleanup_packlist}, 1, 0)"
+EOF
+
+ $string;
+}
+
+sub add_dep {
+ my($string, $targ, $add) = @_;
+ $$string =~ s/($targ\s+::)/$1 $add/;
+}
=================================================================
worked for me on Win32 in uninstalling an existing test.pm in all
possible @INC locations before installing the new Test.pm.
Thanks, Stas.
--
best regards,
randy
Re: resolving Apache::Test vs. Apache::test collision
Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> David Wheeler wrote:
>
>> On Monday, June 16, 2003, at 08:02 PM, Stas Bekman wrote:
>>
>>> Any idea why has it failed to delete the file? I've copied the code
>>> from forceunlink sub in MakeMaker (which is called on UNINST=1), it
>>> changes the mode to 0666 and then attempts to delete the file.
>>
>>
>>
>> Because I ran it as a non-root user.
>
>
> This makes sense :) so it doesn't fit the idiom:
>
> % perl Makefile.PL
> % make
> % make test
> % su
> % make install
>
> in that case we need to override the 'make install' target to delete the
> files. instead of doind that during 'perl Makefile.PL'.
David, please test this patch. This version performs the cleanup only during
'make install'. what I'm not sure about is whether it handles correctly some
weird paths when creating the packlist. I think it should work, since nothing
is passed via shell, but goes perl-2-perl.
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/Makefile.PL,v
retrieving revision 1.8
diff -u -r1.8 Makefile.PL
--- Makefile.PL 29 Apr 2003 06:37:47 -0000 1.8
+++ Makefile.PL 17 Jun 2003 02:51:17 -0000
@@ -1,5 +1,7 @@
use 5.005;
+use strict;
+
use ExtUtils::MakeMaker;
use Symbol;
@@ -7,10 +9,14 @@
my $VERSION;
+use File::Spec::Functions qw(catfile catdir);
+
use Apache::Test5005compat;
use Apache::TestMM qw(test); #enable 'make test'
+my $cleanup_packlist = ".mypacklist";
+
Apache::TestMM::filter_args();
my @scripts = qw(t/TEST);
@@ -21,6 +27,8 @@
set_version();
+nuke_Apache__test();
+
WriteMakefile(
NAME => 'Apache::Test',
VERSION => $VERSION,
@@ -59,3 +67,74 @@
return $string;
}
+
+# on Case-Insensitive systems Apache/Test.pm can't coexist with
+# Apache/test.pm, since Apache::test is now deprecated (was renamed to
+# Apache/testold.pm in mod_perl 1.28, we need to find and remove any
+# occurrences of this file. CPAN authors should
+# s/Apache::test/Apache::testold/ and can either require mod_perl 1.28
+# which already carries it or simply bundle it. The best option is to
+# port the test suite to use Apache::Test which works with both
+# mod_perl generations.
+#
+# we could have done this cleanup only for case-insensitive systems,
+# but I feel that doing it for all systems, will speedup the
+# transitions from Apache::test to either Apache::Test or
+# Apache::testold.
+#
+sub nuke_Apache__test {
+
+ my @convicts = ();
+ foreach (@INC) {
+ my $dir = catdir $_, "Apache";
+ next unless -d $dir;
+ opendir DIR, $dir or die "Cannot opendir $dir: $!\n";
+ my @matches = grep /^test.pm$/, readdir DIR;
+ closedir DIR;
+ push @convicts, map { catfile $dir, $_ } @matches if @matches;
+ }
+
+ if (@convicts) {
+ print <<EOI;
+!!! Makefile.PL has found old copies of Apache/test.pm which will
+be removed during 'make install' to prevent collisions with Apache::Test:
+
+@{[join "\n", @convicts]}
+
+CPAN authors are advised to either use Apache::testold or port their
+test suite to Apache::Test which works with both mod_perl generations.
+EOI
+ }
+
+ open PACKLIST, ">$cleanup_packlist"
+ or die "Can't open $cleanup_packlist: $!";
+ print PACKLIST join "", map "$_\n", @convicts;
+ close PACKLIST;
+}
+
+sub MY::install {
+ my $self = shift;
+
+ my $string = $self->MM::install(@_);
+ add_dep(\$string, pure_install => 'nuke_Apache__test');
+
+ $string;
+}
+
+sub MY::top_targets {
+ my $self = shift;
+ my $string = $self->MY::top_targets;
+
+ $string .= <<EOF;
+
+nuke_Apache__test:
+\t\$(PERLRUN) -MExtUtils::Install -e 'uninstall("$cleanup_packlist", 1, 0)'
+EOF
+
+ $string;
+}
+
+sub add_dep {
+ my($string, $targ, $add) = @_;
+ $$string =~ s/($targ\s+::)/$1 $add/;
+}
Re: resolving Apache::Test vs. Apache::test collision
Posted by Stas Bekman <st...@stason.org>.
David Wheeler wrote:
> On Monday, June 16, 2003, at 08:02 PM, Stas Bekman wrote:
>
>> Any idea why has it failed to delete the file? I've copied the code
>> from forceunlink sub in MakeMaker (which is called on UNINST=1), it
>> changes the mode to 0666 and then attempts to delete the file.
>
>
> Because I ran it as a non-root user.
This makes sense :) so it doesn't fit the idiom:
% perl Makefile.PL
% make
% make test
% su
% make install
in that case we need to override the 'make install' target to delete the
files. instead of doind that during 'perl Makefile.PL'.
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: resolving Apache::Test vs. Apache::test collision
Posted by David Wheeler <da...@wheeler.net>.
On Monday, June 16, 2003, at 08:02 PM, Stas Bekman wrote:
> Any idea why has it failed to delete the file? I've copied the code
> from forceunlink sub in MakeMaker (which is called on UNINST=1), it
> changes the mode to 0666 and then attempts to delete the file.
Because I ran it as a non-root user.
David
--
David Wheeler AIM: dwTheory
david@kineticode.com ICQ: 15726394
http://kineticode.com/ Yahoo!: dew7e
Jabber: Theory@jabber.org
Kineticode. Setting knowledge in motion.[sm]
Re: resolving Apache::Test vs. Apache::test collision
Posted by Stas Bekman <st...@stason.org>.
David Wheeler wrote:
> On Monday, June 16, 2003, at 02:42 AM, Stas Bekman wrote:
>
>> OK, here is the patch that nukes Apache/test.pm. Please test it on
>> case-insensitive systems (if you don't have Apache/test.pm, please add
>> it just to test). Once you confirm that it works, I release
>> Apache::Test 1.03, so we can go ahead with the new libapreq release.
>
>
> Applied to CVS copy.
>
> If this is what you mean, it should work:
>
> mercury% perl Makefile.PL
> generating script t/TEST
> Makefile.PL has found old copies of Apache/test.pm which will
> be removed to prevent collisions with Apache::Test.
>
> CPAN authors are advised to either use Apache::testold or port their
> test suite to Apache::Test which works with both mod_perl generations.
> unlink /usr/local/lib/perl5/site_perl/5.8.0/darwin/Apache/test.pm
> !!! Failed to delete
> /usr/local/lib/perl5/site_perl/5.8.0/darwin/Apache/test.pm, please make
> sure to delete
> /usr/local/lib/perl5/site_perl/5.8.0/darwin/Apache/test.pm at
> Makefile.PL line 106.
> Checking if your kit is complete...
> Looks good
> Writing Makefile for Apache::Test
>
> So I deleted /usr/local/lib/perl5/site_perl/5.8.0/darwin/Apache/test.pm
> and all is well.
Any idea why has it failed to delete the file? I've copied the code from
forceunlink sub in MakeMaker (which is called on UNINST=1), it changes the
mode to 0666 and then attempts to delete the file.
> Gonna try to carve out some time this week to port
> MasonX::ApacheHandler::WithCallbacks to Apache::Test :-)
Cool!
__________________________________________________________________
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Re: resolving Apache::Test vs. Apache::test collision
Posted by David Wheeler <da...@wheeler.net>.
On Monday, June 16, 2003, at 02:42 AM, Stas Bekman wrote:
> OK, here is the patch that nukes Apache/test.pm. Please test it on
> case-insensitive systems (if you don't have Apache/test.pm, please add
> it just to test). Once you confirm that it works, I release
> Apache::Test 1.03, so we can go ahead with the new libapreq release.
Applied to CVS copy.
If this is what you mean, it should work:
mercury% perl Makefile.PL
generating script t/TEST
Makefile.PL has found old copies of Apache/test.pm which will
be removed to prevent collisions with Apache::Test.
CPAN authors are advised to either use Apache::testold or port their
test suite to Apache::Test which works with both mod_perl generations.
unlink /usr/local/lib/perl5/site_perl/5.8.0/darwin/Apache/test.pm
!!! Failed to delete
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Apache/test.pm, please make
sure to delete
/usr/local/lib/perl5/site_perl/5.8.0/darwin/Apache/test.pm at
Makefile.PL line 106.
Checking if your kit is complete...
Looks good
Writing Makefile for Apache::Test
So I deleted /usr/local/lib/perl5/site_perl/5.8.0/darwin/Apache/test.pm
and all is well.
Gonna try to carve out some time this week to port
MasonX::ApacheHandler::WithCallbacks to Apache::Test :-)
Regards,
David
--
David Wheeler AIM: dwTheory
david@kineticode.com ICQ: 15726394
http://kineticode.com/ Yahoo!: dew7e
Jabber: Theory@jabber.org
Kineticode. Setting knowledge in motion.[sm]