|
27 | 27 | CODECHECKER_ENV = "{codechecker_env}" |
28 | 28 | COMPILE_COMMANDS = "{compile_commands}" |
29 | 29 |
|
30 | | -# Note: unused |
31 | | -START_PATH = r"\/(?:(?!\.\s+)\S)+" |
32 | | -BAZEL_PATHS = { |
33 | | - r"\/sandbox\/processwrapper-sandbox\/\S*\/execroot\/": "/execroot/", |
34 | | - START_PATH + r"\/worker\/build\/[0-9a-fA-F]{16}\/root\/": "", |
35 | | - START_PATH + r"\/[0-9a-fA-F]{32}\/execroot\/": "", |
36 | | - # Running bazel with --spawn_strategy=processwrapper-sandbox |
37 | | - # results in its path being wrongly replaced! |
38 | | - # In that case the 1st then 3rd regex will match and leave the path in a |
39 | | - # half baked state, this regex just finishes the job |
40 | | - r"<string>bazel_codechecker\/": "<string>", |
41 | | -} |
42 | | - |
43 | 30 |
|
44 | 31 | def fail(message, exit_code=1): |
45 | 32 | """ Print error message and return exit code """ |
@@ -199,26 +186,6 @@ def analyze(): |
199 | 186 | fail("Make sure that the target can be built first") |
200 | 187 |
|
201 | 188 |
|
202 | | -def fix_bazel_paths(): |
203 | | - """ Remove Bazel leading paths in all files """ |
204 | | - # Note: unused |
205 | | - stage("Fix CodeChecker output:") |
206 | | - folder = CODECHECKER_FILES |
207 | | - logging.info("Fixing Bazel paths in %s", folder) |
208 | | - counter = 0 |
209 | | - for root, _, files in os.walk(folder): |
210 | | - for filename in files: |
211 | | - fullpath = os.path.join(root, filename) |
212 | | - with open(fullpath, "rt") as data_file: |
213 | | - data = data_file.read() |
214 | | - for pattern, replace in BAZEL_PATHS.items(): |
215 | | - data = re.sub(pattern, replace, data) |
216 | | - with open(fullpath, "w") as data_file: |
217 | | - data_file.write(data) |
218 | | - counter += 1 |
219 | | - logging.info("Fixed Bazel paths in %d files", counter) |
220 | | - |
221 | | - |
222 | 189 | def realpath(filename): |
223 | 190 | """ Return real full absolute path for given filename """ |
224 | 191 | if os.path.exists(filename): |
@@ -296,7 +263,6 @@ def resolve_symlinks(): |
296 | 263 | logging.info("Processed file paths in %d files", files_processed) |
297 | 264 | def update_file_paths(): |
298 | 265 | """ Fix bazel sandbox paths and resolve symbolic links in generated files to real paths """ |
299 | | - #fix_bazel_paths() # this is unnecessary |
300 | 266 | resolve_symlinks() |
301 | 267 |
|
302 | 268 |
|
|
0 commit comments