Skip to content

Commit 6732ce9

Browse files
committed
build-manifest: add instructions to test the tool locally
1 parent e6b35b0 commit 6732ce9

File tree

2 files changed

+55
-1
lines changed

2 files changed

+55
-1
lines changed

src/tools/build-manifest/README.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# build-manifest
2+
3+
This tool generates the manifests uploaded to static.rust-lang.org and used by
4+
rustup. The tool is invoked by the bootstrap tool.
5+
6+
## Testing changes locally
7+
8+
In order to test the changes locally you need to have a valid dist directory
9+
available locally. If you don't want to build all the compiler, you can easily
10+
create one from the nightly artifacts with:
11+
12+
```
13+
#!/bin/bash
14+
for cmpn in rust rustc rust-std rust-docs cargo; do
15+
wget https://static.rust-lang.org/dist/${cmpn}-nightly-x86_64-unknown-linux-gnu.tar.gz
16+
done
17+
```
18+
19+
Then, you can generate the manifest and all the packages from `path/to/dist` to
20+
`path/to/output` with:
21+
22+
```
23+
$ BUILD_MANIFEST_DISABLE_SIGNING=1 cargo +nightly run \
24+
path/to/dist path/to/output 1970-01-01 \
25+
nightly nightly nightly nightly nightly nightly nightly \
26+
http://example.com
27+
```
28+
29+
In the future, if the tool complains about missing arguments just add more
30+
`nightly`s in the middle.

src/tools/build-manifest/src/main.rs

+25-1
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,23 @@ struct Builder {
216216
rustfmt_git_commit_hash: Option<String>,
217217
llvm_tools_git_commit_hash: Option<String>,
218218
lldb_git_commit_hash: Option<String>,
219+
220+
should_sign: bool,
219221
}
220222

221223
fn main() {
224+
// Avoid signing packages while manually testing
225+
// Do NOT set this envvar in CI
226+
let should_sign = env::var("BUILD_MANIFEST_DISABLE_SIGNING").is_err();
227+
228+
// Safety check to ensure signing is always enabled on CI
229+
// The CI environment variable is set by both Travis and AppVeyor
230+
if !should_sign && env::var("CI").is_ok() {
231+
println!("The 'BUILD_MANIFEST_DISABLE_SIGNING' env var can't be enabled on CI.");
232+
println!("If you're not running this on CI, unset the 'CI' env var.");
233+
panic!();
234+
}
235+
222236
let mut args = env::args().skip(1);
223237
let input = PathBuf::from(args.next().unwrap());
224238
let output = PathBuf::from(args.next().unwrap());
@@ -231,8 +245,12 @@ fn main() {
231245
let llvm_tools_release = args.next().unwrap();
232246
let lldb_release = args.next().unwrap();
233247
let s3_address = args.next().unwrap();
248+
249+
// Do not ask for a passphrase while manually testing
234250
let mut passphrase = String::new();
235-
t!(io::stdin().read_to_string(&mut passphrase));
251+
if should_sign {
252+
t!(io::stdin().read_to_string(&mut passphrase));
253+
}
236254

237255
Builder {
238256
rust_release,
@@ -265,6 +283,8 @@ fn main() {
265283
rustfmt_git_commit_hash: None,
266284
llvm_tools_git_commit_hash: None,
267285
lldb_git_commit_hash: None,
286+
287+
should_sign,
268288
}.build();
269289
}
270290

@@ -588,6 +608,10 @@ impl Builder {
588608
}
589609

590610
fn sign(&self, path: &Path) {
611+
if !self.should_sign {
612+
return;
613+
}
614+
591615
let filename = path.file_name().unwrap().to_str().unwrap();
592616
let asc = self.output.join(format!("{}.asc", filename));
593617
println!("signing: {:?}", path);

0 commit comments

Comments
 (0)