aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crosperf/label.py35
1 files changed, 22 insertions, 13 deletions
diff --git a/crosperf/label.py b/crosperf/label.py
index b14c4a73..a55d663c 100644
--- a/crosperf/label.py
+++ b/crosperf/label.py
@@ -72,22 +72,31 @@ class Label(object):
self.chromeos_root = chromeos_root
if not chrome_src:
- self.chrome_src = os.path.join(
- self.chromeos_root, '.cache/distfiles/target/chrome-src-internal')
- if not os.path.exists(self.chrome_src):
- self.chrome_src = os.path.join(self.chromeos_root,
- '.cache/distfiles/target/chrome-src')
- # Chrome source location has changed and we have to support
- # old and new path.
- if not os.path.exists(self.chrome_src):
- self.chrome_src = os.path.join(self.chromeos_root,
- '.cache/distfiles/chrome-src-internal')
+ # Old and new chroots may have different chrome src locations.
+ # The path also depends on the chrome build flags.
+ # Give priority to chrome-src-internal.
+ chrome_src_rel_paths = [
+ '.cache/distfiles/target/chrome-src-internal',
+ '.cache/distfiles/chrome-src-internal',
+ '.cache/distfiles/target/chrome-src',
+ '.cache/distfiles/chrome-src',
+ ]
+ for chrome_src_rel_path in chrome_src_rel_paths:
+ chrome_src_abs_path = os.path.join(self.chromeos_root,
+ chrome_src_rel_path)
+ if os.path.exists(chrome_src_abs_path):
+ chrome_src = chrome_src_abs_path
+ break
+ if not chrome_src:
+ raise RuntimeError('Can not find location of Chrome sources.\n'
+ f'Checked paths: {chrome_src_rel_paths}')
else:
- chromeos_src = misc.CanonicalizePath(chrome_src)
- if not chromeos_src:
+ chrome_src = misc.CanonicalizePath(chrome_src)
+ # Make sure the path exists.
+ if not os.path.exists(chrome_src):
raise RuntimeError("Invalid Chrome src given for label '%s': '%s'." %
(name, chrome_src))
- self.chrome_src = chromeos_src
+ self.chrome_src = chrome_src
self._SetupChecksum()