Created attachment 158981 [details] [review] Bug 35342: Use a Makefile to manage PO files There were some problems recently involving gulp and PO files, which are still unresolved at the time of writing. Debugging this is hard and time-consuming (failures are hard to reproduce) Why make/a Makefile ? * Creating/updating PO files is essentially passing a list of input files to a command that will produce a new/updated output file, and that's exactly what make does * It builds only what's needed by default (if source files haven't changed, no need to rebuild the .pot, and so .po files don't need to be updated either) * It handles parallelism well To use the Makefile, you need to be at the root directory of Koha, and then you can run: make -f misc/translator/Makefile help To have a list of available targets make -f misc/translator/Makefile all To update all PO files make -f misc/translator/Makefile pot To rebuild all POT files make -f misc/translator/Makefile en-GB To update all en-GB PO files make -f misc/translator/Makefile misc/translator/Koha-installer.pot To update that particular file By default, it won't build a target (output file) if its prerequisites (input files) are older than the target. It can be forced with -B/--always-make By default, all targets are built sequentially. To enable parallelism, use -j/--jobs Multiple targets can be specified on the command line, so it's possible to do: make -f misc/translator/Makefile -j -B en-GB fr-FR gulpfile.js is updated to uses this Makefile This patch also includes a fix in Koha/Database/Columns.pm (a translated empty string caused gettext to emit a warning and to place the header in the middle of the .po/.pot file)
In one of the many attempts to find a solution to bug 35332 I tried to use a Makefile instead, and haven't been able to reproduce the problem with it, so.. I guess this is a possible fix ? Certainly not for 23.11, but I think it's a robust solution for future releases I compared with podiff2 (https://github.com/eshagh79/podiff2) the produced POT files to what master does and it found no differences (it only compares msgid I think, not comments)
Created attachment 158992 [details] [review] Bug 35342: Use a Makefile to manage PO files There were some problems recently involving gulp and PO files, which are still unresolved at the time of writing. Debugging this is hard and time-consuming (failures are hard to reproduce) Why make/a Makefile ? * Creating/updating PO files is essentially passing a list of input files to a command that will produce a new/updated output file, and that's exactly what make does * It builds only what's needed by default (if source files haven't changed, no need to rebuild the .pot, and so .po files don't need to be updated either) * It handles parallelism well To use the Makefile, you need to be at the root directory of Koha, and then you can run: make -f misc/translator/Makefile help To have a list of available targets make -f misc/translator/Makefile all To update all PO files make -f misc/translator/Makefile pot To rebuild all POT files make -f misc/translator/Makefile en-GB To update all en-GB PO files make -f misc/translator/Makefile misc/translator/Koha-installer.pot To update that particular file By default, it won't build a target (output file) if its prerequisites (input files) are older than the target. It can be forced with -B/--always-make By default, all targets are built sequentially. To enable parallelism, use -j/--jobs Multiple targets can be specified on the command line, so it's possible to do: make -f misc/translator/Makefile -j -B en-GB fr-FR gulpfile.js is updated to uses this Makefile This patch also includes a fix in Koha/Database/Columns.pm (a translated empty string caused gettext to emit a warning and to place the header in the middle of the .po/.pot file)
Could you consider providing a perl script instead? :)
(In reply to Jonathan Druart from comment #4) > Could you consider providing a perl script instead? :) Why ? I remember we talked about the readability issue on IRC but that can be fixed. Is there something else ? A Makefile seems like the best tool for this job
Could I suggest, that we keep the idea of a Makefile (which I like) but use a more user friendly variant? Check out just at https://github.com/casey/just. It's portable and the documentation is very good. It's basically the same thing w/o much of the arcane syntax.
'just' looks more like a gulp alternative than a make alternative. It is fairly new (1.0 was released in 2022) and is not packaged in Debian stable. Who knows if it will still be around in 5 years ? And it looks like it would rebuild everything even if no files changed. I am curious about what an equivalent justfile would look like, but my preference still goes to make for now.
You are right to be sceptical, however just is currently available in sid (unstable) and trixie (testing) repos. For reference: https://packages.debian.org/search?keywords=just. I'll try to translate the Makefile into a justfile for a comparison.
It's still a new dependency, so please think thoroughly if the benefit is high enough.
This is all valid. Let's wait for just to be available in debian stable before thinking of integrating it. For now I'd like to eradicate gulp completely and thankfully this was the heavy part. Therefore let's go w/ the Makefile.
Sorry, doesn't apply anymore.