mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Rename rust-snapshot-hash to rust-nightly-date
… and remove mentions of "snapshots". We now use rust-lang.org nightly builds rather than our own snapshots.
This commit is contained in:
parent
856eea3a0e
commit
b2af8567fa
5 changed files with 36 additions and 37 deletions
|
@ -71,11 +71,11 @@ If you're running servo on a guest machine, make sure 3D Acceleration is switche
|
|||
|
||||
## The Rust compiler
|
||||
|
||||
Servo's build system automatically downloads a snapshot Rust compiler to build itself.
|
||||
Servo's build system automatically downloads a Rust compiler to build itself.
|
||||
This is normally a specific revision of Rust upstream, but sometimes has a
|
||||
backported patch or two.
|
||||
If you'd like to know the snapshot revision of Rust which we use, see
|
||||
`rust-snapshot-hash`.
|
||||
If you'd like to know which nightly build of Rust we use, see
|
||||
`rust-nightly-date`.
|
||||
|
||||
## Building
|
||||
|
||||
|
|
|
@ -103,16 +103,16 @@ class MachCommands(CommandBase):
|
|||
print("export LD_LIBRARY_PATH=%s" % env["LD_LIBRARY_PATH"])
|
||||
|
||||
@Command('bootstrap-rust',
|
||||
description='Download the Rust compiler snapshot',
|
||||
description='Download the Rust compiler',
|
||||
category='bootstrap')
|
||||
@CommandArgument('--force', '-f',
|
||||
action='store_true',
|
||||
help='Force download even if a snapshot already exists')
|
||||
help='Force download even if a copy already exists')
|
||||
def bootstrap_rustc(self, force=False):
|
||||
rust_dir = path.join(
|
||||
self.context.sharedir, "rust", self.rust_snapshot_path())
|
||||
self.context.sharedir, "rust", self.rust_path())
|
||||
if not force and path.exists(path.join(rust_dir, "rustc", "bin", "rustc")):
|
||||
print("Snapshot Rust compiler already downloaded.", end=" ")
|
||||
print("Rust compiler already downloaded.", end=" ")
|
||||
print("Use |bootstrap-rust --force| to download again.")
|
||||
return
|
||||
|
||||
|
@ -120,18 +120,18 @@ class MachCommands(CommandBase):
|
|||
shutil.rmtree(rust_dir)
|
||||
os.makedirs(rust_dir)
|
||||
|
||||
date = self.rust_snapshot_path().split("/")[0]
|
||||
date = self.rust_path().split("/")[0]
|
||||
install_dir = path.join(self.context.sharedir, "rust", date)
|
||||
|
||||
# The Rust compiler is hosted on the nightly server under the date with a name
|
||||
# rustc-nightly-HOST-TRIPLE.tar.gz. We just need to pull down and extract it,
|
||||
# giving a directory name that will be the same as the tarball name (rustc is
|
||||
# in that directory).
|
||||
snapshot_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/%s.tar.gz"
|
||||
% self.rust_snapshot_path())
|
||||
rustc_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/%s.tar.gz"
|
||||
% self.rust_path())
|
||||
tgz_file = rust_dir + '-rustc.tar.gz'
|
||||
|
||||
download_file("Rust compiler", snapshot_url, tgz_file)
|
||||
download_file("Rust compiler", rustc_url, tgz_file)
|
||||
|
||||
print("Extracting Rust compiler...")
|
||||
extract(tgz_file, install_dir)
|
||||
|
@ -144,11 +144,11 @@ class MachCommands(CommandBase):
|
|||
# list.
|
||||
stdlibs = [host_triple(), "arm-linux-androideabi"]
|
||||
for target in stdlibs:
|
||||
snapshot_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/%s/rust-std-nightly-%s.tar.gz"
|
||||
% (date, target))
|
||||
std_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/%s/rust-std-nightly-%s.tar.gz"
|
||||
% (date, target))
|
||||
tgz_file = install_dir + ('rust-std-nightly-%s.tar.gz' % target)
|
||||
|
||||
download_file("Host rust library for target %s" % target, snapshot_url, tgz_file)
|
||||
download_file("Host rust library for target %s" % target, std_url, tgz_file)
|
||||
print("Extracting Rust stdlib for target %s..." % target)
|
||||
extract(tgz_file, install_dir)
|
||||
shutil.copytree(path.join(install_dir, "rust-std-nightly-%s" % target,
|
||||
|
@ -157,7 +157,7 @@ class MachCommands(CommandBase):
|
|||
"rustc", "lib", "rustlib", target))
|
||||
shutil.rmtree(path.join(install_dir, "rust-std-nightly-%s" % target))
|
||||
|
||||
print("Snapshot Rust ready.")
|
||||
print("Rust ready.")
|
||||
|
||||
@Command('bootstrap-rust-docs',
|
||||
description='Download the Rust documentation',
|
||||
|
@ -170,18 +170,18 @@ class MachCommands(CommandBase):
|
|||
rust_root = self.config["tools"]["rust-root"]
|
||||
docs_dir = path.join(rust_root, "doc")
|
||||
if not force and path.exists(docs_dir):
|
||||
print("Snapshot Rust docs already downloaded.", end=" ")
|
||||
print("Rust docs already downloaded.", end=" ")
|
||||
print("Use |bootstrap-rust-docs --force| to download again.")
|
||||
return
|
||||
|
||||
if path.isdir(docs_dir):
|
||||
shutil.rmtree(docs_dir)
|
||||
docs_name = self.rust_snapshot_path().replace("rustc-", "rust-docs-")
|
||||
snapshot_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/rust-docs-nightly-%s.tar.gz"
|
||||
% host_triple())
|
||||
docs_name = self.rust_path().replace("rustc-", "rust-docs-")
|
||||
docs_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/rust-docs-nightly-%s.tar.gz"
|
||||
% host_triple())
|
||||
tgz_file = path.join(rust_root, 'doc.tar.gz')
|
||||
|
||||
download_file("Rust docs", snapshot_url, tgz_file)
|
||||
download_file("Rust docs", docs_url, tgz_file)
|
||||
|
||||
print("Extracting Rust docs...")
|
||||
temp_dir = path.join(rust_root, "temp_docs")
|
||||
|
@ -294,14 +294,14 @@ class MachCommands(CommandBase):
|
|||
subprocess.check_call(
|
||||
["git", "submodule", "update", "--init", "--recursive"])
|
||||
|
||||
@Command('clean-snapshots',
|
||||
description='Clean unused snapshots of Rust and Cargo',
|
||||
@Command('clean-nightlies',
|
||||
description='Clean unused nightly builds of Rust and Cargo',
|
||||
category='bootstrap')
|
||||
@CommandArgument('--force', '-f',
|
||||
action='store_true',
|
||||
help='Actually remove stuff')
|
||||
def clean_snapshots(self, force=False):
|
||||
rust_current = self.rust_snapshot_path().split('/')[0]
|
||||
def clean_nightlies(self, force=False):
|
||||
rust_current = self.rust_path().split('/')[0]
|
||||
cargo_current = self.cargo_build_id()
|
||||
print("Current Rust version: " + rust_current)
|
||||
print("Current Cargo version: " + cargo_current)
|
||||
|
@ -321,4 +321,4 @@ class MachCommands(CommandBase):
|
|||
print("Nothing to remove.")
|
||||
elif not force:
|
||||
print("Nothing done. "
|
||||
"Run `./mach clean-snapshots -f` to actually remove.")
|
||||
"Run `./mach clean-nightlies -f` to actually remove.")
|
||||
|
|
|
@ -97,7 +97,7 @@ class CommandBase(object):
|
|||
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())
|
||||
context.sharedir, "rust", self.rust_path())
|
||||
if not self.config["tools"]["system-cargo"]:
|
||||
self.config["tools"]["cargo-root"] = path.join(
|
||||
context.sharedir, "cargo", self.cargo_build_id())
|
||||
|
@ -119,17 +119,16 @@ class CommandBase(object):
|
|||
self.config["gonk"].setdefault("b2g", "")
|
||||
self.config["gonk"].setdefault("product", "flame")
|
||||
|
||||
_rust_snapshot_path = None
|
||||
_rust_path = None
|
||||
_cargo_build_id = None
|
||||
|
||||
def rust_snapshot_path(self):
|
||||
if self._rust_snapshot_path is None:
|
||||
filename = path.join(self.context.topdir, "rust-snapshot-hash")
|
||||
def rust_path(self):
|
||||
if self._rust_path is None:
|
||||
filename = path.join(self.context.topdir, "rust-nightly-date")
|
||||
with open(filename) as f:
|
||||
snapshot_hash = f.read().strip()
|
||||
self._rust_snapshot_path = ("%s/rustc-nightly-%s" %
|
||||
(snapshot_hash, host_triple()))
|
||||
return self._rust_snapshot_path
|
||||
date = f.read().strip()
|
||||
self._rust_path = ("%s/rustc-nightly-%s" % (date, host_triple()))
|
||||
return self._rust_path
|
||||
|
||||
def cargo_build_id(self):
|
||||
if self._cargo_build_id is None:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# Copy this file to .servobuild in the Servo root directory
|
||||
# Be sure to set the cache-dir correctly, otherwise extra snapshots
|
||||
# may get downloaded
|
||||
# Be sure to set the cache-dir correctly, otherwise extra
|
||||
# copies of the Rust compiler may get downloaded
|
||||
|
||||
# Paths starting with "./" are relative to the repo root
|
||||
|
||||
# Tool options
|
||||
[tools]
|
||||
# Where Rust compiler snapshots and other downloads will be stored. Can be
|
||||
# Where Rust compiler and other downloads will be stored. Can be
|
||||
# shared by multiple Servo repositories. Defaults to <servo-repo>/.servo
|
||||
cache-dir = "./.servo"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue