Closed Bug 1412751 Opened 8 years ago Closed 8 years ago

Missing multilocale.json in non-packaged builds

Categories

(Core :: Internationalization, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: zbraniecki, Assigned: zbraniecki)

References

Details

Attachments

(1 file, 1 obsolete file)

In bug 1362617 we added ./dist/bin/res/multilocale.json, but we added it as a package step. That means that if a developer does `./mach build` on mozilla-central and then try `./mach run` he'll launch Firefox without `multilocale.json`. We need to either make sure that we can operate in a runtime without it, or add it to the build step as well.
Pike, do you have a preference?
Flags: needinfo?(l10n)
Blocks: 1402061
Depends on: 1362617
Having it always be there gives less chance for surprises, so I'd favor to add a build step.
Flags: needinfo?(l10n)
(In reply to Axel Hecht [:Pike] from comment #2) > Having it always be there gives less chance for surprises, so I'd favor to > add a build step. I have a mild preference for this too. Man, this has been a crazy rabbit's hole. Stay strong, Gandalf!
Michael - where should I put the dependency (I only need on `multilocale.json`) for the build target?
Flags: needinfo?(mshal)
I know this is not what we'd like to do, but I wrote a simple ugly hack that does the job. I duplicated the `multilocale.json` target from packager.mk to toolkit/locales/Makefile.in and added it as a dependency on `libs`. The interesting trick is that in there, I could not use the `$(DIST)/$(RESPATH)/res` because RESPATH/BINPATH are undefined. So I used the `FINAL_TARGET`. Maybe the solution will be to extract this code to a separate `mk` linked from both packager.mk and toolkit/locales/Makefile.in? If we can close the gap between RESPATH/BINPATH and FINAL_TARGET. Leaving it off to :mshal who said he'll take a look.
Attached patch gen-multilocale.patch (obsolete) — Splinter Review
For things that are required for 'mach build', we prefer to have them in moz.build so that we can eventually build with a non-make backend. Packaging and l10n aren't part of that initial work, so it's ok for that stuff to be in the Makefiles. As such, I'd like to use a GENERATED_FILES script in toolkit/locales to generate the file during build if possible. We can also call the script from the package and l10n entry-points in packager.mk so that if the file format changes, it's just done in one place. This patch should show what I'm intending. I believe it maintains the existing multilocale.json files that we have during package and installers-%, and generates an 'en-US' multilocale.json during build. Is en-US only the intended result for 'mach build'? Or does it need to be tied into locale settings somehow?
Flags: needinfo?(mshal) → needinfo?(gandalf)
I think that for now it's ok if it is just en-US in 'mach build'. Eventually we may want to tie it to MOZ_CHROME_MULTILOCALE.
Flags: needinfo?(gandalf)
Comment on attachment 8923575 [details] [diff] [review] gen-multilocale.patch Review of attachment 8923575 [details] [diff] [review]: ----------------------------------------------------------------- I like the general idea, just wondering about c-c. ::: toolkit/mozapps/installer/packager.mk @@ +200,4 @@ > # and places it in dist/bin/res - it should be used when packaging a build. > multilocale.json: LOCALES?=$(MOZ_CHROME_MULTILOCALE) > multilocale.json: > + $(call py_action,file_generate,$(topsrcdir)/toolkit/locales/gen_multilocale.py main $(MULTILOCALE_DIR)/multilocale.json $(MDDEPDIR)/multilocale.json.pp $(ALL_LOCALES)) Does this work for comm-central, in both configurations?
Attachment #8923481 - Attachment is obsolete: true
Comment on attachment 8923575 [details] [diff] [review] gen-multilocale.patch The patch works as expected on build, package, repackage and `MOZ_CHROME_MULTILOCALE package`! Thank you :mshal!
Attachment #8923575 - Flags: review?(core-build-config-reviews)
Attachment #8923575 - Flags: feedback+
> Does this work for comm-central, in both configurations? @mshal> gandalf: I think so? I'm not up-to-date on how c-c works, but as long as it recurses into toolkit/locales of the m-c tree it should build for it (with the default en-US output) Jorg, we identified a weakness of the previous approach and :mshal wrote a patch on top of mine that gets the build step executed as part of build as well. We believe it should work in c-c out of the box, but can you verify please? All you need it apply the patch, `rm objdir/dist/bin/res/multilocale.json`, `./mach build` and check if `objdir/dist/bin/res/multilocale.json` is there and has just `["en-US"]`. Thanks!
Flags: needinfo?(jorgk)
There was no multilocale.json on the system when I started. Following the steps from comment #12 I now have two: C:\mozilla-source\comm-central\obj-i686-pc-mingw32\dist\bin\res\multilocale.json C:\mozilla-source\comm-central\obj-i686-pc-mingw32\toolkit\locales\multilocale.json Both are the same and have {"locales": ["en-US"]}
Flags: needinfo?(jorgk)
Thank you! :)
Comment on attachment 8923575 [details] [diff] [review] gen-multilocale.patch Review of attachment 8923575 [details] [diff] [review]: ----------------------------------------------------------------- ::: toolkit/locales/gen_multilocale.py @@ +9,5 @@ > + > +def main(output, *locales): > + locales = list(locales) or ['en-US'] > + locales_output = ['"%s"' % l for l in locales] > + print('{"locales": [%s]}' % (', '.join(locales_output)), file=output) Please try using json.dump for this. I know this is a direct translation of the Makefile, but doing this by hand shouldn't be necessary in python.
Attachment #8923575 - Flags: review?(core-build-config-reviews)
Assignee: nobody → gandalf
Status: NEW → ASSIGNED
Attachment #8923575 - Attachment is obsolete: true
Comment on attachment 8923481 [details] Bug 1412751 - Move the multilocale.json generation to python and add to moz.build. https://reviewboard.mozilla.org/r/194626/#review200214 Thanks for updating this, looks good! ::: toolkit/locales/gen_multilocale.py:13 (Diff revision 4) > +import sys > + > + > +def main(output, *locales): > + locales = list(locales) > + if "en-US" not in locales: Isn't this is equivalent to `if not locales:`, because we either make sure "en-US" is present in packager.mk or call this from moz.build without arguments? Anyway, I don't think it does any harm, but it's a little different from the last iteration.
Attachment #8923481 - Flags: review?(cmanchester) → review+
Yeah I made this change on purpose. We currently have a guard that adds en-US in makefile, but decided to add it here as well, esp that it covers the empty list scenario too. Sorry for not writing a note about it!
Pushed by zbraniecki@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/dcc8d6c79629 Move the multilocale.json generation to python and add to moz.build. r=chmanchester
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Looks like this broke out build: https://treeherder.mozilla.org/#/jobs?repo=comm-central&revision=952762964f408e33d060dd1110cac0626ae5fa51 Linux 32, Mac and and Windows 8 at time of writing, Linux 64 is busted due to bug 1413257. We get: IOError: [Errno 2] No such file or directory: 'c:/builds/moz2_slave/tb-c-cen-w64-ntly-000000000000/build/toolkit/locales/gen_multilocale.py' IOError: [Errno 2] No such file or directory: '/builds/slave/tb-c-cen-lx-ntly-0000000000000/build/toolkit/locales/gen_multilocale.py' Tom, could you also please take a look.
Flags: needinfo?(mozilla)
Flags: needinfo?(gandalf)
From the log: make[3]: Entering directory `/builds/slave/tb-c-cen-lx-ntly-0000000000000/build/objdir-tb/mail/installer' /builds/slave/tb-c-cen-lx-ntly-0000000000000/build/objdir-tb/_virtualenv/bin/python -m mozbuild.action.file_generate /builds/slave/tb-c-cen-lx-ntly-0000000000000/build/toolkit/locales/gen_multilocale.py main ../../dist/bin/res/multilocale.json .deps/multilocale.json.pp en-US Traceback (most recent call last): File "/tools/python27/lib/python2.7/runpy.py", line 162, in _run_module_as_main "__main__", fname, loader, pkg_name) File "/tools/python27/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/builds/slave/tb-c-cen-lx-ntly-0000000000000/build/mozilla/python/mozbuild/mozbuild/action/file_generate.py", line 112, in <module> sys.exit(main(sys.argv[1:])) File "/builds/slave/tb-c-cen-lx-ntly-0000000000000/build/mozilla/python/mozbuild/mozbuild/action/file_generate.py", line 51, in main with open(script, 'r') as fh: IOError: [Errno 2] No such file or directory: '/builds/slave/tb-c-cen-lx-ntly-0000000000000/build/toolkit/locales/gen_multilocale.py' make[3]: *** [multilocale.json] Error 1 make[3]: Leaving directory `/builds/slave/tb-c-cen-lx-ntly-0000000000000/build/objdir-tb/mail/installer'
I'm sorry Jorg, but I do not know what is the cause of the problem. Python seems to report missing `get_multilocale.py` file in ./toolkit/locales, but the file is there: https://hg.mozilla.org/mozilla-central/file/tip/toolkit/locales/gen_multilocale.py It may be best to file a new bug about c-c at this point :(
Flags: needinfo?(gandalf) → needinfo?(jorgk)
Thanks. I filed bug 1413581.
Flags: needinfo?(mozilla)
Flags: needinfo?(jorgk)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: