diff options
| -rw-r--r-- | src/tools/build-manifest/README.md | 30 | ||||
| -rw-r--r-- | src/tools/build-manifest/src/main.rs | 26 |
2 files changed, 55 insertions, 1 deletions
diff --git a/src/tools/build-manifest/README.md b/src/tools/build-manifest/README.md new file mode 100644 index 00000000000..6834f56efe7 --- /dev/null +++ b/src/tools/build-manifest/README.md @@ -0,0 +1,30 @@ +# build-manifest + +This tool generates the manifests uploaded to static.rust-lang.org and used by +rustup. The tool is invoked by the bootstrap tool. + +## Testing changes locally + +In order to test the changes locally you need to have a valid dist directory +available locally. If you don't want to build all the compiler, you can easily +create one from the nightly artifacts with: + +``` +#!/bin/bash +for cmpn in rust rustc rust-std rust-docs cargo; do + wget https://static.rust-lang.org/dist/${cmpn}-nightly-x86_64-unknown-linux-gnu.tar.gz +done +``` + +Then, you can generate the manifest and all the packages from `path/to/dist` to +`path/to/output` with: + +``` +$ BUILD_MANIFEST_DISABLE_SIGNING=1 cargo +nightly run \ + path/to/dist path/to/output 1970-01-01 \ + nightly nightly nightly nightly nightly nightly nightly \ + http://example.com +``` + +In the future, if the tool complains about missing arguments just add more +`nightly`s in the middle. diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index f43bd88d04f..2bf6fa401d0 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -216,9 +216,23 @@ struct Builder { rustfmt_git_commit_hash: Option<String>, llvm_tools_git_commit_hash: Option<String>, lldb_git_commit_hash: Option<String>, + + should_sign: bool, } fn main() { + // Avoid signing packages while manually testing + // Do NOT set this envvar in CI + let should_sign = env::var("BUILD_MANIFEST_DISABLE_SIGNING").is_err(); + + // Safety check to ensure signing is always enabled on CI + // The CI environment variable is set by both Travis and AppVeyor + if !should_sign && env::var("CI").is_ok() { + println!("The 'BUILD_MANIFEST_DISABLE_SIGNING' env var can't be enabled on CI."); + println!("If you're not running this on CI, unset the 'CI' env var."); + panic!(); + } + let mut args = env::args().skip(1); let input = PathBuf::from(args.next().unwrap()); let output = PathBuf::from(args.next().unwrap()); @@ -231,8 +245,12 @@ fn main() { let llvm_tools_release = args.next().unwrap(); let lldb_release = args.next().unwrap(); let s3_address = args.next().unwrap(); + + // Do not ask for a passphrase while manually testing let mut passphrase = String::new(); - t!(io::stdin().read_to_string(&mut passphrase)); + if should_sign { + t!(io::stdin().read_to_string(&mut passphrase)); + } Builder { rust_release, @@ -265,6 +283,8 @@ fn main() { rustfmt_git_commit_hash: None, llvm_tools_git_commit_hash: None, lldb_git_commit_hash: None, + + should_sign, }.build(); } @@ -588,6 +608,10 @@ impl Builder { } fn sign(&self, path: &Path) { + if !self.should_sign { + return; + } + let filename = path.file_name().unwrap().to_str().unwrap(); let asc = self.output.join(format!("{}.asc", filename)); println!("signing: {:?}", path); |
