From 31a8638e5e716bec90f4398a57c58fb34e492667 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 1 Nov 2016 13:46:38 -0700 Subject: rustbuild: Tweak for vendored dependencies A few changes are included here: * The `winapi` and `url` dependencies were dropped. The source code for these projects is pretty weighty, and we're about to vendor them, so let's not commit to that intake just yet. If necessary we can vendor them later but for now it shouldn't be necessary. * The `--frozen` flag is now always passed to Cargo, obviating the need for tidy's `cargo_lock` check. * Tidy was updated to not check the vendor directory Closes #34687 --- src/bootstrap/bootstrap.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'src/bootstrap/bootstrap.py') diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 76bbb9d22e0..ec755300224 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -259,9 +259,11 @@ class RustBuild(object): env["DYLD_LIBRARY_PATH"] = os.path.join(self.bin_root(), "lib") env["PATH"] = os.path.join(self.bin_root(), "bin") + \ os.pathsep + env["PATH"] - self.run([self.cargo(), "build", "--manifest-path", - os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")], - env) + args = [self.cargo(), "build", "--manifest-path", + os.path.join(self.rust_root, "src/bootstrap/Cargo.toml")] + if self.use_vendored_sources: + args.append("--frozen") + self.run(args, env) def run(self, args, env): proc = subprocess.Popen(args, env=env) @@ -384,6 +386,25 @@ def main(): except: pass + rb.use_vendored_sources = '\nvendor = true' in rb.config_toml or \ + 'CFG_ENABLE_VENDOR' in rb.config_mk + + if rb.use_vendored_sources: + if not os.path.exists('.cargo'): + os.makedirs('.cargo') + f = open('.cargo/config','w') + f.write(""" + [source.crates-io] + replace-with = 'vendored-sources' + registry = 'https://example.com' + + [source.vendored-sources] + directory = '{}/src/vendor' + """.format(rb.rust_root)) + f.close() + else: + if os.path.exists('.cargo'): + shutil.rmtree('.cargo') data = stage0_data(rb.rust_root) rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1) rb._cargo_channel, rb._cargo_date = data['cargo'].split('-', 1) -- cgit 1.4.1-3-g733a5