mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
auto merge of #3902 : mbrubeck/servo/share_directory, r=jdm
This is @acmiyaguchi's already-reviewed patch from #3388, rebased and squashed onto servo master. Fixes #3353.
This commit is contained in:
commit
5dae1de2f5
4 changed files with 21 additions and 8 deletions
1
cargo-nightly-build
Normal file
1
cargo-nightly-build
Normal file
|
@ -0,0 +1 @@
|
||||||
|
2014-10-21
|
|
@ -37,7 +37,7 @@ for t in "${tasks[@]}"; do
|
||||||
if [ "${TRAVIS_BRANCH}" = "master" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ]
|
if [ "${TRAVIS_BRANCH}" = "master" ] && [ "${TRAVIS_PULL_REQUEST}" = "false" ]
|
||||||
then
|
then
|
||||||
mkdir -p target/doc
|
mkdir -p target/doc
|
||||||
cp -R rust/doc/* target/doc/
|
cp -R ~/.servo/rust/$(cat rust-snapshot-hash)*/doc/* target/doc/
|
||||||
cp etc/doc.servo.org/* target/doc/
|
cp etc/doc.servo.org/* target/doc/
|
||||||
./mach doc # After copying rust/doc, so that the crate index is correct.
|
./mach doc # After copying rust/doc, so that the crate index is correct.
|
||||||
sudo pip install ghp-import
|
sudo pip install ghp-import
|
||||||
|
|
|
@ -78,7 +78,7 @@ class MachCommands(CommandBase):
|
||||||
help='Force download even if a snapshot already exists')
|
help='Force download even if a snapshot already exists')
|
||||||
def bootstrap_rustc(self, force=False):
|
def bootstrap_rustc(self, force=False):
|
||||||
rust_dir = path.join(
|
rust_dir = path.join(
|
||||||
self.context.topdir, "rust", *self.rust_snapshot_path().split("/"))
|
self.context.sharedir, "rust", *self.rust_snapshot_path().split("/"))
|
||||||
if not force and path.exists(path.join(rust_dir, "bin", "rustc")):
|
if not force and path.exists(path.join(rust_dir, "bin", "rustc")):
|
||||||
print("Snapshot Rust compiler already downloaded.", end=" ")
|
print("Snapshot Rust compiler already downloaded.", end=" ")
|
||||||
print("Use |bootstrap_rust --force| to download again.")
|
print("Use |bootstrap_rust --force| to download again.")
|
||||||
|
@ -107,7 +107,8 @@ class MachCommands(CommandBase):
|
||||||
action='store_true',
|
action='store_true',
|
||||||
help='Force download even if cargo already exists')
|
help='Force download even if cargo already exists')
|
||||||
def bootstrap_cargo(self, force=False):
|
def bootstrap_cargo(self, force=False):
|
||||||
cargo_dir = path.join(self.context.topdir, "cargo")
|
cargo_dir = path.join(self.context.sharedir, "cargo",
|
||||||
|
self.cargo_build_id())
|
||||||
if not force and path.exists(path.join(cargo_dir, "bin", "cargo")):
|
if not force and path.exists(path.join(cargo_dir, "bin", "cargo")):
|
||||||
print("Cargo already downloaded.", end=" ")
|
print("Cargo already downloaded.", end=" ")
|
||||||
print("Use |bootstrap_cargo --force| to download again.")
|
print("Use |bootstrap_cargo --force| to download again.")
|
||||||
|
@ -115,11 +116,12 @@ class MachCommands(CommandBase):
|
||||||
|
|
||||||
if path.isdir(cargo_dir):
|
if path.isdir(cargo_dir):
|
||||||
shutil.rmtree(cargo_dir)
|
shutil.rmtree(cargo_dir)
|
||||||
os.mkdir(cargo_dir)
|
os.makedirs(cargo_dir)
|
||||||
|
|
||||||
tgz_file = "cargo-nightly-%s.tar.gz" % host_triple()
|
tgz_file = "cargo-nightly-%s.tar.gz" % host_triple()
|
||||||
# FIXME(#3582): use https.
|
# FIXME(#3582): use https.
|
||||||
nightly_url = "http://static.rust-lang.org/cargo-dist/2014-10-21/%s" % tgz_file
|
nightly_url = "http://static.rust-lang.org/cargo-dist/%s/%s" % \
|
||||||
|
(self.cargo_build_id(), tgz_file)
|
||||||
|
|
||||||
download("Cargo nightly", nightly_url, tgz_file)
|
download("Cargo nightly", nightly_url, tgz_file)
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,9 @@ class CommandBase(object):
|
||||||
if not hasattr(self.context, "bootstrapped"):
|
if not hasattr(self.context, "bootstrapped"):
|
||||||
self.context.bootstrapped = False
|
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")
|
config_path = path.join(context.topdir, ".servobuild")
|
||||||
if path.exists(config_path):
|
if path.exists(config_path):
|
||||||
self.config = toml.loads(open(config_path).read())
|
self.config = toml.loads(open(config_path).read())
|
||||||
|
@ -68,10 +71,10 @@ class CommandBase(object):
|
||||||
self.config["tools"].setdefault("cargo-root", "")
|
self.config["tools"].setdefault("cargo-root", "")
|
||||||
if not self.config["tools"]["system-rust"]:
|
if not self.config["tools"]["system-rust"]:
|
||||||
self.config["tools"]["rust-root"] = path.join(
|
self.config["tools"]["rust-root"] = path.join(
|
||||||
context.topdir, "rust", *self.rust_snapshot_path().split("/"))
|
context.sharedir, "rust", *self.rust_snapshot_path().split("/"))
|
||||||
if not self.config["tools"]["system-cargo"]:
|
if not self.config["tools"]["system-cargo"]:
|
||||||
self.config["tools"]["cargo-root"] = path.join(
|
self.config["tools"]["cargo-root"] = path.join(
|
||||||
context.topdir, "cargo")
|
context.sharedir, "cargo", self.cargo_build_id())
|
||||||
|
|
||||||
self.config.setdefault("build", {})
|
self.config.setdefault("build", {})
|
||||||
self.config["build"].setdefault("android", False)
|
self.config["build"].setdefault("android", False)
|
||||||
|
@ -82,6 +85,7 @@ class CommandBase(object):
|
||||||
self.config["android"].setdefault("toolchain", "")
|
self.config["android"].setdefault("toolchain", "")
|
||||||
|
|
||||||
_rust_snapshot_path = None
|
_rust_snapshot_path = None
|
||||||
|
_cargo_build_id = None
|
||||||
|
|
||||||
def rust_snapshot_path(self):
|
def rust_snapshot_path(self):
|
||||||
if self._rust_snapshot_path is None:
|
if self._rust_snapshot_path is None:
|
||||||
|
@ -90,6 +94,12 @@ class CommandBase(object):
|
||||||
self._rust_snapshot_path = "%s-%s" % (snapshot_hash, host_triple())
|
self._rust_snapshot_path = "%s-%s" % (snapshot_hash, host_triple())
|
||||||
return self._rust_snapshot_path
|
return self._rust_snapshot_path
|
||||||
|
|
||||||
|
def cargo_build_id(self):
|
||||||
|
if self._cargo_build_id is None:
|
||||||
|
filename = path.join(self.context.topdir, "cargo-nightly-build")
|
||||||
|
self._cargo_build_id = open(filename).read().strip()
|
||||||
|
return self._cargo_build_id
|
||||||
|
|
||||||
def build_env(self):
|
def build_env(self):
|
||||||
"""Return an extended environment dictionary."""
|
"""Return an extended environment dictionary."""
|
||||||
env = os.environ.copy()
|
env = os.environ.copy()
|
||||||
|
@ -148,7 +158,7 @@ class CommandBase(object):
|
||||||
Registrar.dispatch("bootstrap-rust", context=self.context)
|
Registrar.dispatch("bootstrap-rust", context=self.context)
|
||||||
if not self.config["tools"]["system-cargo"] and \
|
if not self.config["tools"]["system-cargo"] and \
|
||||||
not path.exists(path.join(
|
not path.exists(path.join(
|
||||||
self.context.topdir, "cargo", "bin", "cargo")):
|
self.config["tools"]["cargo-root"], "bin", "cargo")):
|
||||||
Registrar.dispatch("bootstrap-cargo", context=self.context)
|
Registrar.dispatch("bootstrap-cargo", context=self.context)
|
||||||
|
|
||||||
self.context.bootstrapped = True
|
self.context.bootstrapped = True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue