Skip to content

fix: MYMETA.yml meta-spec v1.4 format for CPAN.pm dependency resolution#479

Merged
fglock merged 2 commits into
masterfrom
fix/mymeta-v1-format
Apr 10, 2026
Merged

fix: MYMETA.yml meta-spec v1.4 format for CPAN.pm dependency resolution#479
fglock merged 2 commits into
masterfrom
fix/mymeta-v1-format

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 10, 2026

Summary

Fixes two MYMETA.yml bugs in ExtUtils::MakeMaker::_create_mymeta that prevented CPAN.pm from correctly parsing module dependencies.

Bug 1: meta-spec v2 format not understood by CPAN.pm fallback parser

  • Switched from meta-spec v2 (nested prereqs.runtime.requires) to meta-spec v1.4 with flat top-level requires/build_requires/configure_requires keys
  • This format is compatible with all three tiers of CPAN.pm's prereq_pm() fallback logic

Bug 2: Invalid YAML single-quote escaping

  • Fixed $abstract =~ s/'/\\'/g (produces \', invalid YAML) to s/'/''/g (doubled single-quote, correct YAML)
  • Modules with apostrophes in their abstract (e.g., Plack::Middleware::FixMissingBodyInRedirect's "if it's not already set" caused warnings from CPAN.pm's YAML parser
  • Also removed blank lines between YAML sections and used for empty mapping sections

Verification

  • ./gradlew classes testUnitParallel --parallel shadowJar
    Reusing configuration cache.

Task :generatePerlSbom UP-TO-DATE
Task :cyclonedxBom UP-TO-DATE
Task :mergeSbom UP-TO-DATE
Task :processTestResources UP-TO-DATE

Task :injectGitInfo
Injected git info: cb6f2aa (2026-04-10)

Task :processResources UP-TO-DATE
Task :compileJava
Task :classes
Task :compileTestJava UP-TO-DATE
Task :testClasses UP-TO-DATE
Task :shadowJar
Task :testUnitShard2
Task :testUnitShard3
Task :testUnitShard1
Task :testUnitShard0
Task :testUnitParallel

BUILD SUCCESSFUL in 36s
13 actionable tasks: 7 executed, 6 up-to-date
Configuration cache entry reused. passes all unit tests

  • Generated MYMETA.yml parses correctly with both and modules
  • successfully auto-resolved and installed 38 dependency modules (previously zero due to this bug)
  • Includes updated with full install results

Test plan

  • ./gradlew classes testUnitParallel --parallel shadowJar
    Reusing configuration cache.

Task :generatePerlSbom UP-TO-DATE
Task :cyclonedxBom UP-TO-DATE
Task :mergeSbom UP-TO-DATE
Task :processTestResources UP-TO-DATE
Task :processResources UP-TO-DATE

Task :injectGitInfo
Injected git info: cb6f2aa (2026-04-10)

Task :compileJava UP-TO-DATE
Task :classes UP-TO-DATE
Task :compileTestJava UP-TO-DATE
Task :testClasses UP-TO-DATE
Task :testUnitShard0 UP-TO-DATE
Task :testUnitShard1 UP-TO-DATE
Task :testUnitShard3 UP-TO-DATE
Task :testUnitShard2 UP-TO-DATE
Task :testUnitParallel UP-TO-DATE
Task :shadowJar UP-TO-DATE

BUILD SUCCESSFUL in 542ms
13 actionable tasks: 1 executed, 12 up-to-date
Configuration cache entry reused. passes all unit tests

  • MYMETA.yml with apostrophes in abstract parses correctly
  • MYMETA.yml with empty sections () parses correctly
  • CPAN.pm auto-resolves Dancer2 dependency chain (38 modules installed)
  • No blank lines between YAML sections in generated output

Generated with Devin
EOF
)

fglock and others added 2 commits April 10, 2026 10:18
The _create_mymeta function in ExtUtils::MakeMaker generated MYMETA.yml
using meta-spec v2 with nested prereqs.runtime.requires structure.
CPAN.pm prereq_pm() fallback parser (Tier 2: read_yaml) only understands
v1 flat top-level requires/build_requires keys. When CPAN::Meta (Tier 1)
failed to load, the fallback silently returned zero prerequisites, causing
CPAN.pm to install modules without their dependencies.

Changes:
- Switch MYMETA.yml from meta-spec v2 to v1.4 flat format
- Use top-level requires/build_requires/configure_requires keys
- Merge TEST_REQUIRES into build_requires (v1.4 has no test phase)
- Escape single quotes in abstract field for YAML safety
- Use hyphenated dist name (Foo::Bar -> Foo-Bar)
- Include version number in generated_by (CPAN.pm filters old EU::MM)
- Default configure_requires to ExtUtils::MakeMaker
- Add dev/modules/dancer2_support.md investigation plan

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Fix single-quote escaping: use YAML's '' (doubled) instead of \'
  which is invalid in YAML single-quoted strings. Modules with
  apostrophes in their abstract (e.g., "if it's not set") caused
  "not a HASH reference" parse errors in CPAN.pm.
- Remove blank lines between YAML sections by chomping interpolated
  strings before inserting into heredoc.
- Use {} for empty YAML mapping sections instead of leaving them
  as bare keys with no value.
- Update dancer2_support.md with Phase 2 results: 38 modules
  installed successfully via notest, Type::Tiny scoping bug
  identified as next blocker.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock merged commit b5ba5a0 into master Apr 10, 2026
2 checks passed
@fglock fglock deleted the fix/mymeta-v1-format branch April 10, 2026 09:23
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