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:
Simon Sapin 2015-12-30 12:12:20 +00:00
parent 856eea3a0e
commit b2af8567fa
5 changed files with 36 additions and 37 deletions

View file

@ -71,11 +71,11 @@ If you're running servo on a guest machine, make sure 3D Acceleration is switche
## The Rust compiler ## 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 This is normally a specific revision of Rust upstream, but sometimes has a
backported patch or two. backported patch or two.
If you'd like to know the snapshot revision of Rust which we use, see If you'd like to know which nightly build of Rust we use, see
`rust-snapshot-hash`. `rust-nightly-date`.
## Building ## Building

View file

@ -103,16 +103,16 @@ class MachCommands(CommandBase):
print("export LD_LIBRARY_PATH=%s" % env["LD_LIBRARY_PATH"]) print("export LD_LIBRARY_PATH=%s" % env["LD_LIBRARY_PATH"])
@Command('bootstrap-rust', @Command('bootstrap-rust',
description='Download the Rust compiler snapshot', description='Download the Rust compiler',
category='bootstrap') category='bootstrap')
@CommandArgument('--force', '-f', @CommandArgument('--force', '-f',
action='store_true', 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): def bootstrap_rustc(self, force=False):
rust_dir = path.join( 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")): 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.") print("Use |bootstrap-rust --force| to download again.")
return return
@ -120,18 +120,18 @@ class MachCommands(CommandBase):
shutil.rmtree(rust_dir) shutil.rmtree(rust_dir)
os.makedirs(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) install_dir = path.join(self.context.sharedir, "rust", date)
# The Rust compiler is hosted on the nightly server under the date with a name # 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, # 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 # giving a directory name that will be the same as the tarball name (rustc is
# in that directory). # in that directory).
snapshot_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/%s.tar.gz" rustc_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/%s.tar.gz"
% self.rust_snapshot_path()) % self.rust_path())
tgz_file = rust_dir + '-rustc.tar.gz' 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...") print("Extracting Rust compiler...")
extract(tgz_file, install_dir) extract(tgz_file, install_dir)
@ -144,11 +144,11 @@ class MachCommands(CommandBase):
# list. # list.
stdlibs = [host_triple(), "arm-linux-androideabi"] stdlibs = [host_triple(), "arm-linux-androideabi"]
for target in stdlibs: for target in stdlibs:
snapshot_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/%s/rust-std-nightly-%s.tar.gz" std_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/%s/rust-std-nightly-%s.tar.gz"
% (date, target)) % (date, target))
tgz_file = install_dir + ('rust-std-nightly-%s.tar.gz' % 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) print("Extracting Rust stdlib for target %s..." % target)
extract(tgz_file, install_dir) extract(tgz_file, install_dir)
shutil.copytree(path.join(install_dir, "rust-std-nightly-%s" % target, shutil.copytree(path.join(install_dir, "rust-std-nightly-%s" % target,
@ -157,7 +157,7 @@ class MachCommands(CommandBase):
"rustc", "lib", "rustlib", target)) "rustc", "lib", "rustlib", target))
shutil.rmtree(path.join(install_dir, "rust-std-nightly-%s" % target)) shutil.rmtree(path.join(install_dir, "rust-std-nightly-%s" % target))
print("Snapshot Rust ready.") print("Rust ready.")
@Command('bootstrap-rust-docs', @Command('bootstrap-rust-docs',
description='Download the Rust documentation', description='Download the Rust documentation',
@ -170,18 +170,18 @@ class MachCommands(CommandBase):
rust_root = self.config["tools"]["rust-root"] rust_root = self.config["tools"]["rust-root"]
docs_dir = path.join(rust_root, "doc") docs_dir = path.join(rust_root, "doc")
if not force and path.exists(docs_dir): 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.") print("Use |bootstrap-rust-docs --force| to download again.")
return return
if path.isdir(docs_dir): if path.isdir(docs_dir):
shutil.rmtree(docs_dir) shutil.rmtree(docs_dir)
docs_name = self.rust_snapshot_path().replace("rustc-", "rust-docs-") docs_name = self.rust_path().replace("rustc-", "rust-docs-")
snapshot_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/rust-docs-nightly-%s.tar.gz" docs_url = ("https://static-rust-lang-org.s3.amazonaws.com/dist/rust-docs-nightly-%s.tar.gz"
% host_triple()) % host_triple())
tgz_file = path.join(rust_root, 'doc.tar.gz') 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...") print("Extracting Rust docs...")
temp_dir = path.join(rust_root, "temp_docs") temp_dir = path.join(rust_root, "temp_docs")
@ -294,14 +294,14 @@ class MachCommands(CommandBase):
subprocess.check_call( subprocess.check_call(
["git", "submodule", "update", "--init", "--recursive"]) ["git", "submodule", "update", "--init", "--recursive"])
@Command('clean-snapshots', @Command('clean-nightlies',
description='Clean unused snapshots of Rust and Cargo', description='Clean unused nightly builds of Rust and Cargo',
category='bootstrap') category='bootstrap')
@CommandArgument('--force', '-f', @CommandArgument('--force', '-f',
action='store_true', action='store_true',
help='Actually remove stuff') help='Actually remove stuff')
def clean_snapshots(self, force=False): def clean_nightlies(self, force=False):
rust_current = self.rust_snapshot_path().split('/')[0] rust_current = self.rust_path().split('/')[0]
cargo_current = self.cargo_build_id() cargo_current = self.cargo_build_id()
print("Current Rust version: " + rust_current) print("Current Rust version: " + rust_current)
print("Current Cargo version: " + cargo_current) print("Current Cargo version: " + cargo_current)
@ -321,4 +321,4 @@ class MachCommands(CommandBase):
print("Nothing to remove.") print("Nothing to remove.")
elif not force: elif not force:
print("Nothing done. " print("Nothing done. "
"Run `./mach clean-snapshots -f` to actually remove.") "Run `./mach clean-nightlies -f` to actually remove.")

