perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/lib/ModPerl TestReport.pm
Date Fri, 12 Dec 2003 07:14:40 GMT
stas        2003/12/11 23:14:40

  Modified:    bin      mp2bug
               .        Makefile.PL Changes
  Added:       lib/ModPerl TestReport.pm
  Log:
  Extend the autogenerated bug report to include information about
  installed modules of special interest (which may aid in understanding
  the bug report), such as CGI.pm, Apache::Request, LWP, etc.
  
  Revision  Changes    Path
  1.2       +2 -2      modperl-2.0/bin/mp2bug
  
  Index: mp2bug
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/bin/mp2bug,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -u -r1.1 -r1.2
  --- mp2bug	10 Apr 2003 02:00:19 -0000	1.1
  +++ mp2bug	12 Dec 2003 07:14:40 -0000	1.2
  @@ -17,5 +17,5 @@
       }
   }
   
  -require Apache::TestReportPerl;
  -Apache::TestReportPerl->new(@ARGV)->run;
  +require ModPerl::TestReport;
  +ModPerl::TestReport->new(@ARGV)->run;
  
  
  
  1.133     +2 -2      modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.132
  retrieving revision 1.133
  diff -u -u -r1.132 -r1.133
  --- Makefile.PL	7 Nov 2003 09:46:56 -0000	1.132
  +++ Makefile.PL	12 Dec 2003 07:14:40 -0000	1.133
  @@ -30,9 +30,9 @@
   use File::Basename 'basename';
   
   use Apache::Build ();
  -use Apache::TestReportPerl ();
   use Apache::TestSmokePerl ();
   use Apache::TestTrace;
  +use ModPerl::TestReport ();
   use ModPerl::TestRun ();
   use ModPerl::Code ();
   use ModPerl::BuildMM ();
  @@ -210,8 +210,8 @@
       $build->save;
   
       ModPerl::TestRun->generate_script;
  +    ModPerl::TestReport->generate_script;
       Apache::TestSmokePerl->generate_script;
  -    Apache::TestReportPerl->generate_script;
   
       my $tables_dir = tables_dir($httpd_version);
   
  
  
  
  1.278     +4 -0      modperl-2.0/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Changes,v
  retrieving revision 1.277
  retrieving revision 1.278
  diff -u -u -r1.277 -r1.278
  --- Changes	12 Dec 2003 05:43:57 -0000	1.277
  +++ Changes	12 Dec 2003 07:14:40 -0000	1.278
  @@ -12,6 +12,10 @@
   
   =item 1.99_12-dev
   
  +Extend the autogenerated bug report to include information about
  +installed modules of special interest (which may aid in understanding
  +the bug report), such as CGI.pm, Apache::Request, LWP, etc. [Stas]
  +
   As the test suite keeps on growing, it takes longer time to
   startup. Change the main test suite timeout to 180 secs for threaded
   mpms and 120 secs for non-threaded ones. [Stas]
  
  
  
  1.1                  modperl-2.0/lib/ModPerl/TestReport.pm
  
  Index: TestReport.pm
  ===================================================================
  package ModPerl::TestReport;
  
  use strict;
  use warnings FATAL => 'all';
  
  use base qw(Apache::TestReportPerl);
  
  my @interesting_packages = qw(
      CGI
      Apache::Request
      mod_perl
      LWP
  );
  
  # we want to see only already installed packages, so skip over
  # modules that are about to be installed
  my @skip_dirs = qw(
      blib/lib
      blib/lib/Apache2
      blib/arch
      blib/arch/Apache2
      lib
  );
  my $skip_dir_str = join '|', map { s|/|[/\\\\]|g; $_ } @skip_dirs;
  my $skip_dir_pat = qr|[/\\]($skip_dir_str)[/\\]*$|;
  
  sub packages {
  
      # search in Apache2/ subdirs too
      eval { require Apache2 };
      my @inc = grep !/$skip_dir_pat/, @INC;
  
      my %packages = ();
      my $max_len = 0;
      for my $package (sort @interesting_packages ) {
          $max_len = length $package if length $package > $max_len;
          my $filename = package2filename($package);
          my @ver = ();
          for my $dir (@inc) {
              my $path = "$dir/$filename";
              if (-e $path) {
                  no warnings 'redefine';
                  my $ver = eval { require $path;
                                   delete $INC{$path};
                                   $package->VERSION;
                           };
                  # two versions could be installed (one under Apache2/)
                  push @{ $packages{$package} }, $ver if $ver;
              }
          }
      }
  
      my @lines = "*** Packages of interest status:\n";
  
      for my $package (sort @interesting_packages) {
          my $vers = exists $packages{$package} 
              ? join ", ", sort @{ $packages{$package} }
              : "-";
          push @lines, sprintf "%-${max_len}s: %s", $package, $vers;
      }
  
      return join "\n", @lines, '';
  }
  
  sub config {
      my $self = shift;
  
      my @report = ();
  
      # core config
      push @report, ModPerl::Config::as_string();
  
      # installed packages
      push @report, $self->packages;
  
      # this report is generated by user/group
  
      return join "\n", @report;
  }
  
  sub package2filename {
      my $package = shift;
      $package =~ s|::|/|g;
      $package .= ".pm";
      return $package;
  }
  
  1;
  
  
  

Mime
View raw message