build-manifest: accept the Rust version instead of the monorepo path

This commit changes the way build-manifest is invoked, to let it accept
the Rust version directly instead of requiring the path of the Rust
monorepo and letting build-manifest figure out the path on its own.

This allows to run build-manifest without a clone of the monorepo.
This commit is contained in:
Pietro Albini 2020-10-09 15:34:57 +02:00
parent f3ab6f0584
commit 25cc75c924
No known key found for this signature in database
GPG Key ID: 3E06ABE80BAAF19C
5 changed files with 9 additions and 16 deletions

View File

@ -2353,7 +2353,7 @@ impl Step for HashSign {
cmd.arg(today.trim());
cmd.arg(addr);
cmd.arg(&builder.config.channel);
cmd.arg(&builder.src);
cmd.arg(&builder.version);
cmd.env("BUILD_MANIFEST_LEGACY", "1");
builder.create_dir(&distdir(builder));

View File

@ -77,7 +77,7 @@ impl Step for BuildManifest {
cmd.arg(today.trim());
cmd.arg(addr);
cmd.arg(&builder.config.channel);
cmd.arg(&builder.src);
cmd.arg(&builder.version);
builder.create_dir(&distdir(builder));
builder.run(&mut cmd);

View File

@ -21,8 +21,8 @@ Then, you can generate the manifest and all the packages from `path/to/dist` to
```
$ cargo +nightly run path/to/dist path/to/output 1970-01-01 http://example.com \
CHANNEL path/to/rust/repo
CHANNEL VERSION
```
Remember to replace `CHANNEL` with the channel you produced dist artifacts of
and `path/to/rust/repo` with the path to your checkout of the Rust repository.
and `VERSION` with the current Rust version.

View File

@ -221,7 +221,7 @@ fn main() {
let date = args.next().unwrap();
let s3_address = args.next().unwrap();
let channel = args.next().unwrap();
let monorepo_path = args.next().unwrap();
let rustc_version = args.next().unwrap();
// Do not ask for a passphrase while manually testing
let mut passphrase = String::new();
@ -231,7 +231,7 @@ fn main() {
}
Builder {
versions: Versions::new(&channel, &input, Path::new(&monorepo_path)).unwrap(),
versions: Versions::new(&channel, &rustc_version, &input).unwrap(),
input,
output,

View File

@ -1,4 +1,4 @@
use anyhow::{Context, Error};
use anyhow::Error;
use flate2::read::GzDecoder;
use std::collections::HashMap;
use std::fs::File;
@ -93,17 +93,10 @@ pub(crate) struct Versions {
}
impl Versions {
pub(crate) fn new(
channel: &str,
dist_path: &Path,
monorepo_root: &Path,
) -> Result<Self, Error> {
pub(crate) fn new(channel: &str, rustc_version: &str, dist_path: &Path) -> Result<Self, Error> {
Ok(Self {
channel: channel.into(),
rustc_version: std::fs::read_to_string(monorepo_root.join("src").join("version"))
.context("failed to read the rustc version from src/version")?
.trim()
.to_string(),
rustc_version: rustc_version.into(),
dist_path: dist_path.into(),
versions: HashMap::new(),
})