Skip to content

Commit a4dc33b

Browse files
committed
build-manifest: add some comments
1 parent f504e37 commit a4dc33b

File tree

2 files changed

+23
-8
lines changed

2 files changed

+23
-8
lines changed

src/bootstrap/dist.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -2000,6 +2000,8 @@ impl Step for HashSign {
20002000
}
20012001

20022002
fn run(self, builder: &Builder<'_>) {
2003+
// This gets called by `promote-release`
2004+
// (https://github.com/rust-lang/rust-central-station/tree/master/promote-release).
20032005
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
20042006
if builder.config.dry_run {
20052007
return;
@@ -2010,10 +2012,14 @@ impl Step for HashSign {
20102012
let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| {
20112013
panic!("\n\nfailed to specify `dist.upload-addr` in `config.toml`\n\n")
20122014
});
2013-
let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| {
2014-
panic!("\n\nfailed to specify `dist.gpg-password-file` in `config.toml`\n\n")
2015-
});
2016-
let pass = t!(fs::read_to_string(&file));
2015+
let pass = if env::var("BUILD_MANIFEST_DISABLE_SIGNING").is_err() {
2016+
let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| {
2017+
panic!("\n\nfailed to specify `dist.gpg-password-file` in `config.toml`\n\n")
2018+
});
2019+
t!(fs::read_to_string(&file))
2020+
} else {
2021+
String::new()
2022+
};
20172023

20182024
let today = output(Command::new("date").arg("+%Y-%m-%d"));
20192025

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

+13-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//! Build a dist manifest, hash and sign everything.
2+
//! This gets called by `promote-release`
3+
//! (https://github.com/rust-lang/rust-central-station/tree/master/promote-release)
4+
//! via `x.py dist hash-and-sign`; the cmdline arguments are set up
5+
//! by rustbuild (in `src/bootstrap/dist.rs`).
6+
17
use toml;
28
use serde::Serialize;
39

@@ -270,6 +276,7 @@ fn main() {
270276
// Do not ask for a passphrase while manually testing
271277
let mut passphrase = String::new();
272278
if should_sign {
279+
// `x.py` passes the passphrase via stdin.
273280
t!(io::stdin().read_to_string(&mut passphrase));
274281
}
275282

@@ -362,6 +369,7 @@ impl Builder {
362369
}
363370
}
364371

372+
/// Hash all files, compute their signatures, and collect the hashes in `self.digests`.
365373
fn digest_and_sign(&mut self) {
366374
for file in t!(self.input.read_dir()).map(|e| t!(e).path()) {
367375
let filename = file.file_name().unwrap().to_str().unwrap();
@@ -532,19 +540,20 @@ impl Builder {
532540
.as_ref()
533541
.cloned()
534542
.map(|version| (version, true))
535-
.unwrap_or_default();
543+
.unwrap_or_default(); // `is_present` defaults to `false` here.
536544

537-
// miri needs to build std with xargo, which doesn't allow stable/beta:
538-
// <https://github.com/japaric/xargo/pull/204#issuecomment-374888868>
545+
// Miri is nightly-only; never ship it for other trains.
539546
if pkgname == "miri-preview" && self.rust_release != "nightly" {
540-
is_present = false; // ignore it
547+
is_present = false; // Pretend the component is entirely missing.
541548
}
542549

543550
let targets = targets.iter().map(|name| {
544551
if is_present {
552+
// The component generally exists, but it might still be missing for this target.
545553
let filename = self.filename(pkgname, name);
546554
let digest = match self.digests.remove(&filename) {
547555
Some(digest) => digest,
556+
// This component does not exist for this target -- skip it.
548557
None => return (name.to_string(), Target::unavailable()),
549558
};
550559
let xz_filename = filename.replace(".tar.gz", ".tar.xz");

0 commit comments

Comments
 (0)