Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve build-manifest to work with the improved promote-release #77407

Merged
merged 7 commits into from
Oct 5, 2020
Merged
72 changes: 64 additions & 8 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,16 @@ dependencies = [
"block-padding",
"byte-tools",
"byteorder",
"generic-array",
"generic-array 0.12.3",
]

[[package]]
name = "block-buffer"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
"generic-array 0.14.4",
]

[[package]]
Expand Down Expand Up @@ -233,8 +242,11 @@ version = "0.1.0"
dependencies = [
"anyhow",
"flate2",
"hex 0.4.2",
"rayon",
"serde",
"serde_json",
"sha2",
"tar",
"toml",
]
Expand Down Expand Up @@ -687,6 +699,12 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a21fa21941700a3cd8fcb4091f361a6a712fac632f85d9f487cc892045d55c6"

[[package]]
name = "cpuid-bool"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"

[[package]]
name = "crates-io"
version = "0.31.1"
Expand Down Expand Up @@ -884,7 +902,16 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
dependencies = [
"generic-array",
"generic-array 0.12.3",
]

[[package]]
name = "digest"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [
"generic-array 0.14.4",
]

[[package]]
Expand Down Expand Up @@ -1166,6 +1193,16 @@ dependencies = [
"typenum",
]

[[package]]
name = "generic-array"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
dependencies = [
"typenum",
"version_check",
]

[[package]]
name = "getopts"
version = "0.2.21"
Expand Down Expand Up @@ -1844,9 +1881,9 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8"
dependencies = [
"block-buffer",
"digest",
"opaque-debug",
"block-buffer 0.7.3",
"digest 0.8.1",
"opaque-debug 0.2.3",
]

[[package]]
Expand Down Expand Up @@ -2106,6 +2143,12 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"

[[package]]
name = "opaque-debug"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"

[[package]]
name = "open"
version = "1.4.0"
Expand Down Expand Up @@ -4371,10 +4414,23 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
dependencies = [
"block-buffer",
"digest",
"block-buffer 0.7.3",
"digest 0.8.1",
"fake-simd",
"opaque-debug",
"opaque-debug 0.2.3",
]

[[package]]
name = "sha2"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1"
dependencies = [
"block-buffer 0.9.0",
"cfg-if",
"cpuid-bool",
"digest 0.9.0",
"opaque-debug 0.3.0",
]

[[package]]
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ impl<'a> Builder<'a> {
install::Src,
install::Rustc
),
Kind::Run => describe!(run::ExpandYamlAnchors,),
Kind::Run => describe!(run::ExpandYamlAnchors, run::BuildManifest,),
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn pkgname(builder: &Builder<'_>, component: &str) -> String {
}
}

fn distdir(builder: &Builder<'_>) -> PathBuf {
pub(crate) fn distdir(builder: &Builder<'_>) -> PathBuf {
builder.out.join("dist")
}

Expand Down Expand Up @@ -2371,6 +2371,7 @@ impl Step for HashSign {
cmd.arg(addr);
cmd.arg(&builder.config.channel);
cmd.arg(&builder.src);
cmd.env("BUILD_MANIFEST_LEGACY", "1");

builder.create_dir(&distdir(builder));

Expand Down
42 changes: 42 additions & 0 deletions src/bootstrap/run.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use crate::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::dist::distdir;
use crate::tool::Tool;
use build_helper::output;
use std::process::Command;

#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
Expand Down Expand Up @@ -41,3 +43,43 @@ fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool {
}
true
}

#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
pub struct BuildManifest;

impl Step for BuildManifest {
type Output = ();
const ONLY_HOSTS: bool = true;

fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/build-manifest")
}

fn make_run(run: RunConfig<'_>) {
run.builder.ensure(BuildManifest);
}

fn run(self, builder: &Builder<'_>) {
// This gets called by `promote-release`
// (https://github.com/rust-lang/promote-release).
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
let sign = builder.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n")
});
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")
});

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

cmd.arg(sign);
cmd.arg(distdir(builder));
cmd.arg(today.trim());
cmd.arg(addr);
cmd.arg(&builder.config.channel);
cmd.arg(&builder.src);

builder.create_dir(&distdir(builder));
builder.run(&mut cmd);
}
}
3 changes: 3 additions & 0 deletions src/tools/build-manifest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ serde_json = "1.0"
anyhow = "1.0.32"
flate2 = "1.0.16"
tar = "0.4.29"
sha2 = "0.9.1"
rayon = "1.3.1"
hex = "0.4.2"
3 changes: 1 addition & 2 deletions src/tools/build-manifest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ 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 http://example.com \
$ cargo +nightly run path/to/dist path/to/output 1970-01-01 http://example.com \
CHANNEL path/to/rust/repo
```

Expand Down
Loading