httpd-test-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: resolving Apache::Test vs. Apache::test collision
Date Mon, 16 Jun 2003 06:42:31 GMT
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


Mime
View raw message