Update Module::Install and Module::Install::RTx
authorEmmanuel Lacour <elacour@home-dn.net>
Tue, 16 Sep 2008 13:25:28 +0000 (13:25 +0000)
committerEmmanuel Lacour <elacour@home-dn.net>
Tue, 16 Sep 2008 13:25:28 +0000 (13:25 +0000)
inc/Module/Install.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
inc/Module/Install/Fetch.pm
inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
inc/Module/Install/RTx.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm

index 052cf1e..eb449ca 100644 (file)
@@ -30,7 +30,7 @@ BEGIN {
        # This is not enforced yet, but will be some time in the next few
        # releases once we can make sure it won't clash with custom
        # Module::Install extensions.
-       $VERSION = '0.72';
+       $VERSION = '0.77';
 
        *inc::Module::Install::VERSION = *VERSION;
        @inc::Module::Install::ISA     = __PACKAGE__;
@@ -85,7 +85,7 @@ END_DIE
 
 # Build.PL was formerly supported, but no longer is due to excessive
 # difficulty in implementing every single feature twice.
-if ( $0 =~ /Build.PL$/i or -f 'Build.PL' ) { die <<"END_DIE" }
+if ( $0 =~ /Build.PL$/i ) { die <<"END_DIE" }
 
 Module::Install no longer supports Build.PL.
 
@@ -125,8 +125,10 @@ sub autoload {
                        goto &$code unless $cwd eq $pwd;
                }
                $$sym =~ /([^:]+)$/ or die "Cannot autoload $who - $sym";
-               unshift @_, ( $self, $1 );
-               goto &{$self->can('call')} unless uc($1) eq $1;
+               unless ( uc($1) eq $1 ) {
+                       unshift @_, ( $self, $1 );
+                       goto &{$self->can('call')};
+               }
        };
 }
 
@@ -339,7 +341,10 @@ sub _write {
        close FH or die "close($_[0]): $!";
 }
 
