fix(MakeMaker): defer install to 'make install', fix 'cpan -t' installing#547
Merged
fix(MakeMaker): defer install to 'make install', fix 'cpan -t' installing#547
Conversation
…ling
The PerlOnJava MakeMaker previously did the real install into
INSTALLSITELIB from the `all::` target (via `pm_to_blib::`), so `make`
alone was enough to populate ~/.perlonjava/lib. Because CPAN.pm runs
`make` before `make test`, this caused `jcpan -t Module` (test-only) to
silently install the module as a side effect of building it, violating
the standard `cpan -t` contract.
Realign the generated Makefile with standard ExtUtils::MakeMaker:
- `pm_to_blib::` now stages module/data files into `./blib/lib` only
(it used to copy straight to INSTALLSITELIB).
- `pure_all::` becomes an alias that depends on `pm_to_blib` (kept so
File::ShareDir::Install / Alien::Build postambles keep working).
- `all::` just builds ./blib. Its echo says "built" instead of
"installed".
- `install::` depends on `all install_scripts` and now actually runs
the `@install_cmds` copying ./lib -> INSTALLSITELIB, plus the
"installed" echo.
Behavior now matches `perl Makefile.PL` output:
jcpan -t OpenAPI -> builds + tests, does NOT populate
~/.perlonjava/lib
jcpan -i OpenAPI -> builds + tests + installs
jcpan -t Tie::RegexpHash on a failing test -> test harness finds the
module via blib/lib (tests actually run), and
because `make test` exits non-zero CPAN skips
`make install`, so nothing is installed.
Also updates the Makefile.PL post-config banner from "when 'make' runs"
to "when 'make install' runs" to reflect the new semantics.
Generated with [Devin](https://cli.devin.ai/docs)
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
472de42 to
de87141
Compare
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.
Problem
jcpan -t OpenAPI(and any otherjcpan -t Module) was silently installing the module into~/.perlonjava/lib. The-tflag is supposed to build + test only, not install — that is what-iis for.Root cause: the Makefile generated by PerlOnJava's
ExtUtils::MakeMakerdid the real install intoINSTALLSITELIBfrom theall::target (viapm_to_blib::), so plainmakepopulated the site libdir. Because CPAN.pm always runsmakebeforemake test,-tinstalled as a side effect of building.Fix
Realign the generated Makefile with standard ExtUtils::MakeMaker:
pm_to_blib::now stages module/data files into./blib/libonly (previously copied straight toINSTALLSITELIB).pure_all::becomes an alias depending onpm_to_blib(kept soFile::ShareDir::Install/Alien::Buildpostambles keep working).all::just builds./blib. Its echo now says "built" instead of "installed".install::depends onall install_scriptsand now actually runs the install copy commands (./lib→INSTALLSITELIB) plus the "installed" echo.Also updates the Makefile.PL post-config banner from "when 'make' runs" to "when 'make install' runs" to reflect the new semantics.
Parity with system Perl
Verified against
perl Makefile.PLoutput on a stock macOS Perl: standard MakeMaker hasall :: pure_all manifypods,pure_all :: config pm_to_blib subdirs linkext(all blib staging), andinstall :: pure_install doc_install→pure_site_install :: all+ actual install commands. Our fix now matches this layering.Test plan
make(full unit suite) passesjcpan -t OpenAPIon a clean state: builds + tests run,~/.perlonjava/lib/OpenAPI.pmis not createdjcpan -i OpenAPIon a clean state: builds + tests + installs, file appears in~/.perlonjava/libjcpan -t Tie::RegexpHash: tests actually execute against./blib/lib(harness found the module, 10 subtests ran), test harness fails → CPAN skips install → nothing in site libdir (correct behavior)