servo: Merge #11135 - Override $CARGO_HOME only if cargo-home-dir is in .servobuild (from mbrubeck:cargo-home); r=larsbergstrom
authorMatt Brubeck <mbrubeck@limpet.net>
Wed, 11 May 2016 11:37:05 -0700
changeset 338770 6ee8f084d62d980ae39ae106b4242b6e1b0cf75c
parent 338769 8ddf38732474f6104912de3f548f2b9f88aeed50
child 338771 a1cd2c033564b191190787798af9c8a803232b7e
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslarsbergstrom
servo: Merge #11135 - Override $CARGO_HOME only if cargo-home-dir is in .servobuild (from mbrubeck:cargo-home); r=larsbergstrom This preserves the fix from #11097 in the situation where `$CARGO_HOME` and `cargo-home-dir` in `.servobuild` are both present: `.servobuild` should win. But it changes the behavior when `$CARGO_HOME` is present and `.servobuild` is not: Then `$CARGO_HOME` should be used. We now check the following values in order of priority and use the first one that is found: 1. `cargo-home-dir` in `.servobuild` 2. `CARGO_HOME` in the environment 3. default value (`<servo-repo>/.cargo`) r? @larsbergstrom Source-Repo: https://github.com/servo/servo Source-Revision: fcebfcc1130b7b3e74f14c8375f825f148e0f152
servo/python/servo/command_base.py
--- a/servo/python/servo/command_base.py
+++ b/servo/python/servo/command_base.py
@@ -144,18 +144,19 @@ class CommandBase(object):
 
         # Handle missing/default items
         self.config.setdefault("tools", {})
         default_cache_dir = os.environ.get("SERVO_CACHE_DIR",
                                            path.join(context.topdir, ".servo"))
         self.config["tools"].setdefault("cache-dir", default_cache_dir)
         resolverelative("tools", "cache-dir")
 
-        self.config["tools"].setdefault("cargo-home-dir",
-                                        path.join(context.topdir, ".cargo"))
+        default_cargo_home = os.environ.get("CARGO_HOME",
+                                            path.join(context.topdir, ".cargo"))
+        self.config["tools"].setdefault("cargo-home-dir", default_cargo_home)
         resolverelative("tools", "cargo-home-dir")
 
         context.sharedir = self.config["tools"]["cache-dir"]
 
         self.config["tools"].setdefault("system-rust", False)
         self.config["tools"].setdefault("system-cargo", False)
         self.config["tools"].setdefault("rust-root", "")
         self.config["tools"].setdefault("cargo-root", "")