From: Michael G. Schwern Date: Fri, 6 Jun 2003 18:41:45 +0000 (-0700) Subject: ExtUtils::MakeMaker 6.10_04 -> 6.10_05 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1df8d17976b1cba61ff44907306d0eb746cb4fce;p=p5sagit%2Fp5-mst-13.2.git ExtUtils::MakeMaker 6.10_04 -> 6.10_05 Message-ID: <20030607014145.GB12031@windhund.schwern.org> p4raw-id: //depot/perl@19703 --- diff --git a/lib/ExtUtils/Changes b/lib/ExtUtils/Changes index 65a5555..19f2678 100644 --- a/lib/ExtUtils/Changes +++ b/lib/ExtUtils/Changes @@ -1,3 +1,20 @@ +6.10_05 Fri Jun 6 18:15:30 PDT 2003 + * Documenting META.yml, NO_META + * Documenting the fact that distdir will auto generate META.yml and + alter your manifest. + * Adding META.yml autogeneration to the FAQ + - Recognizing comments with leading whitespace in MANIFESTs better. + - Small ExtUtils::Liblist::Kid problem on VMS (Craig Berry) + * Fixed "make install UNINST=1". Appears to have been broken somewhere + around 6.06_01. + - Documented the fourth argument to ExtUtils::Install::install() + - install() will now honor a PERL5LIB change between ExtUtils::Install + loading and install() running when uninstalling shadows. + - META.yml generation deals gracefully when the MANIFEST is read-only + (Slaven rt.cpan.org 2723) + - Fixing tests on limited dir depth VMS systems by moving the + dummy-install dir one level up (Craig Berry rt.cpan.org 2747) + 6.10_04 Fri May 23 01:13:04 PDT 2003 - Working around BSD threaading bug in version check. [from bleadperl] - Added the Makefile to the dist dependencies. (Slaven Rezic) diff --git a/lib/ExtUtils/Install.pm b/lib/ExtUtils/Install.pm index 1037973..b5ebab6 100644 --- a/lib/ExtUtils/Install.pm +++ b/lib/ExtUtils/Install.pm @@ -13,7 +13,6 @@ $Is_VMS = $^O eq 'VMS'; $Is_MacPerl = $^O eq 'MacOS'; my $splitchar = $^O eq 'VMS' ? '|' : ($^O eq 'os2' || $^O eq 'dos') ? ';' : ':'; -my @PERL_ENV_LIB = split $splitchar, defined $ENV{'PERL5LIB'} ? $ENV{'PERL5LIB'} : $ENV{'PERLLIB'} || ''; my $Inc_uninstall_warn_handler; # install relative to here @@ -56,7 +55,7 @@ perl modules. They are not designed as general purpose tools. =item B install(\%from_to); - install(\%from_to, $verbose, $dont_execute); + install(\%from_to, $verbose, $dont_execute, $uninstall_shadows); Copies each directory tree of %from_to to its corresponding value preserving timestamps and permissions. @@ -70,11 +69,14 @@ on AFS it is quite likely that people are installing to a different directory than the one where the files later appear. If $verbose is true, will print out each file removed. Default is -false. +false. This is "make install VERBINST=1" If $dont_execute is true it will only print what it was going to do without actually doing it. Default is false. +If $uninstall_shadows is true any differing versions throughout @INC +will be uninstalled. This is "make install UNINST=1" + =cut sub install { @@ -147,11 +149,13 @@ sub install { find(sub { my ($mode,$size,$atime,$mtime) = (stat)[2,7,8,9]; return unless -f _; - return if $_ eq ".exists"; + + my $origfile = $_; + return if $origfile eq ".exists"; my $targetdir = File::Spec->catdir($targetroot, $File::Find::dir); - my $targetfile = File::Spec->catfile($targetdir, $_); + my $targetfile = File::Spec->catfile($targetdir, $origfile); my $sourcedir = File::Spec->catdir($source, $File::Find::dir); - my $sourcefile = File::Spec->catfile($sourcedir, $_); + my $sourcefile = File::Spec->catfile($sourcedir, $origfile); my $save_cwd = cwd; chdir $cwd; # in case the target is relative @@ -326,9 +330,14 @@ sub uninstall { } sub inc_uninstall { - my($file,$libdir,$verbose,$nonono) = @_; + my($filepath,$libdir,$verbose,$nonono) = @_; my($dir); + my $file = (File::Spec->splitpath($filepath))[2]; my %seen_dir = (); + + my @PERL_ENV_LIB = split $splitchar, defined $ENV{'PERL5LIB'} + ? $ENV{'PERL5LIB'} : $ENV{'PERLLIB'} || ''; + foreach $dir (@INC, @PERL_ENV_LIB, @Config{qw(archlibexp privlibexp sitearchexp @@ -342,9 +351,9 @@ sub inc_uninstall { # know, which is the file we just installed (AFS). So we leave # an identical file in place my $diff = 0; - if ( -f $targetfile && -s _ == -s $file) { + if ( -f $targetfile && -s _ == -s $filepath) { # We have a good chance, we can skip this one - $diff = compare($file,$targetfile); + $diff = compare($filepath,$targetfile); } else { print "#$file and $targetfile differ\n" if $verbose>1; $diff++; @@ -370,6 +379,7 @@ sub inc_uninstall { sub run_filter { my ($cmd, $src, $dest) = @_; + local(*CMD, *SRC); open(CMD, "|$cmd >$dest") || die "Cannot fork: $!"; open(SRC, $src) || die "Cannot open $src: $!"; my $buf; diff --git a/lib/ExtUtils/Liblist/Kid.pm b/lib/ExtUtils/Liblist/Kid.pm index 5d05680..6544509 100644 --- a/lib/ExtUtils/Liblist/Kid.pm +++ b/lib/ExtUtils/Liblist/Kid.pm @@ -8,6 +8,7 @@ package ExtUtils::Liblist::Kid; use 5.00503; # Broken out of MakeMaker from version 4.11 +use strict; use vars qw($VERSION); $VERSION = 1.30; @@ -456,7 +457,7 @@ sub _vms_ext { $lib = $libmap{$lib}; } - my(@variants,$variant,$name,$test,$cand); + my(@variants,$variant,$cand); my($ctype) = ''; # If we don't have a file type, consider it a possibly abbreviated name and @@ -470,44 +471,49 @@ sub _vms_ext { push(@variants,$lib); warn "Looking for $lib\n" if $verbose; foreach $variant (@variants) { + my($fullname, $name); + foreach $dir (@dirs) { my($type); $name = "$dir$variant"; warn "\tChecking $name\n" if $verbose > 2; - if (-f ($test = VMS::Filespec::rmsexpand($name))) { + $fullname = VMS::Filespec::rmsexpand($name); + if (defined $fullname and -f $fullname) { # It's got its own suffix, so we'll have to figure out the type - if ($test =~ /(?:$so|exe)$/i) { $type = 'SHR'; } - elsif ($test =~ /(?:$lib_ext|olb)$/i) { $type = 'OLB'; } - elsif ($test =~ /(?:$obj_ext|obj)$/i) { + if ($fullname =~ /(?:$so|exe)$/i) { $type = 'SHR'; } + elsif ($fullname =~ /(?:$lib_ext|olb)$/i) { $type = 'OLB'; } + elsif ($fullname =~ /(?:$obj_ext|obj)$/i) { warn "Note (probably harmless): " - ."Plain object file $test found in library list\n"; + ."Plain object file $fullname found in library list\n"; $type = 'OBJ'; } else { warn "Note (probably harmless): " - ."Unknown library type for $test; assuming shared\n"; + ."Unknown library type for $fullname; assuming shared\n"; $type = 'SHR'; } } - elsif (-f ($test = VMS::Filespec::rmsexpand($name,$so)) or - -f ($test = VMS::Filespec::rmsexpand($name,'.exe'))) { + elsif (-f ($fullname = VMS::Filespec::rmsexpand($name,$so)) or + -f ($fullname = VMS::Filespec::rmsexpand($name,'.exe'))) { $type = 'SHR'; - $name = $test unless $test =~ /exe;?\d*$/i; + $name = $fullname unless $fullname =~ /exe;?\d*$/i; } - elsif (not length($ctype) and # If we've got a lib already, don't bother - ( -f ($test = VMS::Filespec::rmsexpand($name,$lib_ext)) or - -f ($test = VMS::Filespec::rmsexpand($name,'.olb')))) { + elsif (not length($ctype) and # If we've got a lib already, + # don't bother + ( -f ($fullname = VMS::Filespec::rmsexpand($name,$lib_ext)) or + -f ($fullname = VMS::Filespec::rmsexpand($name,'.olb')))) { $type = 'OLB'; - $name = $test unless $test =~ /olb;?\d*$/i; + $name = $fullname unless $fullname =~ /olb;?\d*$/i; } - elsif (not length($ctype) and # If we've got a lib already, don't bother - ( -f ($test = VMS::Filespec::rmsexpand($name,$obj_ext)) or - -f ($test = VMS::Filespec::rmsexpand($name,'.obj')))) { + elsif (not length($ctype) and # If we've got a lib already, + # don't bother + ( -f ($fullname = VMS::Filespec::rmsexpand($name,$obj_ext)) or + -f ($fullname = VMS::Filespec::rmsexpand($name,'.obj')))) { warn "Note (probably harmless): " - ."Plain object file $test found in library list\n"; + ."Plain object file $fullname found in library list\n"; $type = 'OBJ'; - $name = $test unless $test =~ /obj;?\d*$/i; + $name = $fullname unless $fullname =~ /obj;?\d*$/i; } if (defined $type) { $ctype = $type; $cand = $name; @@ -518,7 +524,8 @@ sub _vms_ext { # This has to precede any other CRTLs, so just make it first if ($cand eq 'VAXCCURSE') { unshift @{$found{$ctype}}, $cand; } else { push @{$found{$ctype}}, $cand; } - warn "\tFound as $cand (really $test), type $ctype\n" if $verbose > 1; + warn "\tFound as $cand (really $fullname), type $ctype\n" + if $verbose > 1; push @flibs, $name unless $libs_seen{$fullname}++; next LIB; } diff --git a/lib/ExtUtils/META.yml b/lib/ExtUtils/META.yml index b05b7bb..e012885 100644 --- a/lib/ExtUtils/META.yml +++ b/lib/ExtUtils/META.yml @@ -1,6 +1,6 @@ #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: ExtUtils-MakeMaker -version: 6.10_04 +version: 6.10_05 version_from: lib/ExtUtils/MakeMaker.pm installdirs: perl requires: @@ -10,4 +10,4 @@ requires: Pod::Man: 0 distribution_type: module -generated_by: ExtUtils::MakeMaker version 6.10_04 +generated_by: ExtUtils::MakeMaker version 6.10_05 diff --git a/lib/ExtUtils/MM_Any.pm b/lib/ExtUtils/MM_Any.pm index 0200b29..d3208fd 100644 --- a/lib/ExtUtils/MM_Any.pm +++ b/lib/ExtUtils/MM_Any.pm @@ -605,7 +605,8 @@ metafile_addtomanifest: MAKE_FRAG my $add_meta = $self->oneliner(<<'CODE', ['-MExtUtils::Manifest=maniadd']); -maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}); +eval { maniadd({q{META.yml} => q{Module meta-data (added by MakeMaker)}}) } + or warn "Could not add META.yml to MANIFEST: $@\n" CODE return sprintf <<'MAKE_FRAG', $add_meta; diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index b6459b5..a17ca91 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -1323,7 +1323,6 @@ eval 'exec $interpreter $arg -S \$0 \${1+"\$\@"}' warn "Can't create new $file: $!\n"; next; } - my($dev,$ino,$mode) = stat FIXIN; # Print out the new #! line (or equivalent). local $\; diff --git a/lib/ExtUtils/MakeMaker.pm b/lib/ExtUtils/MakeMaker.pm index 9922f16..c824844 100644 --- a/lib/ExtUtils/MakeMaker.pm +++ b/lib/ExtUtils/MakeMaker.pm @@ -2,8 +2,8 @@ package ExtUtils::MakeMaker; BEGIN {require 5.005_03;} -$VERSION = '6.10_04'; -($Revision) = q$Revision: 1.111 $ =~ /Revision:\s+(\S+)/; +$VERSION = '6.10_05'; +($Revision) = q$Revision: 1.115 $ =~ /Revision:\s+(\S+)/; require Exporter; use Config; @@ -1721,6 +1721,13 @@ Defaults to C<@>. Boolean. Attribute to inhibit descending into subdirectories. +=item NO_META + +When true, suppresses the generation and addition to the MANIFEST of +the META.yml module meta-data file during 'make distdir'. + +Defaults to false. + =item NO_VC In general, any generated Makefile checks for the current version of @@ -2022,7 +2029,7 @@ MakeMaker object. The following lines will be parsed o.k.: $VERSION = '1.00'; *VERSION = \'1.01'; - $VERSION = sprintf "%d.%03d", q$Revision: 1.111 $ =~ /(\d+)/g; + $VERSION = sprintf "%d.%03d", q$Revision: 1.115 $ =~ /(\d+)/g; $FOO::VERSION = '1.10'; *FOO::VERSION = \'1.11'; our $VERSION = 1.2.3; # new for perl5.6.0 @@ -2262,6 +2269,10 @@ Copies all the files that are in the MANIFEST file to a newly created directory with the name C<$(DISTNAME)-$(VERSION)>. If that directory exists, it will be removed first. +Additionally, it will create a META.yml module meta-data file and add +this to your MANFIEST. You can shut this behavior off with the NO_META +flag. + =item make disttest Makes a distdir first, and runs a C, a make, and @@ -2326,6 +2337,27 @@ An example: WriteMakefile( 'dist' => { COMPRESS=>"bzip2", SUFFIX=>".bz2" }) + +=head2 Module Meta-Data + +Long plaguing users of MakeMaker based modules has been the problem of +getting basic information about the module out of the sources +I running the F and doing a bunch of messy +heuristics on the resulting F. To this end a simple module +meta-data file has been introduced, F. + +F is a YAML document (see http://www.yaml.org) containing +basic information about the module (name, version, prerequisites...) +in an easy to read format. The format is developed and defined by the +Module::Build developers. + +MakeMaker will automatically generate a F file for you and +add it to your F as part of the 'distdir' target (and thus +the 'dist' target). This is intended to seamlessly and rapidly +populate CPAN with module meta-data. If you wish to shut this feature +off, set the C C flag to true. + + =head2 Disabling an extension If some events detected in F imply that there is no way diff --git a/lib/ExtUtils/Manifest.pm b/lib/ExtUtils/Manifest.pm index d3d04b6..9965e5d 100644 --- a/lib/ExtUtils/Manifest.pm +++ b/lib/ExtUtils/Manifest.pm @@ -315,7 +315,7 @@ sub maniread { local $_; while (){ chomp; - next if /^#/; + next if /^\s*#/; my($file, $comment) = /^(\S+)\s*(.*)/; next unless $file; @@ -526,7 +526,7 @@ sub _unmacify { maniadd({ $file => $comment, ...}); -Adds an entry to an existing F. +Adds an entry to an existing F unless its already there. $file will be normalized (ie. Unixified). B @@ -541,9 +541,10 @@ sub maniadd { my $manifest = maniread(); open(MANIFEST, ">>$MANIFEST") or die "Could not open $MANIFEST: $!"; foreach my $file (_sort keys %$additions) { + next if exists $manifest->{$file}; + my $comment = $additions->{$file} || ''; - printf MANIFEST "%-40s%s\n", $file, $comment unless - exists $manifest->{$file}; + printf MANIFEST "%-40s%s\n", $file, $comment; } close MANIFEST; } diff --git a/lib/ExtUtils/TODO b/lib/ExtUtils/TODO index 505e461..3ff020c 100644 --- a/lib/ExtUtils/TODO +++ b/lib/ExtUtils/TODO @@ -40,8 +40,6 @@ fixpath() is useful. Eliminate eliminate_macros() from inside FS::VMS->catfile and catdir. Make into MM_VMS wrappers. -Add "NO_META" to stop autogeneration (and auto overwrite) of META.yml. - Test ExtUtils::Command::MM Finish ExtUtils::MakeMaker::Tutorial @@ -67,12 +65,12 @@ to use for help files these days) Add target to generate native VMS help files. -Add "What's this META.yml thing?" to the FAQ. - On VMS, write PM_FILTERs to a temp file and run from there avoiding command -line lengths. +line lengths. Worth the trouble given the Unixy nature of PM_FILTER? Move oneliner() and friends into a seperate module for general consumption. Make out of date check on 'make dist' more useful http://archive.develooper.com/makemaker@perl.org/msg01075.html + +Make maniadd() return a tied, case-insensitive hash on VMS. diff --git a/lib/ExtUtils/t/00compile.t b/lib/ExtUtils/t/00compile.t index 459a0eb..5eb015b 100644 --- a/lib/ExtUtils/t/00compile.t +++ b/lib/ExtUtils/t/00compile.t @@ -32,7 +32,7 @@ plan tests => scalar @modules * 2; foreach my $file (@modules) { # 5.8.0 has a bug about require alone in an eval. Thus the extra # statement. - eval q{ require($file); 1 }; + eval { require($file); 1 }; is( $@, '', "require $file" ); SKIP: { diff --git a/lib/ExtUtils/t/Install.t b/lib/ExtUtils/t/Install.t index 0abab68..13b3a67 100644 --- a/lib/ExtUtils/t/Install.t +++ b/lib/ExtUtils/t/Install.t @@ -17,7 +17,7 @@ use TieOut; use File::Path; use File::Spec; -use Test::More tests => 21; +use Test::More tests => 29; BEGIN { use_ok('ExtUtils::Install') } @@ -33,6 +33,8 @@ my $stdout = tie *STDOUT, 'TieOut'; pm_to_blib( { 'lib/Big/Dummy.pm' => 'blib/lib/Big/Dummy.pm' }, 'blib/lib/auto' ); +END { rmtree 'blib' } + ok( -d 'blib/lib', 'pm_to_blib created blib dir' ); ok( -r 'blib/lib/Big/Dummy.pm', ' copied .pm file' ); ok( -r 'blib/lib/auto', ' created autosplit dir' ); @@ -74,4 +76,37 @@ my $native_dummy = File::Spec->catfile(qw(install-test lib perl Big Dummy.pm)); is( keys %packlist, 1 ); is( lc((keys %packlist)[0]), lc $native_dummy, 'packlist written' ); -END { rmtree 'blib' } + +# Test UNINST=1 preserving same versions in other dirs. +install( { 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }, + 0, 0, 1); +ok( -d 'install-test/other_lib/perl', 'install made other dir' ); +ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); +ok( -r 'install-test/packlist', ' packlist exists' ); +ok( -r 'install-test/lib/perl/Big/Dummy.pm', ' UNINST=1 preserved same' ); + + + +# Test UNINST=1 removing other versions in other dirs. +chmod 0644, 'blib/lib/Big/Dummy.pm' or die $!; +open(DUMMY, ">>blib/lib/Big/Dummy.pm") or die $!; +print DUMMY "Extra stuff\n"; +close DUMMY; + +{ + local @INC = ('install-test/lib/perl'); + local $ENV{PERL5LIB} = ''; + install( { 'blib/lib' => 'install-test/other_lib/perl', + read => 'install-test/packlist', + write => 'install-test/packlist' + }, + 0, 0, 1); + ok( -d 'install-test/other_lib/perl', 'install made other dir' ); + ok( -r 'install-test/other_lib/perl/Big/Dummy.pm', ' .pm file installed' ); + ok( -r 'install-test/packlist', ' packlist exists' ); + ok( !-r 'install-test/lib/perl/Big/Dummy.pm', + ' UNINST=1 removed different' ); +} diff --git a/lib/ExtUtils/t/basic.t b/lib/ExtUtils/t/basic.t index 5e16c7e..f11b551 100644 --- a/lib/ExtUtils/t/basic.t +++ b/lib/ExtUtils/t/basic.t @@ -16,7 +16,7 @@ BEGIN { use strict; use Config; -use Test::More tests => 52; +use Test::More tests => 54; use MakeMaker::Test::Utils; use File::Find; use File::Spec; @@ -40,7 +40,7 @@ $| = 1; ok( chdir 'Big-Dummy', "chdir'd to Big-Dummy" ) || diag("chdir failed: $!"); -my @mpl_out = run(qq{$perl Makefile.PL "PREFIX=dummy-install"}); +my @mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"}); cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); @@ -119,12 +119,12 @@ is( $?, 0, 'install' ) || diag $install_out; like( $install_out, qr/^Installing /m ); like( $install_out, qr/^Writing /m ); -ok( -r 'dummy-install', ' install dir created' ); +ok( -r '../dummy-install', ' install dir created' ); my %files = (); find( sub { # do it case-insensitive for non-case preserving OSs $files{lc $_} = $File::Find::name; -}, 'dummy-install' ); +}, '../dummy-install' ); ok( $files{'dummy.pm'}, ' Dummy.pm installed' ); ok( $files{'liar.pm'}, ' Liar.pm installed' ); ok( $files{'.packlist'}, ' packlist created' ); @@ -170,9 +170,17 @@ my $metafile_out = run("$make metafile"); is( $?, 0, 'metafile' ) || diag($metafile_out); ok( !-f 'META.yml', 'META.yml generation suppressed by NO_META' ); +# Test if MANIFEST is read-only. +chmod 0444, 'MANIFEST'; +@mpl_out = run(qq{$perl Makefile.PL}); +cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); +$metafile_out = run("$make metafile_addtomanifest"); +is( $?, 0, q{metafile_addtomanifest didn't die with locked MANIFEST} ) || + diag($metafile_out); + # Make sure init_dirscan doesn't go into the distdir -@mpl_out = run(qq{$perl Makefile.PL "PREFIX=dummy-install"}); +@mpl_out = run(qq{$perl Makefile.PL "PREFIX=../dummy-install"}); cmp_ok( $?, '==', 0, 'Makefile.PL exited with zero' ) || diag(@mpl_out); diff --git a/lib/ExtUtils/t/zz_cleanup_dummy.t b/lib/ExtUtils/t/zz_cleanup_dummy.t index d3d3859..1b01f0a 100644 --- a/lib/ExtUtils/t/zz_cleanup_dummy.t +++ b/lib/ExtUtils/t/zz_cleanup_dummy.t @@ -12,10 +12,12 @@ chdir($^O eq 'VMS' ? 'BFD_TEST_ROOT:[t]' : 't'); use strict; -use Test::More tests => 2; +use Test::More tests => 3; use File::Path; rmtree('Big-Dummy'); ok(!-d 'Big-Dummy', 'Big-Dummy cleaned up'); rmtree('Problem-Module'); ok(!-d 'Problem-Module', 'Problem-Module cleaned up'); +rmtree('dummy-install'); +ok(!-d 'dummy-install', 'dummy-install cleaned up');