-sub _version {
+# _version is for processing module versions (eg, 1.03_05) not
+# Perl versions (eg, 5.8.1).
+
+sub _version ($) {
        my $s = shift || 0;
           $s =~ s/^(\d+)\.?//;
        my $l = $1 || 0;
@@ -348,6 +353,17 @@ sub _version {
        return $l + 0;
 }
 
+# Cloned from Params::Util::_CLASS
+sub _CLASS ($) {
+       (
+               defined $_[0]
+               and
+               ! ref $_[0]
+               and
+               $_[0] =~ m/^[^\W\d]\w*(?:::\w+)*$/s
+       ) ? $_[0] : undef;
+}
+
 1;
 
 # Copyright 2008 Adam Kennedy.
index 7fd0189..433ebed 100644 (file)
@@ -1,7 +1,7 @@
 #line 1
 package Module::Install::Base;
 
-$VERSION = '0.72';
+$VERSION = '0.77';
 
 # Suspend handler for "redefined" warnings
 BEGIN {
@@ -45,6 +45,8 @@ sub admin {
     $_[0]->_top->{admin} or Module::Install::Base::FakeAdmin->new;
 }
 
+#line 101
+
 sub is_admin {
     $_[0]->admin->VERSION;
 }
@@ -67,4 +69,4 @@ BEGIN {
 
 1;
 
-#line 138
+#line 146
index 002869f..9025607 100644 (file)
@@ -1,3 +1,4 @@
+#line 1
 package Module::Install::Can;
 
 use strict;
@@ -10,7 +11,7 @@ use ExtUtils::MakeMaker ();
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.72';
+       $VERSION = '0.77';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
@@ -38,6 +39,7 @@ sub can_run {
        return $_cmd if (-x $_cmd or $_cmd = MM->maybe_command($_cmd));
 
        for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
+               next if $dir eq '';
                my $abs = File::Spec->catfile($dir, $_[1]);
                return $abs if (-x $abs or $abs = MM->maybe_command($abs));
        }
@@ -78,80 +80,4 @@ if ( $^O eq 'cygwin' ) {
 
 __END__
 
-=pod
-
-=head1 NAME
-
-Module::Install::Can - Utility functions for capability detection
-
-=head1 DESCRIPTION
-
-C<Module::Install::Can> contains a number of functions for authors to use
-when creating customised smarter installers. The functions simplify
-standard tests so that you can express your dependencies and conditions
-much more simply, and make your installer much easier to maintain.
-
-=head1 COMMANDS
-
-=head2 can_use
-
-  can_use('Module::Name');
-  can_use('Module::Name', 1.23);
-
-The C<can_use> function tests the ability to load a specific named
-module. Currently it will also actually load the module in the
-process, although this may change in the future.
-
-Takes an optional second param of a version number. The currently
-installed version of the module will be tested to make sure it is
-equal to or greater than the specified version.
-
-Returns true if the module can be loaded, or false (in both scalar or
-list context) if not.
-
-=head2 can_run
-
-  can_run('cvs');
-
-The C<can_run> function tests the ability to run a named command or
-program on the local system.
-
-Returns true if so, or false (both in scalar and list context) if not.
-
-=head2 can_cc
-
-  can_cc();
-
-The C<can_cc> function test the ability to locate a C compiler on the
-local system. Returns true if the C compiler can be found, or false
-(both in scalar and list context) if not.
-
-=head1 TO DO
-
-Currently, the use of a C<can_foo> command in a single problem domain
-(for example C<can_use>) results in the inclusion of additional
-functionality from different problem domains (for example C<can_run>).
-
-This module should ultimately be broken up, and the individual
-functions redestributed to different domain-specific extensions.
-
-=head1 AUTHORS
-
-Audrey Tang E<lt>autrijus@autrijus.orgE<gt>
-
-Adam Kennedy E<lt>adamk@cpan.orgE<gt>
-
-=head1 SEE ALSO
-
-L<Module::Install>, L<Class::Inspector>
-
-=head1 COPYRIGHT
-
-Copyright 2006 Audrey Tang, Adam Kennedy.
-
-This program is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
-
-See L<http://www.perl.com/perl/misc/Artistic.html>
-
-=cut
+#line 158
index 14cc5a7..d66aba5 100644 (file)
@@ -1,3 +1,4 @@
+#line 1
 package Module::Install::Fetch;
 
 use strict;
@@ -5,7 +6,7 @@ use Module::Install::Base;
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.72';
+       $VERSION = '0.77';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
index e747945..92cd1ef 100644 (file)
@@ -1,3 +1,4 @@
+#line 1
 package Module::Install::Makefile;
 
 use strict 'vars';
@@ -6,7 +7,7 @@ use ExtUtils::MakeMaker ();
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.72';
+       $VERSION = '0.77';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
@@ -35,9 +36,9 @@ sub prompt {
 
 sub makemaker_args {
        my $self = shift;
-       my $args = ($self->{makemaker_args} ||= {});
-         %$args = ( %$args, @_ ) if @_;
-       $args;
+       my $args = ( $self->{makemaker_args} ||= {} );
+       %$args = ( %$args, @_ );
+       return $args;
 }
 
 # For mm args that take multiple space-seperated args,
@@ -115,7 +116,13 @@ sub write {
 
        # Make sure we have a new enough
        require ExtUtils::MakeMaker;
-       $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION );
+
+       # MakeMaker can complain about module versions that include
+       # an underscore, even though its own version may contain one!
+       # Hence the funny regexp to get rid of it.  See RT #35800
+       # for details.
+
+       $self->configure_requires( 'ExtUtils::MakeMaker' => $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/ );
 
        # Generate the 
        my $args = $self->makemaker_args;
@@ -174,7 +181,9 @@ sub write {
 
        my $user_preop = delete $args{dist}->{PREOP};
        if (my $preop = $self->admin->preop($user_preop)) {
-               $args{dist} = $preop;
+               foreach my $key ( keys %$preop ) {
+                       $args{dist}->{$key} = $preop->{$key};
+               }
        }
 
        my $mm = ExtUtils::MakeMaker::WriteMakefile(%args);
@@ -241,131 +250,4 @@ sub postamble {
 
 __END__
 
-=pod
-
-=head1 NAME
-
-Module::Install::MakeMaker - Extension Rules for ExtUtils::MakeMaker
-
-=head1 SYNOPSIS
-
-In your F<Makefile.PL>:
-
-    use inc::Module::Install;
-    WriteMakefile();
-
-=head1 DESCRIPTION
-
-This module is a wrapper around B<ExtUtils::MakeMaker>.  It exports
-two functions: C<prompt> (an alias for C<ExtUtils::MakeMaker::prompt>)
-and C<WriteMakefile>.
-
-The C<WriteMakefile> function will pass on keyword/value pair functions
-to C<ExtUtils::MakeMaker::WriteMakefile>. The required parameters
-C<NAME> and C<VERSION> (or C<VERSION_FROM>) are not necessary if
-it can find them unambiguously in your code.
-
-=head1 CONFIGURATION OPTIONS
-
-This module also adds some Configuration parameters of its own:
-
-=head2 NAME
-
-The NAME parameter is required by B<ExtUtils::MakeMaker>. If you have a
-single module in your distribution, or if the module name indicated by
-the current directory exists under F<lib/>, this module will use the
-guessed package name as the default.
-
-If this module can't find a default for C<NAME> it will ask you to specify
-it manually.
-
-=head2 VERSION
-
-B<ExtUtils::MakeMaker> requires either the C<VERSION> or C<VERSION_FROM>
-parameter.  If this module can guess the package's C<NAME>, it will attempt
-to parse the C<VERSION> from it.
-
-If this module can't find a default for C<VERSION> it will ask you to
-specify it manually.
-
-=head1 MAKE TARGETS
-
-B<ExtUtils::MakeMaker> provides you with many useful C<make> targets. A
-C<make> B<target> is the word you specify after C<make>, like C<test>
-for C<make test>. Some of the more useful targets are:
-
-=over 4
-
-=item * all
-
-This is the default target. When you type C<make> it is the same as
-entering C<make all>. This target builds all of your code and stages it
-in the C<blib> directory.
-
-=item * test
-
-Run your distribution's test suite.
-
-=item * install
-
-Copy the contents of the C<blib> directory into the appropriate
-directories in your Perl installation.
-
-=item * dist
-
-Create a distribution tarball, ready for uploading to CPAN or sharing
-with a friend.
-
-=item * clean distclean purge
-
-Remove the files created by C<perl Makefile.PL> and C<make>.
-
-=item * help
-
-Same as typing C<perldoc ExtUtils::MakeMaker>.
-
-=back
-
-This module modifies the behaviour of some of these targets, depending
-on your requirements, and also adds the following targets to your Makefile:
-
-=over 4
-
-=item * cpurge
-
-Just like purge, except that it also deletes the files originally added
-by this module itself.
-
-=item * chelp
-
-Short cut for typing C<perldoc Module::Install>.
-
-=item * distsign
-
-Short cut for typing C<cpansign -s>, for B<Module::Signature> users to
-sign the distribution before release.
-
-=back
-
-=head1 SEE ALSO
-
-L<Module::Install>, L<CPAN::MakeMaker>, L<CPAN::MakeMaker::Philosophy>
-
-=head1 AUTHORS
-
-Audrey Tang E<lt>autrijus@autrijus.orgE<gt>
-
-Based on original works by Brian Ingerson E<lt>INGY@cpan.orgE<gt>
-
-=head1 COPYRIGHT
-
-Copyright 2002, 2003, 2004 by
-Audrey Tang E<lt>autrijus@autrijus.orgE<gt>,
-Brian Ingerson E<lt>ingy@cpan.orgE<gt>
-
-This program is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
-
-See L<http://www.perl.com/perl/misc/Artistic.html>
-
-=cut
+#line 379
index 7acf8fd..397fb97 100644 (file)
@@ -1,3 +1,4 @@
+#line 1
 package Module::Install::Metadata;
 
 use strict 'vars';
@@ -5,7 +6,7 @@ use Module::Install::Base;
 
 use vars qw{$VERSION $ISCORE @ISA};
 BEGIN {
-       $VERSION = '0.72';
+       $VERSION = '0.77';
        $ISCORE  = 1;
        @ISA     = qw{Module::Install::Base};
 }
@@ -16,9 +17,7 @@ my @scalar_keys = qw{
        abstract
        author
        version
-       license
        distribution_type
-       perl_version
        tests
        installdirs
 };
@@ -29,13 +28,21 @@ my @tuple_keys = qw{
        requires
        recommends
        bundles
+       resources
+};
+
+my @resource_keys = qw{
+       homepage
+       bugtracker
+       repository
 };
 
-sub Meta            { shift        }
-sub Meta_ScalarKeys { @scalar_keys }
-sub Meta_TupleKeys  { @tuple_keys  }
+sub Meta              { shift          }
+sub Meta_ScalarKeys   { @scalar_keys   }
+sub Meta_TupleKeys    { @tuple_keys    }
+sub Meta_ResourceKeys { @resource_keys }
 
-foreach my $key (@scalar_keys) {
+foreach my $key ( @scalar_keys ) {
        *$key = sub {
                my $self = shift;
                return $self->{values}{$key} if defined wantarray and !@_;
@@ -44,12 +51,30 @@ foreach my $key (@scalar_keys) {
        };
 }
 
+foreach my $key ( @resource_keys ) {
+       *$key = sub {
+               my $self = shift;
+               unless ( @_ ) {
+                       return () unless $self->{values}{resources};
+                       return map  { $_->[1] }
+                              grep { $_->[0] eq $key }
+                              @{ $self->{values}{resources} };
+               }
+               return $self->{values}{resources}{$key} unless @_;
+               my $uri = shift or die(
+                       "Did not provide a value to $key()"
+               );
+               $self->resources( $key => $uri );
+               return 1;
+       };
+}
+
 sub requires {
        my $self = shift;
        while ( @_ ) {
                my $module  = shift or last;
                my $version = shift || 0;
-               push @{ $self->{values}->{requires} }, [ $module, $version ];
+               push @{ $self->{values}{requires} }, [ $module, $version ];
        }
        $self->{values}{requires};
 }
@@ -59,7 +84,7 @@ sub build_requires {
        while ( @_ ) {
                my $module  = shift or last;
                my $version = shift || 0;
-               push @{ $self->{values}->{build_requires} }, [ $module, $version ];
+               push @{ $self->{values}{build_requires} }, [ $module, $version ];
        }
        $self->{values}{build_requires};
 }
@@ -69,7 +94,7 @@ sub configure_requires {
        while ( @_ ) {
                my $module  = shift or last;
                my $version = shift || 0;
-               push @{ $self->{values}->{configure_requires} }, [ $module, $version ];
+               push @{ $self->{values}{configure_requires} }, [ $module, $version ];
        }
        $self->{values}{configure_requires};
 }
@@ -79,7 +104,7 @@ sub recommends {
        while ( @_ ) {
                my $module  = shift or last;
                my $version = shift || 0;
-               push @{ $self->{values}->{recommends} }, [ $module, $version ];
+               push @{ $self->{values}{recommends} }, [ $module, $version ];
        }
        $self->{values}{recommends};
 }
@@ -89,11 +114,33 @@ sub bundles {
        while ( @_ ) {
                my $module  = shift or last;
                my $version = shift || 0;
-               push @{ $self->{values}->{bundles} }, [ $module, $version ];
+               push @{ $self->{values}{bundles} }, [ $module, $version ];
        }
        $self->{values}{bundles};
 }
 
+# Resource handling
+my %lc_resource = map { $_ => 1 } qw{
+       homepage
+       license
+       bugtracker
+       repository
+};
+
+sub resources {
+       my $self = shift;
+       while ( @_ ) {
+               my $name  = shift or last;
+               my $value = shift or next;
+               if ( $name eq lc $name and ! $lc_resource{$name} ) {
+                       die("Unsupported reserved lowercase resource '$name'");
+               }
+               $self->{values}{resources} ||= [];
+               push @{ $self->{values}{resources} }, [ $name, $value ];
+       }
+       $self->{values}{resources};
+}
+
 # Aliases for build_requires that will have alternative
 # meanings in some future version of META.yml.
 sub test_requires      { shift->build_requires(@_) }
@@ -107,30 +154,73 @@ sub install_as_vendor  { $_[0]->installdirs('vendor') }
 
 sub sign {
        my $self = shift;
-       return $self->{'values'}{'sign'} if defined wantarray and ! @_;
-       $self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 );
+       return $self->{values}{sign} if defined wantarray and ! @_;
+       $self->{values}{sign} = ( @_ ? $_[0] : 1 );
        return $self;
 }
 
 sub dynamic_config {
        my $self = shift;
        unless ( @_ ) {
-               warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n";
+               warn "You MUST provide an explicit true/false value to dynamic_config\n";
                return $self;
        }
        $self->{values}{dynamic_config} = $_[0] ? 1 : 0;
-       return $self;
+       return 1;
+}
+
+sub perl_version {
+       my $self = shift;
+       return $self->{values}{perl_version} unless @_;
+       my $version = shift or die(
+               "Did not provide a value to perl_version()"
+       );
+
+       # Convert triple-part versions (eg, 5.6.1 or 5.8.9) to
+       # numbers (eg, 5.006001 or 5.008009).
+
+       $version =~ s/^(\d+)\.(\d+)\.(\d+)$/sprintf("%d.%03d%03d",$1,$2,$3)/e;
+
+       $version =~ s/_.+$//;
+       $version = $version + 0; # Numify
+       unless ( $version >= 5.005 ) {
+               die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
+       }
+       $self->{values}{perl_version} = $version;
+       return 1;
+}
+
+sub license {
+       my $self = shift;
+       return $self->{values}{license} unless @_;
+       my $license = shift or die(
+               'Did not provide a value to license()'
+       );
+       $self->{values}{license} = $license;
+
+       # Automatically fill in license URLs
+       if ( $license eq 'perl' ) {
+               $self->resources( license => 'http://dev.perl.org/licenses/' );
+       }
+
+       return 1;
 }
 
 sub all_from {
        my ( $self, $file ) = @_;
 
        unless ( defined($file) ) {
-               my $name = $self->name
-                       or die "all_from called with no args without setting name() first";
+               my $name = $self->name or die(
+                       "all_from called with no args without setting name() first"
+               );
                $file = join('/', 'lib', split(/-/, $name)) . '.pm';
                $file =~ s{.*/}{} unless -e $file;
-               die "all_from: cannot find $file from $name" unless -e $file;
+               unless ( -e $file ) {
+                       die("all_from cannot find $file from $name");
+               }
+       }
+       unless ( -f $file ) {
+               die("The path '$file' does not exist, or is not a file");
        }
 
        # Some methods pull from POD instead of code.
@@ -209,8 +299,8 @@ sub features {
        while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) {
                $self->feature( $name, @$mods );
        }
-       return $self->{values}->{features}
-               ? @{ $self->{values}->{features} }
+       return $self->{values}{features}
+               ? @{ $self->{values}{features} }
                : ();
 }
 
@@ -266,22 +356,25 @@ sub abstract_from {
         );
 }
 
+# Add both distribution and module name
 sub name_from {
-       my $self = shift;
+       my ($self, $file) = @_;
        if (
-               Module::Install::_read($_[0]) =~ m/
+               Module::Install::_read($file) =~ m/
                ^ \s*
                package \s*
                ([\w:]+)
                \s* ;
                /ixms
        ) {
-               my $name = $1;
+               my ($name, $module_name) = ($1, $1);
                $name =~ s{::}{-}g;
                $self->name($name);
+               unless ( $self->module_name ) {
+                       $self->module_name($module_name);
+               }
        } else {
-               die "Cannot determine name from $_[0]\n";
-               return;
+               die("Cannot determine name from $file\n");
        }
 }
 
@@ -290,7 +383,7 @@ sub perl_version_from {
        if (
                Module::Install::_read($_[0]) =~ m/
                ^
-               use \s*
+               (?:use|require) \s*
                v?
                ([\d_\.]+)
                \s* ;
@@ -340,8 +433,12 @@ sub license_from {
                my $license_text = $1;
                my @phrases      = (
                        'under the same (?:terms|license) as perl itself' => 'perl',        1,
+                       'GNU general public license'                      => 'gpl',         1,
                        'GNU public license'                              => 'gpl',         1,
+                       'GNU lesser general public license'               => 'lgpl',        1,
                        'GNU lesser public license'                       => 'lgpl',        1,
+                       'GNU library general public license'              => 'lgpl',        1,
+                       'GNU library public license'                      => 'lgpl',        1,
                        'BSD license'                                     => 'bsd',         1,
                        'Artistic license'                                => 'artistic',    1,
                        'GPL'                                             => 'gpl',         1,
@@ -355,7 +452,7 @@ sub license_from {
                        $pattern =~ s{\s+}{\\s+}g;
                        if ( $license_text =~ /\b$pattern\b/i ) {
                                if ( $osi and $license_text =~ /All rights reserved/i ) {
-                                       warn "LEGAL WARNING: 'All rights reserved' may invalidate Open Source licenses. Consider removing it.";
+                                       print "WARNING: 'All rights reserved' in copyright may invalidate Open Source license.\n";
                                }
                                $self->license($license);
                                return 1;
@@ -367,6 +464,24 @@ sub license_from {
        return 'unknown';
 }
 
+sub bugtracker_from {
+       my $self    = shift;
+       my $content = Module::Install::_read($_[0]);
+       my @links   = $content =~ m/L\<(http\:\/\/rt\.cpan\.org\/[^>]+)\>/g;
+       unless ( @links ) {
+               warn "Cannot determine bugtracker info from $_[0]\n";
+               return 0;
+       }
+       if ( @links > 1 ) {
+               warn "Found more than on rt.cpan.org link in $_[0]\n";
+               return 0;
+       }
+
+       # Set the bugtracker
+       bugtracker( $links[0] );
+       return 1;
+}
+
 sub install_script {
        my $self = shift;
        my $args = $self->makemaker_args;
@@ -377,7 +492,7 @@ sub install_script {
                } elsif ( -d 'script' and -f "script/$_" ) {
                        push @$exe, "script/$_";
                } else {
-                       die "Cannot find script '$_'";
+                       die("Cannot find script '$_'");
                }
        }
 }
index c087b12..20a354b 100644 (file)
@@ -8,12 +8,15 @@ no warnings 'once';
 
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.22';
+our $VERSION = '0.24';
 
 use FindBin;
 use File::Glob     ();
 use File::Basename ();
 
+my @DIRS = qw(etc lib html bin sbin po var);
+my @INDEX_DIRS = qw(lib bin sbin);
+
 sub RTx {
     my ( $self, $name ) = @_;
 
@@ -60,8 +63,8 @@ sub RTx {
     $RT::LocalVarPath  ||= $RT::VarPath;
     $RT::LocalPoPath   ||= $RT::LocalLexiconPath;
     $RT::LocalHtmlPath ||= $RT::MasonComponentRoot;
+    $RT::LocalLibPath  ||= "$RT::LocalPath/lib";
 
-    my %path;
     my $with_subdirs = $ENV{WITH_SUBDIRS};
     @ARGV = grep { /WITH_SUBDIRS=(.*)/ ? ( ( $with_subdirs = $1 ), 0 ) : 1 }
         @ARGV;
@@ -69,36 +72,40 @@ sub RTx {
     my %subdirs;
     %subdirs = map { $_ => 1 } split( /\s*,\s*/, $with_subdirs )
         if defined $with_subdirs;
-
-    foreach (qw(bin etc html po sbin var)) {
-        next unless -d "$FindBin::Bin/$_";
-        next if keys %subdirs and !$subdirs{$_};
-        $self->no_index( directory => $_ );
-
-        no strict 'refs';
-        my $varname = "RT::Local" . ucfirst($_) . "Path";
-        $path{$_} = ${$varname} || "$RT::LocalPath/$_";
+    unless ( keys %subdirs ) {
+        $subdirs{$_} = 1 foreach grep -d "$FindBin::Bin/$_", @DIRS;
     }
 
-    $path{$_} .= "/$name" for grep $path{$_}, qw(etc po var);
-    $path{lib} = "$RT::LocalPath/lib" unless keys %subdirs and !$subdirs{'lib'};
-
     # If we're running on RT 3.8 with plugin support, we really wany
     # to install libs, mason templates and po files into plugin specific
     # directories
-    if ($RT::LocalPluginPath) {
-        foreach my $path (qw(lib po html etc bin sbin)) {
-            next unless -d "$FindBin::Bin/$path";
-            next if %subdirs and !$subdirs{$path};
-            $path{$path} = $RT::LocalPluginPath . "/$original_name/$path";
+    my %path;
+    if ( $RT::LocalPluginPath ) {
+        die "Because of bugs in RT 3.8.0 this extension can not be installed.\n"
+            ."Upgrade to RT 3.8.1 or newer.\n" if $RT::VERSION =~ /^3\.8\.0/;
+        $path{$_} = $RT::LocalPluginPath . "/$original_name/$_"
+            foreach @DIRS;
+    } else {
+        foreach ( @DIRS ) {
+            no strict 'refs';
+            my $varname = "RT::Local" . ucfirst($_) . "Path";
+            $path{$_} = ${$varname} || "$RT::LocalPath/$_";
         }
+
+        $path{$_} .= "/$name" for grep $path{$_}, qw(etc po var);
     }
 
-    my $args = join( ', ', map "q($_)", %path );
-    print "./$_\t=> $path{$_}\n" for sort keys %path;
+    my %index = map { $_ => 1 } @INDEX_DIRS;
+    $self->no_index( directory => $_ ) foreach grep !$index{$_}, @DIRS;
+
+    my $args = join ', ', map "q($_)", map { ($_, $path{$_}) }
+        grep $subdirs{$_}, keys %path;
 
-    if ( my @dirs = map { ( -D => $_ ) } grep $path{$_}, qw(bin html sbin) ) {
-        my @po = map { ( -o => $_ ) } grep -f,
+    print "./$_\t=> $path{$_}\n" for sort keys %subdirs;
+
+    if ( my @dirs = map { ( -D => $_ ) } grep $subdirs{$_}, qw(bin html sbin) ) {
+        my @po = map { ( -o => $_ ) }
+            grep -f,
             File::Glob::bsd_glob("po/*.po");
         $self->postamble(<< ".") if @po;
 lexicons ::
@@ -111,7 +118,7 @@ install ::
 \t\$(NOECHO) \$(PERL) -MExtUtils::Install -e \"install({$args})\"
 .
 
-    if ( $path{var} and -d $RT::MasonDataDir ) {
+    if ( $subdirs{var} and -d $RT::MasonDataDir ) {
         my ( $uid, $gid ) = ( stat($RT::MasonDataDir) )[ 4, 5 ];
         $postamble .= << ".";
 \t\$(NOECHO) chown -R $uid:$gid $path{var}
@@ -139,16 +146,17 @@ dropdb ::
     if ( -e 'etc/initialdata' ) { $has_etc{initialdata}++; }
 
     $self->postamble("$postamble\n");
-    if ( %subdirs and !$subdirs{'lib'} ) {
+    unless ( $subdirs{'lib'} ) {
         $self->makemaker_args( PM => { "" => "" }, );
     } else {
-        $self->makemaker_args( INSTALLSITELIB => "$RT::LocalPath/lib" );
+        $self->makemaker_args( INSTALLSITELIB => $path{'lib'} );
+        $self->makemaker_args( INSTALLARCHLIB => $path{'lib'} );
     }
 
-        $self->makemaker_args( INSTALLSITEMAN1DIR => "$RT::LocalPath/man/man1" );
-        $self->makemaker_args( INSTALLSITEMAN3DIR => "$RT::LocalPath/man/man3" );
-        $self->makemaker_args( INSTALLSITEARCH => "$RT::LocalPath/man" );
-        $self->makemaker_args( INSTALLARCHLIB => "$RT::LocalPath/lib" );
+    $self->makemaker_args( INSTALLSITEMAN1DIR => "$RT::LocalPath/man/man1" );
+    $self->makemaker_args( INSTALLSITEMAN3DIR => "$RT::LocalPath/man/man3" );
+    $self->makemaker_args( INSTALLSITEARCH => "$RT::LocalPath/man" );
+
     if (%has_etc) {
         $self->load('RTxInitDB');
         print "For first-time installation, type 'make initdb'.\n";
@@ -180,4 +188,4 @@ sub RTxInit {
 
 __END__
 
-#line 281
+#line 302
index 98916b8..cff76a2 100644 (file)
@@ -1,3 +1,4 @@
+#line 1
 package Module::Install::Win32;
 
 use strict;
@@ -5,7 +6,7 @@ use Module::Install::Base;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-       $VERSION = '0.72';
+       $VERSION = '0.77';
        @ISA     = qw{Module::Install::Base};
        $ISCORE  = 1;
 }
index 2171295..f35620f 100644 (file)
@@ -1,3 +1,4 @@
+#line 1
 package Module::Install::WriteAll;
 
 use strict;
@@ -5,7 +6,7 @@ use Module::Install::Base;
 
 use vars qw{$VERSION @ISA $ISCORE};
 BEGIN {
-       $VERSION = '0.72';
+       $VERSION = '0.77';
        @ISA     = qw{Module::Install::Base};
        $ISCORE  = 1;
 }