View file

@ -97,7 +97,7 @@ 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.sharedir, "rust", self.rust_snapshot_path()) context.sharedir, "rust", self.rust_path())
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.sharedir, "cargo", self.cargo_build_id()) context.sharedir, "cargo", self.cargo_build_id())
@ -119,17 +119,16 @@ class CommandBase(object):
self.config["gonk"].setdefault("b2g", "") self.config["gonk"].setdefault("b2g", "")
self.config["gonk"].setdefault("product", "flame") self.config["gonk"].setdefault("product", "flame")
_rust_snapshot_path = None _rust_path = None
_cargo_build_id = None _cargo_build_id = None
def rust_snapshot_path(self): def rust_path(self):
if self._rust_snapshot_path is None: if self._rust_path is None:
filename = path.join(self.context.topdir, "rust-snapshot-hash") filename = path.join(self.context.topdir, "rust-nightly-date")
with open(filename) as f: with open(filename) as f:
snapshot_hash = f.read().strip() date = f.read().strip()
self._rust_snapshot_path = ("%s/rustc-nightly-%s" % self._rust_path = ("%s/rustc-nightly-%s" % (date, host_triple()))
(snapshot_hash, host_triple())) return self._rust_path
return self._rust_snapshot_path
def cargo_build_id(self): def cargo_build_id(self):
if self._cargo_build_id is None: if self._cargo_build_id is None:

View file

@ -1,12 +1,12 @@
# Copy this file to .servobuild in the Servo root directory # Copy this file to .servobuild in the Servo root directory
# Be sure to set the cache-dir correctly, otherwise extra snapshots # Be sure to set the cache-dir correctly, otherwise extra
# may get downloaded # copies of the Rust compiler may get downloaded
# Paths starting with "./" are relative to the repo root # Paths starting with "./" are relative to the repo root
# Tool options # Tool options
[tools] [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 # shared by multiple Servo repositories. Defaults to <servo-repo>/.servo
cache-dir = "./.servo" cache-dir = "./.servo"