зеркало из https://github.com/mozilla/gecko-dev.git
bug 1388820 - remove repo manifest support from symbolstore.py. r=chmanchester
MozReview-Commit-ID: LbDc6YKGpqX --HG-- extra : rebase_source : 09a253226fbd8dd25a4bdd6f3337dea7df109fa1
This commit is contained in:
Родитель
c417be49de
Коммит
3237c93073
|
@ -40,7 +40,6 @@ import concurrent.futures
|
|||
import multiprocessing
|
||||
|
||||
from optparse import OptionParser
|
||||
from xml.dom.minidom import parse
|
||||
|
||||
from mozpack.copier import FileRegistry
|
||||
from mozpack.manifests import (
|
||||
|
@ -377,7 +376,6 @@ class Dumper:
|
|||
copy_debug=False,
|
||||
vcsinfo=False,
|
||||
srcsrv=False,
|
||||
repo_manifest=None,
|
||||
file_mapping=None):
|
||||
# popen likes absolute paths, at least on windows
|
||||
self.dump_syms = os.path.abspath(dump_syms)
|
||||
|
@ -391,8 +389,6 @@ class Dumper:
|
|||
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']
|
||||
|
@ -409,56 +405,6 @@ class Dumper:
|
|||
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":
|
||||
return
|
||||
# First, get remotes.
|
||||
def ensure_slash(u):
|
||||
if not u.endswith("/"):
|
||||
return u + "/"
|
||||
return u
|
||||
remotes = dict([(r.getAttribute("name"), ensure_slash(r.getAttribute("fetch"))) for r in doc.getElementsByTagName("remote")])
|
||||
# And default remote.
|
||||
default_remote = None
|
||||
if doc.getElementsByTagName("default"):
|
||||
default_remote = doc.getElementsByTagName("default")[0].getAttribute("remote")
|
||||
# Now get projects. Assume they're relative to repo_manifest.
|
||||
base_dir = os.path.abspath(os.path.dirname(repo_manifest))
|
||||
for proj in doc.getElementsByTagName("project"):
|
||||
# name is the repository URL relative to the remote path.
|
||||
name = proj.getAttribute("name")
|
||||
# path is the path on-disk, relative to the manifest file.
|
||||
path = proj.getAttribute("path")
|
||||
# revision is the changeset ID.
|
||||
rev = proj.getAttribute("revision")
|
||||
# remote is the base URL to use.
|
||||
remote = proj.getAttribute("remote")
|
||||
# remote defaults to the <default remote>.
|
||||
if not remote:
|
||||
remote = default_remote
|
||||
# path defaults to name.
|
||||
if not path:
|
||||
path = name
|
||||
if not (name and path and rev and remote):
|
||||
print("Skipping project %s" % proj.toxml())
|
||||
continue
|
||||
remote = remotes[remote]
|
||||
# Turn git URLs into http URLs so that urljoin works.
|
||||
if remote.startswith("git:"):
|
||||
remote = "http" + remote[3:]
|
||||
# Add this project to srcdirs.
|
||||
srcdir = os.path.join(base_dir, path)
|
||||
self.srcdirs.append(srcdir)
|
||||
# And cache its VCS file info. Currently all repos mentioned
|
||||
# in a repo manifest are assumed to be git.
|
||||
root = urlparse.urljoin(remote, name)
|
||||
Dumper.srcdirRepoInfo[srcdir] = GitRepoInfo(srcdir, rev, root)
|
||||
|
||||
# subclasses override this
|
||||
def ShouldProcess(self, file):
|
||||
return True
|
||||
|
@ -868,11 +814,6 @@ def main():
|
|||
parser.add_option("-i", "--source-index",
|
||||
action="store_true", dest="srcsrv", default=False,
|
||||
help="Add source index information to debug files, making them suitable for use in a source server.")
|
||||
parser.add_option("--repo-manifest",
|
||||
action="store", dest="repo_manifest",
|
||||
help="""Get source information from this XML manifest
|
||||
produced by the `repo manifest -r` command.
|
||||
""")
|
||||
parser.add_option("--install-manifest",
|
||||
action="append", dest="install_manifests",
|
||||
default=[],
|
||||
|
@ -906,7 +847,6 @@ to canonical locations in the source repository. Specify
|
|||
srcdirs=options.srcdir,
|
||||
vcsinfo=options.vcsinfo,
|
||||
srcsrv=options.srcsrv,
|
||||
repo_manifest=options.repo_manifest,
|
||||
file_mapping=file_mapping)
|
||||
|
||||
dumper.Process(args[2])
|
||||
|
|
|
@ -214,32 +214,6 @@ class TestGetVCSFilename(HelperMixin, unittest.TestCase):
|
|||
symbolstore.GetVCSFilename(filename, [self.test_dir])[0])
|
||||
|
||||
|
||||
class TestRepoManifest(HelperMixin, unittest.TestCase):
|
||||
def testRepoManifest(self):
|
||||
manifest = os.path.join(self.test_dir, "sources.xml")
|
||||
open(manifest, "w").write("""<?xml version="1.0" encoding="UTF-8"?>
|
||||
<manifest>
|
||||
<remote fetch="http://example.com/foo/" name="foo"/>
|
||||
<remote fetch="git://example.com/bar/" name="bar"/>
|
||||
<default remote="bar"/>
|
||||
<project name="projects/one" revision="abcd1234"/>
|
||||
<project name="projects/two" path="projects/another" revision="ffffffff" remote="foo"/>
|
||||
<project name="something_else" revision="00000000" remote="bar"/>
|
||||
</manifest>
|
||||
""")
|
||||
# Use a source file from each of the three projects
|
||||
file1 = os.path.join(self.test_dir, "projects", "one", "src1.c")
|
||||
file2 = os.path.join(self.test_dir, "projects", "another", "src2.c")
|
||||
file3 = os.path.join(self.test_dir, "something_else", "src3.c")
|
||||
d = symbolstore.Dumper("dump_syms", "symbol_path",
|
||||
repo_manifest=manifest)
|
||||
self.assertEqual("git:example.com/bar/projects/one:src1.c:abcd1234",
|
||||
symbolstore.GetVCSFilename(file1, d.srcdirs)[0])
|
||||
self.assertEqual("git:example.com/foo/projects/two:src2.c:ffffffff",
|
||||
symbolstore.GetVCSFilename(file2, d.srcdirs)[0])
|
||||
self.assertEqual("git:example.com/bar/something_else:src3.c:00000000",
|
||||
symbolstore.GetVCSFilename(file3, d.srcdirs)[0])
|
||||
|
||||
if target_platform() == 'WINNT':
|
||||
class TestFixFilenameCase(HelperMixin, unittest.TestCase):
|
||||
def test_fix_filename_case(self):
|
||||
|
|
Загрузка…
Ссылка в новой задаче