Closed Bug 746546 Opened 13 years ago Closed 12 years ago

add more info to writemozinfo

Categories

(Testing :: Mozbase, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla24

People

(Reporter: jmaher, Assigned: ahal)

References

Details

(Whiteboard: [mozbase])

Attachments

(2 files, 3 obsolete files)

in automation.py.in, we have a series of variables that are defined during build time substition via the .in filename extension. We need to find a way to incorporate this into mozinfo. The best method I can think of is creating a buildinfo.json.in which would result in buildinfo.json. We can then seed this buildinfo.json into mozinfo.py and provide it through that api. Here is a list of the expanded variables in automation.py.in: #expand _DIST_BIN = __XPC_BIN_PATH__ #expand _IS_WIN32 = len("__WIN32__") != 0 #expand _IS_MAC = __IS_MAC__ != 0 #expand _IS_LINUX = __IS_LINUX__ != 0 #ifdef IS_CYGWIN #expand _IS_CYGWIN = __IS_CYGWIN__ == 1 #else _IS_CYGWIN = False #endif #expand _IS_CAMINO = __IS_CAMINO__ != 0 #expand _BIN_SUFFIX = __BIN_SUFFIX__ #expand _PERL = __PERL__ #expand _DEFAULT_APP = "./" + __BROWSER_PATH__ #expand _CERTS_SRC_DIR = __CERTS_SRC_DIR__ #expand _IS_TEST_BUILD = __IS_TEST_BUILD__ #expand _IS_DEBUG_BUILD = __IS_DEBUG_BUILD__ #expand _CRASHREPORTER = __CRASHREPORTER__ == 1 I believe we will need to provide: DIST_BIN DEFAULT_APP CERTS_SRC_DIR IS_TEST_BUILD IS_DEBUG_BUILD CRASHREPORTER
The simple solution here is just to expand writemozinfo, which we're already using for xpcshell tests: http://mxr.mozilla.org/mozilla-central/source/config/writemozinfo.py We already have debug and crashreporter keys in there, adding a key for --enable-tests would be easy. The paths are a little weird, but it should be straightforward to port the logic we're using from automation-build.mk and binary-location.mk: http://mxr.mozilla.org/mozilla-central/source/build/automation-build.mk http://mxr.mozilla.org/mozilla-central/source/build/binary-location.mk
Assignee: nobody → ted.mielczarek
Summary: allow for mozinfo to include build time information such as default_app → add more info to writemozinfo (default app location, etc)
Attached patch add more info to writemozinfo (obsolete) — Splinter Review
This adds a whole bunch of stuff to writemozinfo: tests_enabled (bool) bin_suffix (string) dist (path) certs_srcdir (path) appname (string, like 'firefox') default_app (string, like 'firefox.exe' or 'Nightly.app/Contents/MacOS/firefox')
Attachment #616341 - Flags: review?(jmaher)
Comment on attachment 616341 [details] [diff] [review] add more info to writemozinfo Review of attachment 616341 [details] [diff] [review]: ----------------------------------------------------------------- thanks for the tests as well. ::: build/pgo/profileserver.py @@ +83,5 @@ > browserEnv["XPCOM_DEBUG_BREAK"] = "warn" > browserEnv["MOZ_JAR_LOG_DIR"] = MOZ_JAR_LOG_DIR > > url = "http://localhost:%d/index.html" % PORT > + appPath = "/Applications/Nightly.app/Contents/MacOS/firefox" #os.path.join(SCRIPT_DIR, automation.DEFAULT_APP) I assume this was accidentally added in ::: config/tests/unit-writemozinfo.py @@ +159,5 @@ > 'MOZ_WIDGET_TOOLKIT':'gtk2', > 'MOZ_CRASHREPORTER':'1'}) > self.assertEqual(True, d['crashreporter']) > > + def testTestsEnabled(self): the name here made me chuckle.
Attachment #616341 - Flags: review?(jmaher) → review+
Oops, good catch. I hacked that in to test something else.
I pushed this to try because it fixes bug 733501, so there are some xpcshell tests that will start being run that weren't previously being run. I'd like to sanity check that they're not all broken.
This patch failed on mac universal builds, because the $(DIST) paths are different for the two halves of the build, and we unify mozinfo.json into the test package. Yuck.
ted, are you looking into this? do you want me or somebody else to look into it?
I think I just need to remove the path info from this patch, and sort it out in a different way in the harnesses.
Blocks: 775756
No longer blocks: 733501
Summary: add more info to writemozinfo (default app location, etc) → add more info to writemozinfo
Blocks: 865349
Flags: needinfo?(ted)
Ted, is this still something you are working on? I can take it over if you are swamped
Nope, go for it.
Assignee: ted → ahalberstadt
Flags: needinfo?(ted)
Going to look into the refactor mentioned in https://bugzilla.mozilla.org/show_bug.cgi?id=866094#c7 at the same time
Status: NEW → ASSIGNED
Not sure if this is what you had in mind.. but this makes the most sense to me. Basically we create the same shortcuts as we did before, except the source info is coming from buildconfig instead of os.environ. All the buildconfig information is copied over 1:1 to mozinfo.json (so you can still access it via mozinfo['substs'] or mozinfo['defines'] etc). This is probably overkill, but I guess it doesn't hurt. There are few things that aren't defined in buildconfig like XPC_BIN_PATH (or DIST_BIN) and CERTS_SRC_DIR. For these I just manually built the paths based on their definitions in the Makefiles. If you know how to properly extract these values from Makefiles, please let me know
Attachment #748223 - Flags: review?(ted)
Attachment #748223 - Flags: feedback?(jmaher)
Just noticed an instance of 'env' that I forgot to change to 'substs'. Fixed in my local patch.
Comment on attachment 748223 [details] [diff] [review] Patch 1.0 - use buildconfig module Review of attachment 748223 [details] [diff] [review]: ----------------------------------------------------------------- this seems pretty sane.
Attachment #748223 - Flags: feedback?(jmaher) → feedback+
Comment on attachment 748223 [details] [diff] [review] Patch 1.0 - use buildconfig module Review of attachment 748223 [details] [diff] [review]: ----------------------------------------------------------------- ::: config/writemozinfo.py @@ +26,2 @@ > d = {} > + d.update([(key, getattr(buildconfig, key)) for key in buildconfig.__all__]) I don't want to do this, there's a *lot* of stuff in buildconfig. I'd rather have a whitelist so we don't proliferate a bunch of useless stuff into mozinfo. Plus we explicitly sanitize some of the values into canonical forms below, I don't want people using the silly build-system-provided values instead of our nice clean values. @@ +87,5 @@ > + d['dist'] = os.path.join(d['topobjdir'], 'dist') > + d['dist_bin'] = os.path.join(d['dist'], 'bin') > + > + if 'certs_srcdir' not in d: > + d['certs_srcdir'] = os.path.join(d['topsrcdir'], 'build', 'pgo', 'certs') I thought I mentioned on the bug or on IRC, but I don't want to put paths in here. That's going to break Mac universal builds, and it's awkward. We should fix the hardcoded paths in a different way.
Attachment #748223 - Flags: review?(ted) → review-
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #15) > ::: config/writemozinfo.py > @@ +26,2 @@ > > d = {} > > + d.update([(key, getattr(buildconfig, key)) for key in buildconfig.__all__]) > > I don't want to do this, there's a *lot* of stuff in buildconfig. I'd rather > have a whitelist so we don't proliferate a bunch of useless stuff into > mozinfo. Plus we explicitly sanitize some of the values into canonical forms > below, I don't want people using the silly build-system-provided values > instead of our nice clean values. Sure, makes sense. > @@ +87,5 @@ > > + d['dist'] = os.path.join(d['topobjdir'], 'dist') > > + d['dist_bin'] = os.path.join(d['dist'], 'bin') > > + > > + if 'certs_srcdir' not in d: > > + d['certs_srcdir'] = os.path.join(d['topsrcdir'], 'build', 'pgo', 'certs') > > I thought I mentioned on the bug or on IRC, but I don't want to put paths in > here. That's going to break Mac universal builds, and it's awkward. We > should fix the hardcoded paths in a different way. Afaict building these paths manually here isn't any different than how automation.py.in currently gets its DIST_BIN and CERTS_SRC_DIR values: http://mxr.mozilla.org/mozilla-central/source/build/automation-build.mk#12 http://mxr.mozilla.org/mozilla-central/source/build/automation-build.mk#16 Like I mentioned, if you know of a better way to get these values let me know. But I'm not sure what else I can do.
Flags: needinfo?(ted)
On irc I learned that mac universal builds are even trickier than I thought. Unfortunately the reason I picked this bug up in the first place was primarily for DIST_BIN. Oh well, might as well finish this up while it's fresh in my mind.
Attachment #616341 - Attachment is obsolete: true
Attachment #748223 - Attachment is obsolete: true
Attachment #749463 - Flags: review?(ted)
Comment on attachment 749463 [details] [diff] [review] Patch 2.0 - address review comments Review of attachment 749463 [details] [diff] [review]: ----------------------------------------------------------------- Thanks, this looks like a nice cleanup. You should be able to remove all the junk around the writemozinfo invocation in configure now as well: http://mxr.mozilla.org/mozilla-central/source/configure.in#9197 ::: build/buildconfig.py @@ +25,5 @@ > value = getattr(config, var) > if isinstance(value, list) and value and isinstance(value[0], tuple): > value = dict(value) > setattr(sys.modules[__name__], var, value) > + __all__.append(var) Doesn't look like you actually need these changes now, do you? ::: config/writemozinfo.py @@ +32,5 @@ > ', '.join(missing)) > > + d = {} > + d['topsrcdir'] = buildconfig.topsrcdir > + d['topobjdir'] = buildconfig.topobjdir I think we should leave these out.
Attachment #749463 - Flags: review?(ted) → review+
Flags: needinfo?(ted)
Comment on attachment 749463 [details] [diff] [review] Patch 2.0 - address review comments Review of attachment 749463 [details] [diff] [review]: ----------------------------------------------------------------- I realized this is going to break the unit tests: http://mxr.mozilla.org/mozilla-central/source/config/tests/unit-writemozinfo.py You can probably fix this fairly simply by doing like substs = env if env else buildconfig.substs ::: config/writemozinfo.py @@ +32,5 @@ > ', '.join(missing)) > > + d = {} > + d['topsrcdir'] = buildconfig.topsrcdir > + d['topobjdir'] = buildconfig.topobjdir I didn't realize we already had topsrcdir in there. Yuck. In any event, I think putting objdir in there is going to break universal builds.
Attachment #749463 - Flags: review+ → review-
Regarding the __all__, it is technically correct to leave it in, but I removed it for the sake of the MNC (minimum necessary change). Pushed some builds to try: https://tbpl.mozilla.org/?tree=Try&rev=5533e97c4c33
Attachment #751146 - Flags: review?(ted)
Attachment #749463 - Attachment is obsolete: true
Comment on attachment 751146 [details] [diff] [review] Patch 3.0 - address review comments Review of attachment 751146 [details] [diff] [review]: ----------------------------------------------------------------- Fix spelling in your commit message. :) ::: config/writemozinfo.py @@ +22,5 @@ > Build a dict containing data about the build configuration from > the environment. > """ > + substs = env or buildconfig.substs > + env = env or os.environ I think you can drop this line, the tests will pass the env dict in directly and otherwise we'll use buildconfig.substs.
Attachment #751146 - Flags: review?(ted) → review+
No, we still need os.environ for 'MOZCONFIG' which isn't getting set anywhere in buildconfig (at least for my configuration). Though the unit test is still failing on try. I'll fix it up and carry the r+ forward.
Fix two failures in the unit test and carry the r+ forward. Try run looks good: https://tbpl.mozilla.org/?tree=Try&rev=81ee28966c14
Attachment #752323 - Flags: review+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: