Subject: | override makeflags INSTALLDIRS=site when module not in corelist |
There are some modules on cpan which are not core but still
set WriteMakefile argument INSTALLDIRS => q[perl],
The attached patch.CPANPLUS-0.89_07-new.txt will detect this and
override makeflags INSTALLDIRS=site
I've tested this manually with iPretendImInCore-0.01.tar.gz and it
works, but there are some problems:
1) the override is not undone after the module is installed (not sure
where to add this)
2) saving the original makeflags variable doesn't work
3) I didn't write a test file for this patch (i don't know cpanp that well)
4) maybe this protection should be optional, maybe user should be prompted?
5) doesn't deal with MYMETA (even if MYMETA doesn't list INSTALLDIRS
option yet)
Hopefully you can help :)
Thanks
Subject: | iPretendImInCore-0.01.tar.gz |
Message body not shown because it is not plain text.
Subject: | iPretendImInCore-0.01-1257839544.log.txt |
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/Build.PL'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/Changes'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/lib/'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/lib/iPretendImInCore.pm'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/Makefile.PL'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/MANIFEST'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/META.yml'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/README'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/t/'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore-0.01/t/00_load.t'
[MSG] [Mon Nov 9 23:52:18 2009] Extracted 'iPretendImInCore' to '%appdata%\CPANPL~1\5.10.1\build\iPretendImInCore-0.01'
[MSG] [Mon Nov 9 23:52:18 2009] Checking if source files are up to date
[MSG] [Mon Nov 9 23:52:19 2009] Argument "6.55_02" isn't numeric in numeric ge (>=) at %appdata%\CPANPL~1\5.10.1\build\iPretendImInCore-0.01\Makefile.PL line 5.
Checking if your kit is complete...
Looks good
Writing Makefile for iPretendImInCore
[MSG] [Mon Nov 9 23:52:19 2009] DETECTED INSTALLDIRS => q[perl]
[MSG] [Mon Nov 9 23:52:19 2009] Module not in corelist, temporarily appending to makemakerflags INSTALLDIRS=site
[ERROR] [Mon Nov 9 23:52:19 2009] No such key 'originalmakeflags' in field 'conf'
[MSG] [Mon Nov 9 23:52:19 2009] DEFAULT 'filter_prereqs' HANDLER RETURNING 'sub return value'
[MSG] [Mon Nov 9 23:52:22 2009] cp lib/iPretendImInCore.pm blib\lib\iPretendImInCore.pm
[MSG] [Mon Nov 9 23:52:23 2009] MAKE TEST passed: C:\perl\5.10.1\bin\MSWin32-x86-multi-thread\perl.exe "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/00_load.t .. ok
All tests successful.
Files=1, Tests=1, 0 wallclock secs ( 0.06 usr + 0.01 sys = 0.08 CPU)
Result: PASS
[MSG] [Mon Nov 9 23:52:24 2009] Installing C:\perl\site\5.10.1\lib\iPretendImInCore.pm
Appending installation info to c:\perl\5.10.1\lib\MSWin32-x86-multi-thread/perllocal.pod
Subject: | patch.CPANPLUS-0.89_07-new.txt |
diff -ruN CPANPLUS-0.89_07/lib/CPANPLUS/Dist/MM.pm CPANPLUS-0.89_07-new/lib/CPANPLUS/Dist/MM.pm
--- CPANPLUS-0.89_07/lib/CPANPLUS/Dist/MM.pm 2009-11-03 15:34:28.000000000 -0800
+++ CPANPLUS-0.89_07-new/lib/CPANPLUS/Dist/MM.pm 2009-11-13 16:44:25.718750000 -0800
@@ -481,6 +481,16 @@
my %p;
while( local $_ = <$fh> ) {
+ if( my ($installdirs) = m|^[\#]\s+INSTALLDIRS\s+=>\s+q\[(.+?)\]|){
+ msg(loc("DETECTED INSTALLDIRS => q[$installdirs]"));
+ if( $installdirs =~ /^perl$/i and not $self->module_is_supplied_with_perl_core ){
+ msg(loc('Module not in corelist, temporarily appending "INSTALLDIRS=site" to makeflags'));
+ my $makeflags = $conf->get_conf('makeflags');
+ $conf->set_conf( _originalmakeflags => $makeflags );
+ $conf->set_conf( makeflags => "$makeflags INSTALLDIRS=site" );
+ }
+ }
+
my ($found) = m|^[\#]\s+PREREQ_PM\s+=>\s+(.+)|;
next unless $found;