dougm       02/05/19 12:46:08

  Modified:    .        Makefile.PL
               lib/Apache Build.pm
  Log:
  add some more validation of MP_AP_PREFIX
  
  Revision  Changes    Path
  1.80      +5 -1      modperl-2.0/Makefile.PL
  
  Index: Makefile.PL
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- Makefile.PL       19 May 2002 19:08:11 -0000      1.79
  +++ Makefile.PL       19 May 2002 19:46:08 -0000      1.80
  @@ -124,7 +124,11 @@
       if ($build->{MP_APXS}) {
           debug "Using APXS => $build->{MP_APXS}";
       }
  -    elsif ($build->{MP_AP_PREFIX} and -e $build->apxs(-q => 'INCLUDEDIR')) {
  +    elsif ($build->{MP_AP_PREFIX}) {
  +        if (my $reason = $build->ap_prefix_invalid) {
  +            error "invalid MP_AP_PREFIX: $reason";
  +            exit 1;
  +        }
           debug "Using Apache prefix => $build->{MP_AP_PREFIX}";
       }
       else {
  
  
  
  1.84      +22 -0     modperl-2.0/lib/Apache/Build.pm
  
  Index: Build.pm
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
  retrieving revision 1.83
  retrieving revision 1.84
  diff -u -r1.83 -r1.84
  --- Build.pm  14 May 2002 18:22:05 -0000      1.83
  +++ Build.pm  19 May 2002 19:46:08 -0000      1.84
  @@ -49,6 +49,28 @@
       PREFIX     => '',
   );
   
  +sub ap_prefix_invalid {
  +    my $self = shift;
  +
  +    my $prefix = $self->{MP_AP_PREFIX};
  +
  +    unless (-d $prefix) {
  +        return "$prefix: No such file or directory";
  +    }
  +
  +    my $include_dir = $self->apxs(-q => 'INCLUDEDIR');
  +
  +    unless (-e $include_dir) {
  +        return "include/ directory not found in $prefix";
  +    }
  +
  +    if (-e "$prefix/CHANGES") {
  +        return "$prefix is a build directory (need an install directory)";
  +    }
  +
  +    return '';
  +}
  +
   sub apxs {
       my $self = shift;
   
  
  
  


Reply via email to