bug 1275424 - hardcode Rust source paths in symbolstore.py. r?chmanchester
This gives us source file names with repository info in our generated
symbol files, so that crash reports on crash-stats can link to the
correct source files for files from the Rust standard library.
I've hardcoded the source paths that the Rust project uses, which is
not my favorite thing, but there's no simple way to get this information
otherwise.
MozReview-Commit-ID: 6SeaMqH8xfc
--- a/build/moz.configure/rust.configure
+++ b/build/moz.configure/rust.configure
@@ -229,11 +229,14 @@ set_config('RUST_HOST_TARGET', rust_host
def rust_target_env_name(triple):
return triple.upper().replace('-','_')
# We need this to form various Cargo environment variables, as there is no
# uppercase function in make, and we don't want to shell out just for
# converting a string to uppercase.
set_config('RUST_TARGET_ENV_NAME', rust_target_env_name)
+# This is used for putting source info into symbol files.
+set_config('RUSTC_COMMIT', depends(rustc_info)(lambda i: i.commit))
+
# Until we remove all the other Rust checks in old-configure.
add_old_configure_assignment('RUSTC', rustc)
add_old_configure_assignment('RUST_TARGET', rust_target_triple)
--- a/toolkit/crashreporter/tools/symbolstore.py
+++ b/toolkit/crashreporter/tools/symbolstore.py
@@ -389,16 +389,30 @@ class Dumper:
self.archs = ['-a %s' % a for a in archs.split()]
self.srcdirs = [os.path.normpath(self.FixFilenameCase(a)) for a in srcdirs]
self.copy_debug = copy_debug
self.vcsinfo = vcsinfo
self.srcsrv = srcsrv
if repo_manifest:
self.parse_repo_manifest(repo_manifest)
self.file_mapping = file_mapping or {}
+ # Add a static mapping for Rust sources.
+ target_os = buildconfig.substs['OS_ARCH']
+ rust_srcdir = None
+ if target_os == 'WINNT':
+ rust_srcdir = 'C:/projects/rust/src/'
+ elif target_os == 'Darwin':
+ rust_srcdir = '/Users/travis/build/rust-lang/rust/src/'
+ elif target_os == 'Linux':
+ rust_srcdir = '/checkout/src/'
+ if rust_srcdir is not None:
+ self.srcdirs.append(rust_srcdir)
+ Dumper.srcdirRepoInfo[rust_srcdir] = GitRepoInfo(rust_srcdir,
+ buildconfig.substs['RUSTC_COMMIT'],
+ 'https://github.com/rust-lang/rust/')
def parse_repo_manifest(self, repo_manifest):
"""
Parse an XML manifest of repository info as produced
by the `repo manifest -r` command.
"""
doc = parse(repo_manifest)
if doc.firstChild.tagName != "manifest":