Skip to content

Commit 7704d35

Browse files
committed
build-manifest: remove legacy promote-release support
This commit removes support for the legacy promote-release, as that's not executed anymore on the nightly channel.
1 parent d662f80 commit 7704d35

File tree

3 files changed

+2
-151
lines changed

3 files changed

+2
-151
lines changed

src/bootstrap/builder.rs

-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,6 @@ impl<'a> Builder<'a> {
469469
dist::RustDev,
470470
dist::Extended,
471471
dist::BuildManifest,
472-
dist::HashSign
473472
),
474473
Kind::Install => describe!(
475474
install::Docs,

src/bootstrap/dist.rs

+1-57
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@
1010
1111
use std::env;
1212
use std::fs;
13-
use std::io::Write;
1413
use std::path::{Path, PathBuf};
15-
use std::process::{Command, Stdio};
14+
use std::process::Command;
1615

1716
use build_helper::{output, t};
1817

@@ -2323,61 +2322,6 @@ fn add_env(builder: &Builder<'_>, cmd: &mut Command, target: TargetSelection) {
23232322
}
23242323
}
23252324

2326-
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
2327-
pub struct HashSign;
2328-
2329-
impl Step for HashSign {
2330-
type Output = ();
2331-
const ONLY_HOSTS: bool = true;
2332-
2333-
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
2334-
run.path("hash-and-sign")
2335-
}
2336-
2337-
fn make_run(run: RunConfig<'_>) {
2338-
run.builder.ensure(HashSign);
2339-
}
2340-
2341-
fn run(self, builder: &Builder<'_>) {
2342-
// This gets called by `promote-release`
2343-
// (https://github.com/rust-lang/rust-central-station/tree/master/promote-release).
2344-
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
2345-
if builder.config.dry_run {
2346-
return;
2347-
}
2348-
let sign = builder.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
2349-
panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n")
2350-
});
2351-
let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| {
2352-
panic!("\n\nfailed to specify `dist.upload-addr` in `config.toml`\n\n")
2353-
});
2354-
let pass = if env::var("BUILD_MANIFEST_DISABLE_SIGNING").is_err() {
2355-
let file = builder.config.dist_gpg_password_file.as_ref().unwrap_or_else(|| {
2356-
panic!("\n\nfailed to specify `dist.gpg-password-file` in `config.toml`\n\n")
2357-
});
2358-
t!(fs::read_to_string(&file))
2359-
} else {
2360-
String::new()
2361-
};
2362-
2363-
let today = output(Command::new("date").arg("+%Y-%m-%d"));
2364-
2365-
cmd.arg(sign);
2366-
cmd.arg(distdir(builder));
2367-
cmd.arg(today.trim());
2368-
cmd.arg(addr);
2369-
cmd.arg(&builder.config.channel);
2370-
cmd.env("BUILD_MANIFEST_LEGACY", "1");
2371-
2372-
builder.create_dir(&distdir(builder));
2373-
2374-
let mut child = t!(cmd.stdin(Stdio::piped()).spawn());
2375-
t!(child.stdin.take().unwrap().write_all(pass.as_bytes()));
2376-
let status = t!(child.wait());
2377-
assert!(status.success());
2378-
}
2379-
}
2380-
23812325
/// Maybe add libLLVM.so to the given destination lib-dir. It will only have
23822326
/// been built if LLVM tools are linked dynamically.
23832327
///

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

+1-93
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ use crate::versions::{PkgType, Versions};
1414
use std::collections::{BTreeMap, HashMap, HashSet};
1515
use std::env;
1616
use std::fs::{self, File};
17-
use std::io::{self, Read, Write};
1817
use std::path::{Path, PathBuf};
19-
use std::process::{Command, Stdio};
2018

