Yo,
Here's another patch to MakeMaker. It adds initial support for a
'make diff' command. Some important things are still missing:
* Any documentation
* diff always has the -u flag, no way to change it yet
I mainly wanted to get this patch out there before working on the details.
A testing issue: if you apply this patch to the distro, then try
'make diff', it won't work, because it's picking up the installed
MakeMaker, not the new one. So you can edit MM_Unix.pm to change this:
$(PERLRUN) -MExtUtils::MakeMaker -e 'MM->make_diff' $(INST_LIB)
$(INSTALLSITELIB)
to this:
$(PERLRUN) -I$(INST_LIB) -MExtUtils::MakeMaker -e 'MM->make_diff' $(INST_LIB)
$(INSTALLSITELIB)
at the end of the 'top_targets' subroutine.
Here are the patches, taking up where I left off last time:
=================================================================
--- lib/ExtUtils/MakeMaker-orig.pm Sun Jul 22 12:22:45 2001
+++ lib/ExtUtils/MakeMaker.pm Sat Jul 21 23:40:05 2001
@@ -311,7 +311,6 @@
sub ExtUtils::MakeMaker::new {
my($class,$self) = @_;
- my($key);
print STDOUT "MakeMaker (v$VERSION)\n" if $Verbose;
if (-f "MANIFEST" && ! -f "Makefile"){
@@ -324,10 +323,8 @@
my(%initial_att) = %$self; # record initial attributes
- my($prereq);
- foreach $prereq (sort keys %{$self->{PREREQ_PM}}) {
- my $eval = "require $prereq";
- eval $eval;
+ foreach my $prereq (sort keys %{$self->{PREREQ_PM}}) {
+ eval "require $prereq";
if ($@) {
warn "Warning: prerequisite $prereq failed to load: $@";
@@ -386,8 +383,7 @@
if (defined $Parent[-2]){
$self->{PARENT} = $Parent[-2];
- my $key;
- for $key (keys %Prepend_dot_dot) {
+ foreach my $key (keys %Prepend_dot_dot) {
next unless defined $self->{PARENT}{$key};
$self->{$key} = $self->{PARENT}{$key};
# PERL and FULLPERL may be command verbs instead of full
@@ -462,7 +458,7 @@
# MakeMaker Parameters:
END
- foreach $key (sort keys %initial_att){
+ foreach my $key (sort keys %initial_att){
my($v) = neatvalue($initial_att{$key});
$v =~ s/(CODE|HASH|ARRAY|SCALAR)\([\dxa-f]+\)/$1\(...\)/;
$v =~ tr/\n/ /s;
@@ -488,8 +484,7 @@
$self->eval_in_subdirs if @{$self->{DIR}};
}
- my $section;
- foreach $section ( @MM_Sections ){
+ foreach my $section ( @MM_Sections ){
print "Processing Makefile '$section' section\n" if ($Verbose >= 2);
my($skipit) = $self->skipcheck($section);
if ($skipit){
=================================================================
--- lib/ExtUtils/MM_Unix-orig.pm Sat Jul 21 21:49:03 2001
+++ lib/ExtUtils/MM_Unix.pm Sun Jul 22 13:13:59 2001
@@ -143,6 +143,35 @@
return File::Spec->updir;
}
+
+sub make_diff {
+ my ($pkg, $local_dir, $install_dir, $prefix) = @_ > 1 ? @_ : (@_, @ARGV[0,1]);
+ $prefix = '' unless length $prefix;
+ #warn "($pkg, $local_dir, $install_dir, $prefix)\n";
+ local *DIR;
+ opendir DIR, "$local_dir/$prefix" or die "Can't opendir $local_dir: $!";
+ LOCAL:
+ while (my $file = readdir DIR) {
+ next if $file =~ /^\./;
+ if (-d "$local_dir/$file") {
+ $pkg->make_diff($local_dir, $install_dir, $file);
+ next;
+ }
+ print
+"========================================================================\n";
+ foreach my $root ($install_dir, @INC) {
+ next if $root eq $local_dir; # blib/lib is usually in @INC
+ if (-e "$root/$prefix/$file") {
+ print "diff -u $root/$prefix/$file $local_dir/$prefix/$file\n";
+ print `diff -u $root/$prefix/$file $local_dir/$prefix/$file`;
+ next LOCAL;
+ }
+ }
+ print "Skipping new file '$prefix/$file'\n";
+ }
+ closedir DIR;
+}
+
+
sub ExtUtils::MM_Unix::c_o ;
sub ExtUtils::MM_Unix::clean ;
sub ExtUtils::MM_Unix::const_cccmd ;
@@ -3721,6 +3750,11 @@
}.$self->{NOECHO}.q{$(PERLRUN) \
-MExtUtils::MakeMaker=Version_check \
-e "Version_check('$(MM_VERSION)')"
+};
+
+ push @m, q{
+diff :: pure_all
+ $(PERLRUN) -MExtUtils::MakeMaker -e 'MM->make_diff' $(INST_LIB)
+$(INSTALLSITELIB)
};
join('',@m);
=================================================================
------------------- -------------------
Ken Williams Last Bastion of Euclidity
[EMAIL PROTECTED] The Math Forum