summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorDaniel Markus <daniel.markus@leica-geosystems.com>2015-04-09 11:18:59 +0200
committerMartin Jansa <Martin.Jansa@gmail.com>2015-04-21 13:03:09 +0200
commit5f60c8ce812cf9caab16aa50c0ba41c512314f14 (patch)
treee483965d1b36ecd27544ff3e6ce805534eda79c3 /meta-oe
parent324b300bdf6018070bbfa292dc8ccc55cc665f43 (diff)
downloadmeta-openembedded-5f60c8ce812cf9caab16aa50c0ba41c512314f14.tar.gz
socorro-syms: Limit the search for repository to within the build directory
When we search for the git repository associated with a file and the there's no repository associated, we incorrectly find the yocto repository itself. To prevent the search from finding an incorrect repository, we only accept repositories found within the build directory. Signed-off-by: Daniel Markus <daniel.markus@leica-geosystems.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/classes/socorro-syms.bbclass39
1 files changed, 24 insertions, 15 deletions
diff --git a/meta-oe/classes/socorro-syms.bbclass b/meta-oe/classes/socorro-syms.bbclass
index 7a7b20859..3f6ae6319 100644
--- a/meta-oe/classes/socorro-syms.bbclass
+++ b/meta-oe/classes/socorro-syms.bbclass
@@ -42,7 +42,7 @@ python symbol_file_preprocess() {
42 breakpad_sym_file_path = os.path.join(breakpad_syms_dir, sym_file_name) 42 breakpad_sym_file_path = os.path.join(breakpad_syms_dir, sym_file_name)
43 socorro_sym_file_path = os.path.join(socorro_syms_dir, sym_file_name) 43 socorro_sym_file_path = os.path.join(socorro_syms_dir, sym_file_name)
44 44
45 create_socorro_sym_file(breakpad_sym_file_path, socorro_sym_file_path) 45 create_socorro_sym_file(d, breakpad_sym_file_path, socorro_sym_file_path)
46 46
47 arrange_socorro_sym_file(socorro_sym_file_path, socorro_syms_dir) 47 arrange_socorro_sym_file(socorro_sym_file_path, socorro_syms_dir)
48 48
@@ -50,7 +50,16 @@ python symbol_file_preprocess() {
50} 50}
51 51
52 52
53def create_socorro_sym_file(breakpad_sym_file_path, socorro_sym_file_path): 53def run_command(command, directory):
54
55 (output, error) = bb.process.run(command, cwd=directory)
56 if error:
57 raise bb.process.ExecutionError(command, error)
58
59 return output.rstrip()
60
61
62def create_socorro_sym_file(d, breakpad_sym_file_path, socorro_sym_file_path):
54 63
55 # In the symbol file, all source files are referenced like the following. 64 # In the symbol file, all source files are referenced like the following.
56 # FILE 123 /path/to/some/File.cpp 65 # FILE 123 /path/to/some/File.cpp
@@ -61,18 +70,19 @@ def create_socorro_sym_file(breakpad_sym_file_path, socorro_sym_file_path):
61 70
62 for line in breakpad_sym_file: 71 for line in breakpad_sym_file:
63 if line.startswith("FILE "): 72 if line.startswith("FILE "):
64 socorro_sym_file.write(socorro_file_reference(line)) 73 socorro_sym_file.write(socorro_file_reference(d, line))
65 else: 74 else:
66 socorro_sym_file.write(line) 75 socorro_sym_file.write(line)
67 76
68 return 77 return
69 78
70 79
71def socorro_file_reference(line): 80def socorro_file_reference(d, line):
72 81
73 # The 3rd position is the file path. See example above. 82 # The 3rd position is the file path. See example above.
74 source_file_path = line.split()[2] 83 source_file_path = line.split()[2]
75 source_file_repo_path = repository_path(os.path.normpath(source_file_path)) 84 source_file_repo_path = repository_path(
85 d, os.path.normpath(source_file_path))
76 86
77 # If the file could be found in any repository then replace it with the 87 # If the file could be found in any repository then replace it with the
78 # repository's path. 88 # repository's path.
@@ -82,7 +92,7 @@ def socorro_file_reference(line):
82 return line 92 return line
83 93
84 94
85def repository_path(source_file_path): 95def repository_path(d, source_file_path):
86 96
87 if not os.path.isfile(source_file_path): 97 if not os.path.isfile(source_file_path):
88 return None 98 return None
@@ -91,6 +101,14 @@ def repository_path(source_file_path):
91 (output, error) = bb.process.run("git status", 101 (output, error) = bb.process.run("git status",
92 cwd=os.path.dirname(source_file_path)) 102 cwd=os.path.dirname(source_file_path))
93 if not error: 103 if not error:
104 # Make sure the git repository we just found wasn't the yocto repository
105 # itself, i.e. the root of the repository we're looking for must be a
106 # child of the build directory TOPDIR.
107 git_root_dir = run_command(
108 "git rev-parse --show-toplevel", os.path.dirname(source_file_path))
109 if not git_root_dir.startswith(d.getVar("TOPDIR", True)):
110 return None
111
94 return git_repository_path(source_file_path) 112 return git_repository_path(source_file_path)
95 113
96 # Here we can add support for other VCSs like hg, svn, cvs, etc. 114 # Here we can add support for other VCSs like hg, svn, cvs, etc.
@@ -99,15 +117,6 @@ def repository_path(source_file_path):
99 return None 117 return None
100 118
101 119
102def run_command(command, directory):
103
104 (output, error) = bb.process.run(command, cwd=directory)
105 if error:
106 raise bb.process.ExecutionError(command, error)
107
108 return output.rstrip()
109
110
111def is_local_url(url): 120def is_local_url(url):
112 121
113 return \ 122 return \