perl-pod / pod-simple

Framework for Parsing and Formatting POD
http://search.cpan.org/dist/Pod-Simple/
43 stars 59 forks source link

Optionally Suppress Version Number Comments (Allow Deterministic Builds) #148

Closed chromatic closed 1 year ago

chromatic commented 1 year ago

I'm working on a system attempting to produce reproducible builds. When a Perl module uses a stack which includes Pod::Simple in the build process (such as using Pod::Man to generate man pages), the resulting output includes the version numbers of Pod::Simple.

For example, when building Mojolicious, the generated output for binaries such as morbo includes:

.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
.\"
.\" Standard preamble:
.\" ========================================================================

I'd like to be able to consolidate built modules when the output is bit-for-bit identical.

It's okay if Pod::Simple generates different output when the behavior of the module changes. However, if I had a way to suppress version number output in certain circumstances, I could re-use more built modules because there'd be fewer differences between them.

Ideally I could set an environment variable in my build system that would cover all of the cases where Pod::Simple may be invoked during a build process.

I'm happy to explain further or elaborate if my use case is still fuzzy.

haarg commented 1 year ago

This is done by Pod::Man, which is part of the podlators distribution, not Pod-Simple.

haarg commented 1 year ago

https://github.com/rra/podlators/blob/main/lib/Pod/Man.pm#L1117

chromatic commented 1 year ago

I was thinking of a way to suppress or simplify the output of the version_report method in Pod::Simple. If you think suppressing the output altogether in podlators is preferable, I'm happy to migrate this issue to that distribution.

haarg commented 1 year ago

It doesn't make much sense to me that a method named version_report would produce anything other than a version report.

None of the modules in this dist include the output from version_report. And even in podlators, it appears that only Pod::Man does. It may be reasonable to just remove it from there without an option.

chromatic commented 1 year ago

Thanks for the recommendation. I'll close this in favor of a similar query with podlators.

rra commented 6 months ago

For the record, the reason why Pod::Man does this is due to this statement in perlpodspec:

I'm therefore hesitant to change Pod::Man to stop doing this unless perlpodspec is changed. (The other modules in the podlators distribution fall under the "do not allow comments" exception.)

haarg commented 6 months ago

That seems like a pretty strange thing to have in the spec, and I would support removing it. Most other formatters don't follow that rule, including many that allow comments.

rra commented 6 months ago

Who owns perlpodspec these days? Is it maintained directly in the main Perl 5 repository? I can submit a PR.

haarg commented 6 months ago

Yes, perlpodspec is maintained in core.