Skip to content

fix(MakeMaker): defer install to 'make install', fix 'cpan -t' installing#547

Merged
fglock merged 1 commit intomasterfrom
fix/jcpan-test-no-install
Apr 23, 2026
Merged

fix(MakeMaker): defer install to 'make install', fix 'cpan -t' installing#547
fglock merged 1 commit intomasterfrom
fix/jcpan-test-no-install

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 22, 2026

Problem

jcpan -t OpenAPI (and any other jcpan -t Module) was silently installing the module into ~/.perlonjava/lib. The -t flag is supposed to build + test only, not install — that is what -i is for.

Root cause: the Makefile generated by PerlOnJava's ExtUtils::MakeMaker did the real install into INSTALLSITELIB from the all:: target (via pm_to_blib::), so plain make populated the site libdir. Because CPAN.pm always runs make before make test, -t installed 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/lib only (previously copied straight to INSTALLSITELIB).
  • pure_all:: becomes an alias depending on pm_to_blib (kept so File::ShareDir::Install / Alien::Build postambles keep working).
  • all:: just builds ./blib. Its echo now says "built" instead of "installed".
  • install:: depends on all install_scripts and now actually runs the install copy commands (./libINSTALLSITELIB) 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.PL output on a stock macOS Perl: standard MakeMaker has all :: pure_all manifypods, pure_all :: config pm_to_blib subdirs linkext (all blib staging), and install :: pure_install doc_installpure_site_install :: all + actual install commands. Our fix now matches this layering.

Test plan

  • make (full unit suite) passes
  • jcpan -t OpenAPI on a clean state: builds + tests run, ~/.perlonjava/lib/OpenAPI.pm is not created
  • jcpan -i OpenAPI on a clean state: builds + tests + installs, file appears in ~/.perlonjava/lib
  • jcpan -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)

…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>
@fglock fglock force-pushed the fix/jcpan-test-no-install branch from 472de42 to de87141 Compare April 23, 2026 06:16
@fglock fglock merged commit 5acad75 into master Apr 23, 2026
2 checks passed
@fglock fglock deleted the fix/jcpan-test-no-install branch April 23, 2026 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant