Closed vigneshraman closed 2 years ago
Please could you confirm if we can manually replace the strings (po
with PACKAGE
and 2020
with 2021
) to fix this issue. Thanks.
msginit is getting annoying. There is no way to control its output in a reliable manner. This is why we ask diff to ignore many lines when checking whether the test passes.
I think that changing 'po' to 'PACKAGE' should be enough. But actually, I'd like to understand why it fails on your setup and not on mine nor on the automated tests here on github, if possible.
A better solution maybe would be to get rid of msginit and generate the empty PO files ourselves. I'm unsure, because I prefer to not dupplicate code, but msginit might be a specific case here.
This is (again) a problem with /usr/lib/gettext/project-id
's obsolete and dumb heuristic for detecting project name and version from directory names in cwd
.
But actually, I'd like to understand why it fails on your setup and not on mine nor on the automated tests here on github, if possible.
It fails only in OBS environment, https://build.opensuse.org/package/show/home:vigneshraman/po4a https://bugzilla.opensuse.org/show_bug.cgi?id=1193355
When I build the package in my local setup (debian 11) it builds fine. I will try to check if there is any difference in the setup which causes the failure only in OBS.
Let me make an educated guess: the name of the directory containing your project is po4a
on your laptop.
Now rename it and try running the tests again:
$ cd ..
$ mv po4a foo
$ cd foo
$ perl Build.PL
$ ./Buid test verbose=1
That's a reproducible failure.
Any human will clone the project po4a and get a directory named po4a
for the project. From this name, project-id
, from /usr/lib/gettext/project-id
infers a project name po
and a version 4
... All our tests depend on this checkout directory name. That's an assumption that is easily broken by automatic build systems.
Many thanks, @jnavila, I was struggling remembering about this error that already bugged us in the past.
I just had a quick grep at the gettext sources, and it seems that this script is only used in msginit to guess the PACKAGE and VERSION when the Project-Id-Version
header is missing in the input POT (or still defined to the default literal string PACKAGE VERSION
).
The robust solution would be to:
project-id
as it will try to guess the project name while we probably are in the documentation of that project.Does it sound reasonnable?
Ok, this won't work in split mode, for example for the subtest "Split settings, no po". In this case, we use msginit for each language to turn the POT file into a PO file. Maybe we could circumvent the pb by generating an empty PO file ourselves and then msgmerging it against the POT file, but it's getting hairly, isn't it?
Maybe it'd be more effective to extend the list of patterns that we ignore when diffing PO files (in PODIFF of TestHelper) ?
@vigneshraman could you please try if the current git version works better? If it's more convinient to you, applying the commit mentionned just above (25d0674) onto the last stable version should do the trick.
@mquinson, Applied the patch to version 0.62 and 0.65 and checked. The build failed in OBS, 0.62 - https://build.opensuse.org/package/show/home:vigneshraman/po4a-fix 0.65 - https://build.opensuse.org/package/show/home:vigneshraman/po4a-65-fix
Renamed the git folder from po4a
to foo
and built the test. It resulted in same issue.
@vigneshraman thanks for the quick reaction!
I'm sorry, my patch worked for your previous problem, using "language up" in the header, but when it's in german, the string to ignore is "German" not "Language german". Could you please give it another try with cb13a2679aed19153c7cd16ce865103a1180c60b on top of it?
TBH I really dislike the way msginit infers these values and would strongly prefer that po4a generate identical pot files wherever it is run.
I'm sorry, my patch worked for your previous problem, using "language up" in the header, but when it's in german, the string to ignore is "German" not "Language german". Could you please give it another try with cb13a26 on top of it?
@mquinson we may need to take care of both,
1) German/Spanish/French/Italian translations for po package
2) Language up translations for po package
The updated patch handles only 1) and it still fails with same issue.
Another options: override the behavior of project-id
project-id
first looks for a configure file which contains a PACKAGE_VERSION=
or PACKAGE=
. We could shortcut the recursive project name search from directory names by creating the configure file with the required strings project-id
is run as a full path command built by concatenating the environment variable GETTEXTLIBDIR_SRCDIR
before. So, we can override it and provide our version of project-id
That would be really cool, @jnavila :)
I think that this would mainly be useful for tests, don't you think? For the normal usage, I guess that we don't really care about the values used by project-id
to seed the PO files.
But if you want to do so in any case, why not. The packaging will become a bit harder, as the po4a script needs to know where its parts are installed, but that's not such a big deal either.
I think that this would mainly be useful for tests, don't you think? For the normal usage, I guess that we don't really care about the values used by
project-id
to seed the PO files.
I have to disagree: users of po4a surely don't want to have their po files changed depending on where they have checked out their source files or even when they are running them (the year copyright change is really annoying). They can run tests that check their po files and may be facing the same issues.
@jnavila: I did not test it, but as far as I understand its source code, msginit is only using project-id
when the POT file provided as an input does not have a Project-Id-Version
header. This happens very often in our tests, but much less in the classical workflow of our users. Am I misunderstanding something?
@vigneshraman: I would think that my code deals with both cases you cited. (.*?)
should match both German
and Language up
in the same way. If your test reports a failure with this version too, I'm puzzled.
@vigneshraman: I would think that my code deals with both cases you cited.
(.*?)
should match bothGerman
andLanguage up
in the same way. If your test reports a failure with this version too, I'm puzzled.
This is the failure log - https://build.opensuse.org/build/home:vigneshraman/Debian_11/x86_64/po4a-fix/_log
https://build.opensuse.org/package/show/home:vigneshraman/po4a-fix
I closed the bug because I tested running the tests from a checkout called aze
instead of po4a
and it worked with that patch. Feel free to reopen if problems remain.
@mquinson it worked with the updated patch. Thank you :)
Package po4a fails to build in OBS for Debian_11 with the below error,
https://build.opensuse.org/package/show/home:vigneshraman/po4a
Tested with version 0.62 and 0.65
Reported the issue in https://bugzilla.opensuse.org/show_bug.cgi?id=1193355
As Andreas mentioned replaced
po
withPACKAGE
and2020
with2021
for all the failing po files and the build was successful.