Thread: Fwd: [Module-build-general] Fw: Re: Module::Build::Compat should not recommend not having a Makefile
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <ke...@ma...> - 2003-09-19 20:07:46
|
Hi Ben, Thanks for forwarding this message here, I wanted to make sure anyone with an opinion got a chance to express it. A few thoughts of my own: * I think you assume I'm trying to switch everyone over to Module::Build. I'm not. I'm trying to provide an alternate installation mechanism that's better than MakeMaker. Whether an author switches is their own decision. If I can make it attractive enough (with the carrot, not the stick) for people to gain something out of the switch, then that's good. * Since I do think most people will be happier using Module::Build than MakeMaker, I want to try to increase its mindshare in the community. For many people (the same people you mention who don't keep up with the latest "cool stuff" discussions), the only way they'd hear about the project is if they have to install it when some module uses it. * The thing that would probably make the most practical difference here is to patch CPAN.pm so that it supports Module::Build. This won't be too difficult, and many people do keep CPAN up to date more diligently than they do with other modules. Of course, if the prevailing opinion is different than my own, I'll change the docs. When I read the thread on perlmonks though, it seems like most people weren't too upset at the omission of a Makefile.PL. -Ken Begin forwarded message: > From: "Benjamin J. Tilly " <ben...@op...> > Date: Thu Sep 18, 2003 2:42:59 PM US/Central > To: mod...@li... > Subject: [Module-build-general] Fw: Re: Module::Build::Compat should > not recommend not having a Makefile.PL > > I am forwarding this message as requested by Ken. I am not on the > Module::Build list, so please keep me in the CC list. > > My perspective is that CPAN authors should make at least a token nod > towards attempting to be compatible with existing installations. For > the forseeable future a significant fraction of the installed Perl > base will be using versions of Perl and CPAN which will break if > Makefile.PL is not present. Attempting to force them to change that > decision (which may be made for many reasons, and at many sites is > NOT a programmer-level decision) will create a certain level of > knee-jerk resentment and ill-will. I see no good reason to encourage > this kind of problem. My opinion is that attempts to shove a better > way down people's throats is a good way to feel like you really tried > while accomplishing negative work. > > Speaking personally, when there is an accepted standard way of doing > things, I tend to look with extreme suspicion on anyone who tells me > that I need to do things their own, newfangled way. It would not be > inaccurate to read that as, "I reject them out of hand until someone I > trust tells me to reconsider." I believe that this approach is fairly > common. And it is what I did when I heard about Module::Build. > > But now that I have reconsidered it, I can see benefits of using > Module::Build. I intend to update my handful of modules to use it as a > convenience to potential Windows users. However I see no reason to > penalize people who aren't playing with the latest shiny toys, and so > will use the backwards compatibility tool. And I would encourage > others to do the same. > > In short, encouraging people to use Module::Build and > Module::Build::Compat so that their modules will install easily for the > widest range of possible users seems like an effective way to advocate > Module::Build. Encouraging arguments by trying to break people who > have > not been following the latest "cool stuff" discussions in the Perl > world > is an effective way to leave bad tastes in people's mouths. Therefore > I > think that it would be good if Module::Build::Compat's documentation > and > Module::Build's proponent's advocacy recommended that authors try to do > what will be compatible with the largest number of possible users. > > Regards, > Ben > > ----- Original Message ----- > From: Ken Williams <ke...@ma...> > Date: Thu, 18 Sep 2003 10:20:05 -0500 > To: "Benjamin J. Tilly " <ben...@op...> > Subject: Re: Module::Build::Compat should not recommend not having a > Makefile.PL > >> Hi Ben, >> >> Could you send a message (or forward this one) to the Module::Build >> list, mod...@li... , so that we could >> discuss the matter? I'm inclined to keep the recommendation the same >> way I have it and to work on patching CPAN.pm, but if more others feel >> differently I could be persuaded otherwise. >> >> -Ken >> >> On Thursday, September 18, 2003, at 07:29 AM, Benjamin J. Tilly >> wrote: >> >>> While I appreciate that Module::Build was a lot of work and is trying >>> to >>> solve an important problem (making it simple to build standard Perl >>> modules on non-Unixy platforms), it will cause problems if module >>> authors break backwards compatibility with the vast majority of >>> current >>> users of CPAN, and it is counterproductive to encourage them to do >>> so. >>> >>> Therefore please modify the documentation for Module::Build::Compat >>> to >>> have it stop discouraging people from using it to get backwards >>> compatibility with the existing installed base. >>> >>> For more on this see the discussion starting at >>> http://www.perlmonks.org/index.pl?node_id=292164. (This email is the >>> one >>> that I said I would send at >>> http://www.perlmonks.org/index.pl?node_id=292366.) >>> >>> Ben >> > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Module-build-general mailing list > Mod...@li... > https://lists.sourceforge.net/lists/listinfo/module-build-general |
|
From: Steve P. <sp...@qu...> - 2003-09-21 14:51:59
|
On Friday, September 19, 2003, at 07:12 pm, Ken Williams wrote: > [snip!] > * The thing that would probably make the most practical difference > here is to patch CPAN.pm so that it supports Module::Build. This > won't be too difficult, and many people do keep CPAN up to date more > diligently than they do with other modules. Yes, but until that time it makes sense for module authors to use the backwards compatibility layer and generate a Makefile.PL. Still, as a module author I think this feature is well documented. If anything, perhaps a small emphasis on using "create_makefile_pl => 'passthrough'" could be made? -Steve |
|
From: Ken W. <ke...@ma...> - 2003-09-21 17:56:18
|
On Sunday, September 21, 2003, at 09:51 AM, Steve Purkis wrote: > On Friday, September 19, 2003, at 07:12 pm, Ken Williams wrote: > >> [snip!] >> * The thing that would probably make the most practical difference >> here is to patch CPAN.pm so that it supports Module::Build. This >> won't be too difficult, and many people do keep CPAN up to date more >> diligently than they do with other modules. > > Yes, but until that time it makes sense for module authors to use the > backwards compatibility layer and generate a Makefile.PL. Indeed. Dave, do you suppose you could revive the CGI.pm patch? > Still, as a module author I think this feature is well documented. If > anything, perhaps a small emphasis on using "create_makefile_pl => > 'passthrough'" could be made? Yeah, or I suppose I could just not make any recommendation at all and make sure people know what their options are. When I think of various other recommendations in the perl documentation I tend to disagree with them, or think them presumptuous. -Ken |
|
From: Dave R. <au...@ur...> - 2003-09-22 05:19:37
|
On Sun, 21 Sep 2003, Ken Williams wrote: > > Yes, but until that time it makes sense for module authors to use the > > backwards compatibility layer and generate a Makefile.PL. > > Indeed. Dave, do you suppose you could revive the CGI.pm patch? I take it you mean CPAN.pm ;) Anyway, the old patch mostly applied. An updated patch for CPAN 1.76 appears below my sig. A quick test with Acme::Lingua::Pirate::Perl suggests it works. However, it still passes the EU::MM args to Build.PL/Build, like UNINST=1. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ --- lib/CPAN.pm 2003-07-31 09:53:06.000000000 -0500 +++ lib/CPAN.pm.new 2003-09-22 00:18:48.000000000 -0500 @@ -3966,17 +3966,40 @@ my($mpl) = File::Spec->catfile($packagedir,"Makefile.PL"); my($mpl_exists) = -f $mpl; - unless ($mpl_exists) { + my($bpl) = MM->catfile($packagedir,"Build.PL"); + my($bpl_exists) = -f $bpl; + unless ($mpl_exists or $bpl_exists) { # NFS has been reported to have racing problems after the # renaming of a directory in some environments. # This trick helps. sleep 1; - my $mpldh = DirHandle->new($packagedir) + my $dh = DirHandle->new($packagedir) or Carp::croak("Couldn't opendir $packagedir: $!"); - $mpl_exists = grep /^Makefile\.PL$/, $mpldh->read; - $mpldh->close; + foreach ($dh->read) { + $mpl_exists = /^Makefile\.PL$/; + $bpl_exists = /^Build\.PL$/; + } + $dh->close; } - unless ($mpl_exists) { + + # If this is a module that uses Module::Build then we need to + # install Module::Build. However, Module::Build uses _itself_ to + # install so to avoid a recursive prereq follow of doom, we + # explicitly do not try to install Module::Build when already + # install Module::Build. - Dave Rolsky + if ($bpl_exists and not grep { $_ eq "Module::Build" } $self->containsmods) { + my $nmo = $CPAN::META->instance("CPAN::Module","Module::Build"); + + unless ($nmo->inst_file and $nmo->uptodate) { + $CPAN::Frontend->myprint("The module you are installing requires the Module::Build package. +Either you do not have this module installed or you do not have the latest version. +It is recommended that you install the latest version now or +else it may not be possible to install this module"); + $self->follow_prereqs("Module::Build"); + } + } + + unless ($mpl_exists or $bpl_exists) { $self->debug(sprintf("makefilepl[%s]anycwd[%s]", $mpl, CPAN::anycwd(), @@ -3987,7 +4010,7 @@ $self->{'configure'} = $configure; } elsif (-f File::Spec->catfile($packagedir,"Makefile")) { $CPAN::Frontend->myprint(qq{ -Package comes with a Makefile and without a Makefile.PL. +Package comes with a Makefile and without a Makefile.PL or Build.PL. We\'ll try to build it with that Makefile then. }); $self->{writemakefile} = "YES"; @@ -4000,9 +4023,9 @@ } $cf =~ s|[/\\:]||g; # risk of filesystem damage $cf = "unknown" unless length($cf); - $CPAN::Frontend->myprint(qq{Package seems to come without Makefile.PL. - (The test -f "$mpl" returned false.) - Writing one on our own (setting NAME to $cf)\a\n}); + $CPAN::Frontend->myprint(qq{Package seems to come without Makefile.PL or Build.PL. + (The tests -f "$mpl" and -f "$bpl" returned false.) + Writing a Makefile.PL on our own (setting NAME to $cf)\a\n}); $self->{had_no_makefile_pl}++; sleep 3; @@ -4013,7 +4036,7 @@ or Carp::croak("Could not open >$mpl: $!"); $fh->print( qq{# This Makefile.PL has been autogenerated by the module CPAN.pm -# because there was no Makefile.PL supplied. +# because there was no Makefile.PL or Build.PL supplied. # Autogenerated on: }.scalar localtime().qq{ use ExtUtils::MakeMaker; @@ -4021,9 +4044,14 @@ }); $fh->close; + + $mpl_exists = 1; } } + $self->{makescript} = $mpl_exists ? "Makefile.PL" : $bpl_exists ? "Build.PL" : ""; + $self->{maketype} = $mpl_exists ? 'make' : $bpl_exists ? "Module::Build" : ""; + return $self; } @@ -4486,7 +4514,7 @@ # $switch = "-MExtUtils::MakeMaker ". # "-Mops=:default,:filesys_read,:filesys_open,require,chdir" # if $] > 5.00310; - $system = "$perl $switch Makefile.PL $CPAN::Config->{makepl_arg}"; + $system = "$perl $switch $self->{makescript} $CPAN::Config->{makepl_arg}"; } unless (exists $self->{writemakefile}) { local($SIG{ALRM}) = sub { die "inactivity_timeout reached\n" }; @@ -4523,16 +4551,17 @@ } else { $ret = system($system); if ($ret != 0) { - $self->{writemakefile} = "NO Makefile.PL returned status $ret"; + $self->{writemakefile} = "NO $self->{makescript} returned status $ret"; return; } } - if (-f "Makefile") { + if (($self->{maketype} eq "make" && -f "Makefile") || + ($self->{maketype} eq "Module::Build" && -f "Build")) { $self->{writemakefile} = "YES"; delete $self->{make_clean}; # if cleaned before, enable next } else { $self->{writemakefile} = - qq{NO Makefile.PL refused to write a Makefile.}; + qq{NO $self->{makescript} refused to write a Makefile/Build.PL.}; # It's probably worth it to record the reason, so let's retry # local $/; # my $fh = IO::File->new("$system |"); # STDERR? STDIN? @@ -4546,7 +4575,11 @@ if (my @prereq = $self->unsat_prereq){ return 1 if $self->follow_prereqs(@prereq); # signal success to the queuerunner } - $system = join " ", $CPAN::Config->{'make'}, $CPAN::Config->{make_arg}; + if ($self->{maketype} eq 'make') { + $system = join " ", $CPAN::Config->{'make'}, $CPAN::Config->{make_arg}; + } else { + $system = join " ", $self->perl, File::Spec->catfile( File::Spec->curdir, "Build" ), $CPAN::Config->{make_arg}; + } if (system($system) == 0) { $CPAN::Frontend->myprint(" $system -- OK\n"); $self->{'make'} = "YES"; @@ -4649,6 +4682,7 @@ # but we must have run it my $build_dir = $self->{build_dir} or die "Panic: no build_dir?"; my $makefile = File::Spec->catfile($build_dir,"Makefile"); + my $buildprereq = File::Spec->catfile($build_dir,"_build","prereq"); my(%p) = (); my $fh; if (-f $makefile @@ -4677,6 +4711,16 @@ } last; } + } elsif (-f $buildprereq + and + $fh = FileHandle->new("<$buildprereq")) { + while (<$fh>) { + my ($mod,$ver) = split /\s*=\s*/; + if ( defined $p{$mod} ) { + warn "Warning: PREREQ_PM mentions $mod more than once, last mention wins"; + } + $p{$mod} = $ver; + } } $self->{prereq_pm_detected}++; return $self->{prereq_pm} = \%p; @@ -4725,7 +4769,12 @@ local $ENV{PERL5LIB} = $ENV{PERL5LIB} || ""; $CPAN::META->set_perl5lib; - my $system = join " ", $CPAN::Config->{'make'}, "test"; + my $system; + if ($self->{maketype} eq "make") { + $system = join " ", $CPAN::Config->{'make'}, "test"; + } elsif ($self->{maketype} eq "Module::Build") { + $system = join " ", $self->perl, File::Spec->catfile( File::Spec->curdir, "Build" ), "test"; + } if (system($system) == 0) { $CPAN::Frontend->myprint(" $system -- OK\n"); $CPAN::META->is_tested($self->{'build_dir'}); @@ -4757,7 +4806,12 @@ return; } - my $system = join " ", $CPAN::Config->{'make'}, "clean"; + my $system; + if ($self->{maketype} eq "make") { + $system = join " ", $CPAN::Config->{'make'}, "clean"; + } elsif ($self->{maketype} eq "Module::Build") { + $system = join " ", $self->perl, File::Spec->catfile( File::Spec->curdir, "Build" ), "clean"; + } if (system($system) == 0) { $CPAN::Frontend->myprint(" $system -- OK\n"); @@ -4832,8 +4886,14 @@ return; } - my $system = join(" ", $CPAN::Config->{'make'}, - "install", $CPAN::Config->{make_install_arg}); + my $system; + if ($self->{maketype} eq "make") { + $system = join(" ", $CPAN::Config->{'make'}, + "install", $CPAN::Config->{make_install_arg}); + } elsif ($self->{maketype} eq "Module::Build") { + $system = join(" ", $self->perl, File::Spec->catfile( File::Spec->curdir, "Build" ), + "install", $CPAN::Config->{make_install_arg}); + } my($stderr) = $^O =~ /Win/i ? "" : " 2>&1 "; my($pipe) = FileHandle->new("$system $stderr |"); my($makeout) = ""; |
|
From: Dave R. <au...@ur...> - 2003-09-22 05:25:35
|
On Mon, 22 Sep 2003, Dave Rolsky wrote: > On Sun, 21 Sep 2003, Ken Williams wrote: > > > > Yes, but until that time it makes sense for module authors to use the > > > backwards compatibility layer and generate a Makefile.PL. > > > > Indeed. Dave, do you suppose you could revive the CGI.pm patch? > > I take it you mean CPAN.pm ;) > > Anyway, the old patch mostly applied. An updated patch for CPAN 1.76 > appears below my sig. A quick test with Acme::Lingua::Pirate::Perl > suggests it works. However, it still passes the EU::MM args to > Build.PL/Build, like UNINST=1. Gah, that was a bit mailer-mangled. Here it is again. -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/ --- lib/CPAN.pm 2003-07-31 09:53:06.000000000 -0500 +++ lib/CPAN.pm.new 2003-09-22 00:18:48.000000000 -0500 @@ -3966,17 +3966,40 @@ my($mpl) = File::Spec->catfile($packagedir,"Makefile.PL"); my($mpl_exists) = -f $mpl; - unless ($mpl_exists) { + my($bpl) = MM->catfile($packagedir,"Build.PL"); + my($bpl_exists) = -f $bpl; + unless ($mpl_exists or $bpl_exists) { # NFS has been reported to have racing problems after the # renaming of a directory in some environments. # This trick helps. sleep 1; - my $mpldh = DirHandle->new($packagedir) + my $dh = DirHandle->new($packagedir) or Carp::croak("Couldn't opendir $packagedir: $!"); - $mpl_exists = grep /^Makefile\.PL$/, $mpldh->read; - $mpldh->close; + foreach ($dh->read) { + $mpl_exists = /^Makefile\.PL$/; + $bpl_exists = /^Build\.PL$/; + } + $dh->close; } - unless ($mpl_exists) { + + # If this is a module that uses Module::Build then we need to + # install Module::Build. However, Module::Build uses _itself_ to + # install so to avoid a recursive prereq follow of doom, we + # explicitly do not try to install Module::Build when already + # install Module::Build. - Dave Rolsky + if ($bpl_exists and not grep { $_ eq "Module::Build" } $self->containsmods) { + my $nmo = $CPAN::META->instance("CPAN::Module","Module::Build"); + + unless ($nmo->inst_file and $nmo->uptodate) { + $CPAN::Frontend->myprint("The module you are installing requires the Module::Build package. +Either you do not have this module installed or you do not have the latest version. +It is recommended that you install the latest version now or +else it may not be possible to install this module"); + $self->follow_prereqs("Module::Build"); + } + } + + unless ($mpl_exists or $bpl_exists) { $self->debug(sprintf("makefilepl[%s]anycwd[%s]", $mpl, CPAN::anycwd(), @@ -3987,7 +4010,7 @@ $self->{'configure'} = $configure; } elsif (-f File::Spec->catfile($packagedir,"Makefile")) { $CPAN::Frontend->myprint(qq{ -Package comes with a Makefile and without a Makefile.PL. +Package comes with a Makefile and without a Makefile.PL or Build.PL. We\'ll try to build it with that Makefile then. }); $self->{writemakefile} = "YES"; @@ -4000,9 +4023,9 @@ } $cf =~ s|[/\\:]||g; # risk of filesystem damage $cf = "unknown" unless length($cf); - $CPAN::Frontend->myprint(qq{Package seems to come without Makefile.PL. - (The test -f "$mpl" returned false.) - Writing one on our own (setting NAME to $cf)\a\n}); + $CPAN::Frontend->myprint(qq{Package seems to come without Makefile.PL or Build.PL. + (The tests -f "$mpl" and -f "$bpl" returned false.) + Writing a Makefile.PL on our own (setting NAME to $cf)\a\n}); $self->{had_no_makefile_pl}++; sleep 3; @@ -4013,7 +4036,7 @@ or Carp::croak("Could not open >$mpl: $!"); $fh->print( qq{# This Makefile.PL has been autogenerated by the module CPAN.pm -# because there was no Makefile.PL supplied. +# because there was no Makefile.PL or Build.PL supplied. # Autogenerated on: }.scalar localtime().qq{ use ExtUtils::MakeMaker; @@ -4021,9 +4044,14 @@ }); $fh->close; + + $mpl_exists = 1; } } + $self->{makescript} = $mpl_exists ? "Makefile.PL" : $bpl_exists ? "Build.PL" : ""; + $self->{maketype} = $mpl_exists ? 'make' : $bpl_exists ? "Module::Build" : ""; + return $self; } @@ -4486,7 +4514,7 @@ # $switch = "-MExtUtils::MakeMaker ". # "-Mops=:default,:filesys_read,:filesys_open,require,chdir" # if $] > 5.00310; - $system = "$perl $switch Makefile.PL $CPAN::Config->{makepl_arg}"; + $system = "$perl $switch $self->{makescript} $CPAN::Config->{makepl_arg}"; } unless (exists $self->{writemakefile}) { local($SIG{ALRM}) = sub { die "inactivity_timeout reached\n" }; @@ -4523,16 +4551,17 @@ } else { $ret = system($system); if ($ret != 0) { - $self->{writemakefile} = "NO Makefile.PL returned status $ret"; + $self->{writemakefile} = "NO $self->{makescript} returned status $ret"; return; } } - if (-f "Makefile") { + if (($self->{maketype} eq "make" && -f "Makefile") || + ($self->{maketype} eq "Module::Build" && -f "Build")) { $self->{writemakefile} = "YES"; delete $self->{make_clean}; # if cleaned before, enable next } else { $self->{writemakefile} = - qq{NO Makefile.PL refused to write a Makefile.}; + qq{NO $self->{makescript} refused to write a Makefile/Build.PL.}; # It's probably worth it to record the reason, so let's retry # local $/; # my $fh = IO::File->new("$system |"); # STDERR? STDIN? @@ -4546,7 +4575,11 @@ if (my @prereq = $self->unsat_prereq){ return 1 if $self->follow_prereqs(@prereq); # signal success to the queuerunner } - $system = join " ", $CPAN::Config->{'make'}, $CPAN::Config->{make_arg}; + if ($self->{maketype} eq 'make') { + $system = join " ", $CPAN::Config->{'make'}, $CPAN::Config->{make_arg}; + } else { + $system = join " ", $self->perl, File::Spec->catfile( File::Spec->curdir, "Build" ), $CPAN::Config->{make_arg}; + } if (system($system) == 0) { $CPAN::Frontend->myprint(" $system -- OK\n"); $self->{'make'} = "YES"; @@ -4649,6 +4682,7 @@ # but we must have run it my $build_dir = $self->{build_dir} or die "Panic: no build_dir?"; my $makefile = File::Spec->catfile($build_dir,"Makefile"); + my $buildprereq = File::Spec->catfile($build_dir,"_build","prereq"); my(%p) = (); my $fh; if (-f $makefile @@ -4677,6 +4711,16 @@ } last; } + } elsif (-f $buildprereq + and + $fh = FileHandle->new("<$buildprereq")) { + while (<$fh>) { + my ($mod,$ver) = split /\s*=\s*/; + if ( defined $p{$mod} ) { + warn "Warning: PREREQ_PM mentions $mod more than once, last mention wins"; + } + $p{$mod} = $ver; + } } $self->{prereq_pm_detected}++; return $self->{prereq_pm} = \%p; @@ -4725,7 +4769,12 @@ local $ENV{PERL5LIB} = $ENV{PERL5LIB} || ""; $CPAN::META->set_perl5lib; - my $system = join " ", $CPAN::Config->{'make'}, "test"; + my $system; + if ($self->{maketype} eq "make") { + $system = join " ", $CPAN::Config->{'make'}, "test"; + } elsif ($self->{maketype} eq "Module::Build") { + $system = join " ", $self->perl, File::Spec->catfile( File::Spec->curdir, "Build" ), "test"; + } if (system($system) == 0) { $CPAN::Frontend->myprint(" $system -- OK\n"); $CPAN::META->is_tested($self->{'build_dir'}); @@ -4757,7 +4806,12 @@ return; } - my $system = join " ", $CPAN::Config->{'make'}, "clean"; + my $system; + if ($self->{maketype} eq "make") { + $system = join " ", $CPAN::Config->{'make'}, "clean"; + } elsif ($self->{maketype} eq "Module::Build") { + $system = join " ", $self->perl, File::Spec->catfile( File::Spec->curdir, "Build" ), "clean"; + } if (system($system) == 0) { $CPAN::Frontend->myprint(" $system -- OK\n"); @@ -4832,8 +4886,14 @@ return; } - my $system = join(" ", $CPAN::Config->{'make'}, - "install", $CPAN::Config->{make_install_arg}); + my $system; + if ($self->{maketype} eq "make") { + $system = join(" ", $CPAN::Config->{'make'}, + "install", $CPAN::Config->{make_install_arg}); + } elsif ($self->{maketype} eq "Module::Build") { + $system = join(" ", $self->perl, File::Spec->catfile( File::Spec->curdir, "Build" ), + "install", $CPAN::Config->{make_install_arg}); + } my($stderr) = $^O =~ /Win/i ? "" : " 2>&1 "; my($pipe) = FileHandle->new("$system $stderr |"); my($makeout) = ""; |