zonemaster-cli icon indicating copy to clipboard operation
zonemaster-cli copied to clipboard

Translations (*.mo) files are generated inappropriately in the build process

Open marc-vanderwal opened this issue 6 months ago • 5 comments

During release testing of Zonemaster-CLI, I attempted to install the latest develop branch of the module using the following command line on a freshly checked-out Git repo:

perl Makefile.PL
make dist
cpanm --sudo -v Zonemaster-CLI-*.tar.gz

However, doing so causes some of the unit tests related to translations to fail. If forcing the installation, the package gets installed but the *.mo files are missing, meaning that none of the strings are translated into the selected locale.

The workaround is to introduce an additional step:

perl Makefile.PL
make
make dist
cpanm --sudo -v Zonemaster-CLI-*.tar.gz

This is fundamentally a problem with the build process.

By the way, when I implement the workaround, I noticed that the resulting Zonemaster-CLI-*.tar.gz archive contains .mo files, generated from the .po files. It feels wrong to have generated (binary) files inside the archive; I assume that the archive should only contain source files.

marc-vanderwal avatar Jun 11 '25 07:06 marc-vanderwal

It is documented that we should run perl Makefile.PL ; make all ; make distcheck ; make dist to build a package.

I do not think that the missing MO files is a problem since they are created by make all.

matsduf avatar Jun 11 '25 08:06 matsduf

I cannot see that it is wrong to have generated MO files in the distribution package. You probably have to install more binaries on the target system to build there. Do not see the distribution packages as source, it is rather a "binary package".

matsduf avatar Jun 11 '25 08:06 matsduf

@marc-vanderwal Do you think this issue be closed or kept? I also do not see a sizable issue here, but if you disagree could you maybe elaborate more on it?

tgreenx avatar Jul 01 '25 15:07 tgreenx

No, I still think there is a problem somewhere that needs to be addressed.

If you think that the *.mo files should belong in the archive generated by make dist, then it means that in the Makefile, the dist target should depend on the all target. Otherwise, we do not leverage the ability of make to resolve dependency trees in its Makefile.

I’m still not sure whether doing that is a good idea, though. I’ve wanted to install Zonemaster components by running cpanm . in the source root and on a freshly checked out Git tree, from what I remember, I’ve ended up with incomplete installations that were missing the *.mo files. Something’s missing no matter how you look at the problem.

marc-vanderwal avatar Jul 03 '25 05:07 marc-vanderwal

@marc-vanderwal, is your suggestion that "make dist" should automatically run "make all" first? If that is the only change that you suggest then I am not against it. Do you know to make that happen?

matsduf avatar Jul 03 '25 07:07 matsduf