servo: Merge #4755 - Move snapshot dir inside the source dir by default (from mbrubeck:cache-dir); r=metajack
authorMatt Brubeck <>
Wed, 28 Jan 2015 16:06:52 -0700
changeset 335650 99dba96dac7dd8374848bfa1a6105e63440f9169
parent 335649 3dcc68282399dded833e8ca2dbf155150a9a1f4b
child 335651 88ed4b79fa69e36719b2a46e5393d7a442571598
push id31307
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)
servo: Merge #4755 - Move snapshot dir inside the source dir by default (from mbrubeck:cache-dir); r=metajack As discussed in a previous weekly meeting, this avoids changing any directories outside the repo, which is better for some automation scenarios. The servobuild.example file has a "cache-dir" setting that restores the previous default location of `~/.servo`, which is useful for developers working with multiple clones on the same machine. I'm not sure which setting we want to use for our buildbot hosts. r? @metajack or @larsbergstrom Source-Repo: Source-Revision: 74e32d119c864f527510a3ca008f88c26818df0b
--- a/servo/python/servo/
+++ b/servo/python/servo/
@@ -49,27 +49,29 @@ class CommandBase(object):
     This mostly handles configuration management, such as .servobuild."""
     def __init__(self, context):
         self.context = context
         if not hasattr(self.context, "bootstrapped"):
             self.context.bootstrapped = False
-        if not hasattr(self.context, "sharedir"):
-            self.context.sharedir = path.join(path.expanduser("~/"), ".servo")
         config_path = path.join(context.topdir, ".servobuild")
         if path.exists(config_path):
             self.config = toml.loads(open(config_path).read())
             self.config = {}
         # Handle missing/default items
         self.config.setdefault("tools", {})
+        self.config["tools"].setdefault("cache-dir",
+                                        path.join(context.topdir, ".servo"))
+        # Allow "~" in cache-dir
+        context.sharedir = path.expanduser(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", "")
         if not self.config["tools"]["system-rust"]:
             self.config["tools"]["rust-root"] = path.join(
                 context.sharedir, "rust", *self.rust_snapshot_path().split("/"))
         if not self.config["tools"]["system-cargo"]:
--- a/servo/servobuild.example
+++ b/servo/servobuild.example
@@ -1,10 +1,13 @@
 # Tool options
+# Where Rust compiler snapshots and other downloads will be stored.  Can be
+# shared by multiple Servo reposities.  Defaults to <servo-repo>/.servo
+cache-dir = "~/.servo"
 # If system-rust is true, will use rustc/rustdoc from the path, or if
 # rust-root is specified, will make sure that rust-root is in the path
 # when building. Similarly for Cargo. This takes care of PATH as well as
 system-rust = false
 rust-root = "/path/to/rust"
 system-cargo = false
 cargo-root = "/path/to/cargo"