fix(makemaker): write Build proxy when Build.PL is present#584
Merged
Conversation
Some CPAN distributions ship a Build.PL whose only job is to delegate
to Makefile.PL (Module::Install's "Dear Distribution Packager" trick,
e.g. Data::Utilities, which contains Data::Merger). CPAN.pm sees the
Build.PL, sets the dist's modulebuild flag, and then runs ./Build,
./Build test, ./Build install instead of make.
Until now PerlOnJava's ExtUtils::MakeMaker shim only emitted a
Makefile, so jcpan -t/-i Data::Merger died with:
Alert: no Build file available for 'make ...'
Error: Unable to read file Build
/jperl Build -- NOT OK
Fix: when WriteMakefile detects a Build.PL in cwd, also write a thin
./Build perl script that maps Module::Build subcommands (build, test,
install, clean, realclean, distclean, config) to the matching make
targets generated by _create_install_makefile. Unknown subcommands
pass through verbatim.
Verified end-to-end on a clean tree:
rm -rf ~/.cpan/build/Data-Utilities-0.04-*
./jcpan -i Data::Merger
# -> Build.PL OK, Build OK, Build test OK (55/55), Build install OK
./jperl -e 'use Data::Merger qw(merger); ...' # works
Generated with [Devin](https://devin.ai)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix
jcpan -t/-i Data::Merger(and any other CPAN dist that ships a Module::Install–style stubBuild.PL) failing with:Root cause
Data::Utilities(which containsData::Merger) ships aBuild.PLwhose only job is:CPAN.pm sees
Build.PL, sets$self->{modulebuild} = 1, and from then on runs./Build,./Build test,./Build installinstead ofmake .... OurExtUtils::MakeMakershim only emitted aMakefile, so./Builddid not exist and the install aborted.Fix
When
WriteMakefileruns and detects aBuild.PLin the cwd, also emit a thin./Buildperl script that proxies Module::Build subcommands (build,test,install,clean,realclean,distclean,config) to the matchingmaketargets that_create_install_makefilealready generates. Unknown subcommands pass through verbatim.Touches only
src/main/perl/lib/ExtUtils/MakeMaker.pm(plus the auto-injectedConfiguration.javacommit id).Test plan
make(full unit suite) passesBuild.PL -- OKBuild -- OK(5 files staged in./blib)Build test -- OK(Files=7, Tests=55, all pass)Build install -- OK(5 files copied to~/.perlonjava/lib)./jperl -e 'use Data::Merger qw(merger); ...'merges hashes as expected.No automated test was added — there are currently no tests in
src/test/for the MakeMaker shim or thejcpanflow to extend. Happy to add one (either a.tthat exercises_create_build_script_proxydirectly, or amake test-bundled-modulesentry that runsjcpan -t Data::Merger) in a follow-up if desired.Generated with Devin