build-manifest: add some comments
This commit is contained in:
parent
f504e37dc6
commit
a4dc33baf6
2 changed files with 23 additions and 8 deletions
|
@ -2000,6 +2000,8 @@ impl Step for HashSign {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(self, builder: &Builder<'_>) {
|
fn run(self, builder: &Builder<'_>) {
|
||||||
|
// This gets called by `promote-release`
|
||||||
|
// (https://github.com/rust-lang/rust-central-station/tree/master/promote-release).
|
||||||
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
|
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
|
||||||
if builder.config.dry_run {
|
if builder.config.dry_run {
|
||||||
return;
|
return;
|
||||||
|
@ -2010,10 +2012,14 @@ impl Step for HashSign {
|
||||||
let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| {
|
let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| {
|
||||||
panic!("\n\nfailed to specify `dist.upload-addr` in `config.toml`\n\n")
|
panic!("\n\nfailed to specify `dist.upload-addr` in `config.toml`\n\n")
|
||||||
});
|
});
|
||||||
let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| {
|
let pass = if env::var("BUILD_MANIFEST_DISABLE_SIGNING").is_err() {
|
||||||
panic!("\n\nfailed to specify `dist.gpg-password-file` in `config.toml`\n\n")
|
let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| {
|
||||||
});
|
panic!("\n\nfailed to specify `dist.gpg-password-file` in `config.toml`\n\n")
|
||||||
let pass = t!(fs::read_to_string(&file));
|
});
|
||||||
|
t!(fs::read_to_string(&file))
|
||||||
|
} else {
|
||||||
|
String::new()
|
||||||
|
};
|
||||||
|
|
||||||
let today = output(Command::new("date").arg("+%Y-%m-%d"));
|
let today = output(Command::new("date").arg("+%Y-%m-%d"));
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
//! Build a dist manifest, hash and sign everything.
|
||||||
|
//! This gets called by `promote-release`
|
||||||
|
//! (https://github.com/rust-lang/rust-central-station/tree/master/promote-release)
|
||||||
|
//! via `x.py dist hash-and-sign`; the cmdline arguments are set up
|
||||||
|
//! by rustbuild (in `src/bootstrap/dist.rs`).
|
||||||
|
|
||||||
use toml;
|
use toml;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
|
@ -270,6 +276,7 @@ fn main() {
|
||||||
// Do not ask for a passphrase while manually testing
|
// Do not ask for a passphrase while manually testing
|
||||||
let mut passphrase = String::new();
|
let mut passphrase = String::new();
|
||||||
if should_sign {
|
if should_sign {
|
||||||
|
// `x.py` passes the passphrase via stdin.
|
||||||
t!(io::stdin().read_to_string(&mut passphrase));
|
t!(io::stdin().read_to_string(&mut passphrase));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,6 +369,7 @@ impl Builder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Hash all files, compute their signatures, and collect the hashes in `self.digests`.
|
||||||
fn digest_and_sign(&mut self) {
|
fn digest_and_sign(&mut self) {
|
||||||
for file in t!(self.input.read_dir()).map(|e| t!(e).path()) {
|
for file in t!(self.input.read_dir()).map(|e| t!(e).path()) {
|
||||||
let filename = file.file_name().unwrap().to_str().unwrap();
|
let filename = file.file_name().unwrap().to_str().unwrap();
|
||||||
|
@ -532,19 +540,20 @@ impl Builder {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.cloned()
|
.cloned()
|
||||||
.map(|version| (version, true))
|
.map(|version| (version, true))
|
||||||
.unwrap_or_default();
|
.unwrap_or_default(); // `is_present` defaults to `false` here.
|
||||||
|
|
||||||
// miri needs to build std with xargo, which doesn't allow stable/beta:
|
// Miri is nightly-only; never ship it for other trains.
|
||||||
// <https://github.com/japaric/xargo/pull/204#issuecomment-374888868>
|
|
||||||
if pkgname == "miri-preview" && self.rust_release != "nightly" {
|
if pkgname == "miri-preview" && self.rust_release != "nightly" {
|
||||||
is_present = false; // ignore it
|
is_present = false; // Pretend the component is entirely missing.
|
||||||
}
|
}
|
||||||
|
|
||||||
let targets = targets.iter().map(|name| {
|
let targets = targets.iter().map(|name| {
|
||||||
if is_present {
|
if is_present {
|
||||||
|
// The component generally exists, but it might still be missing for this target.
|
||||||
let filename = self.filename(pkgname, name);
|
let filename = self.filename(pkgname, name);
|
||||||
let digest = match self.digests.remove(&filename) {
|
let digest = match self.digests.remove(&filename) {
|
||||||
Some(digest) => digest,
|
Some(digest) => digest,
|
||||||
|
// This component does not exist for this target -- skip it.
|
||||||
None => return (name.to_string(), Target::unavailable()),
|
None => return (name.to_string(), Target::unavailable()),
|
||||||
};
|
};
|
||||||
let xz_filename = filename.replace(".tar.gz", ".tar.xz");
|
let xz_filename = filename.replace(".tar.gz", ".tar.xz");
|
||||||
|
|
Loading…
Reference in a new issue