2119
static HOSTS: &[&str] = &[
2220
"aarch64-apple-darwin",
@@ -200,29 +198,10 @@ struct Builder {
200198
output: PathBuf,
201199
s3_address: String,
202200
date: String,
203-
204-
legacy: bool,
205-
legacy_gpg_passphrase: String,
206201
}
207202

208203
fn main() {
209-
// Up until Rust 1.48 the release process relied on build-manifest to create the SHA256
210-
// checksums of released files and to sign the tarballs. That was moved over to promote-release
211-
// in time for the branching of Rust 1.48, but the old release process still had to work the
212-
// old way.
213-
//
214-
// When running build-manifest through the old ./x.py dist hash-and-sign the environment
215-
// variable will be set, enabling the legacy behavior of generating the .sha256 files and
216-
// signing the tarballs.
217-
//
218-
// Once the old release process is fully decommissioned, the environment variable, all the
219-
// related code in this tool and ./x.py dist hash-and-sign can be removed.
220-
let legacy = env::var_os("BUILD_MANIFEST_LEGACY").is_some();
221-
222-
let num_threads = if legacy {
223-
// Avoid overloading the old server in legacy mode.
224-
1
225-
} else if let Some(num) = env::var_os("BUILD_MANIFEST_NUM_THREADS") {
204+
let num_threads = if let Some(num) = env::var_os("BUILD_MANIFEST_NUM_THREADS") {
226205
num.to_str().unwrap().parse().expect("invalid number for BUILD_MANIFEST_NUM_THREADS")
227206
} else {
228207
num_cpus::get()
@@ -239,13 +218,6 @@ fn main() {
239218
let s3_address = args.next().unwrap();
240219
let channel = args.next().unwrap();
241220

242-
// Do not ask for a passphrase while manually testing
243-
let mut passphrase = String::new();
244-
if legacy {
245-
// `x.py` passes the passphrase via stdin.
246-
t!(io::stdin().read_to_string(&mut passphrase));
247-
}
248-
249221
Builder {
250222
versions: Versions::new(&channel, &input).unwrap(),
251223
checksums: t!(Checksums::new()),
@@ -255,19 +227,13 @@ fn main() {
255227
output,
256228
s3_address,
257229
date,
258-
259-
legacy,
260-
legacy_gpg_passphrase: passphrase,
261230
}
262231
.build();
263232
}
264233

265234
impl Builder {
266235
fn build(&mut self) {
267236
self.check_toolstate();
268-
if self.legacy {
269-
self.digest_and_sign();
270-
}
271237
let manifest = self.build_manifest();
272238

273239
let channel = self.versions.channel().to_string();
@@ -310,15 +276,6 @@ impl Builder {
310276
}
311277
}
312278

313-
/// Hash all files, compute their signatures, and collect the hashes in `self.digests`.
314-
fn digest_and_sign(&mut self) {
315-
for file in t!(self.input.read_dir()).map(|e| t!(e).path()) {
316-
file.file_name().unwrap().to_str().unwrap();
317-
self.hash(&file);
318-
self.sign(&file);
319-
}
320-
}
321-
322279
fn build_manifest(&mut self) -> Manifest {
323280
let mut manifest = Manifest {
324281
manifest_version: "2".to_string(),
@@ -584,51 +541,6 @@ impl Builder {
584541
format!("{}/{}/{}", self.s3_address, self.date, file_name)
585542
}
586543

587-
fn hash(&self, path: &Path) -> String {
588-
let sha = t!(Command::new("shasum")
589-
.arg("-a")
590-
.arg("256")
591-
.arg(path.file_name().unwrap())
592-
.current_dir(path.parent().unwrap())
593-
.output());
594-
assert!(sha.status.success());
595-
596-
let filename = path.file_name().unwrap().to_str().unwrap();
597-
let sha256 = self.output.join(format!("{}.sha256", filename));
598-
t!(fs::write(&sha256, &sha.stdout));
599-
600-
let stdout = String::from_utf8_lossy(&sha.stdout);
601-
stdout.split_whitespace().next().unwrap().to_string()
602-
}
603-
604-
fn sign(&self, path: &Path) {
605-
if !self.legacy {
606-
return;
607-
}
608-
609-
let filename = path.file_name().unwrap().to_str().unwrap();
610-
let asc = self.output.join(format!("{}.asc", filename));
611-
println!("signing: {:?}", path);
612-
let mut cmd = Command::new("gpg");
613-
cmd.arg("--pinentry-mode=loopback")
614-
.arg("--no-tty")
615-
.arg("--yes")
616-
.arg("--batch")
617-
.arg("--passphrase-fd")
618-
.arg("0")
619-
.arg("--personal-digest-preferences")
620-
.arg("SHA512")
621-
.arg("--armor")
622-
.arg("--output")
623-
.arg(&asc)
624-
.arg("--detach-sign")
625-
.arg(path)
626-
.stdin(Stdio::piped());
627-
let mut child = t!(cmd.spawn());
628-
t!(child.stdin.take().unwrap().write_all(self.legacy_gpg_passphrase.as_bytes()));
629-
assert!(t!(child.wait()).success());
630-
}
631-
632544
fn write_channel_files(&mut self, channel_name: &str, manifest: &Manifest) {
633545
self.write(&toml::to_string(&manifest).unwrap(), channel_name, ".toml");
634546
self.write(&manifest.date, channel_name, "-date.txt");
@@ -645,10 +557,6 @@ impl Builder {
645557

646558
let dst = self.output.join(name);
647559
t!(fs::write(&dst, contents));
648-
if self.legacy {
649-
self.hash(&dst);
650-
self.sign(&dst);
651-
}
652560
}
653561

654562
fn write_shipped_files(&self, path: &Path) {

0 commit comments

Comments
 (0)