Rollup merge of #41202 - brson:btree, r=nikomatsakis

Convert HashMap to BTree in build-manifest

This is just for my peace of mind since it's important the output of this program be deterministic.
This commit is contained in:
Corey Farwell 2017-04-11 18:36:14 -04:00 committed by GitHub
commit c03061d347

View File

@ -11,7 +11,7 @@
extern crate toml; extern crate toml;
extern crate rustc_serialize; extern crate rustc_serialize;
use std::collections::{BTreeMap, HashMap}; use std::collections::BTreeMap;
use std::env; use std::env;
use std::fs::File; use std::fs::File;
use std::io::{self, Read, Write}; use std::io::{self, Read, Write};
@ -101,13 +101,13 @@ static MINGW: &'static [&'static str] = &[
struct Manifest { struct Manifest {
manifest_version: String, manifest_version: String,
date: String, date: String,
pkg: HashMap<String, Package>, pkg: BTreeMap<String, Package>,
} }
#[derive(RustcEncodable)] #[derive(RustcEncodable)]
struct Package { struct Package {
version: String, version: String,
target: HashMap<String, Target>, target: BTreeMap<String, Target>,
} }
#[derive(RustcEncodable)] #[derive(RustcEncodable)]
@ -138,7 +138,7 @@ struct Builder {
input: PathBuf, input: PathBuf,
output: PathBuf, output: PathBuf,
gpg_passphrase: String, gpg_passphrase: String,
digests: HashMap<String, String>, digests: BTreeMap<String, String>,
s3_address: String, s3_address: String,
date: String, date: String,
rust_version: String, rust_version: String,
@ -162,7 +162,7 @@ fn main() {
input: input, input: input,
output: output, output: output,
gpg_passphrase: passphrase, gpg_passphrase: passphrase,
digests: HashMap::new(), digests: BTreeMap::new(),
s3_address: s3_address, s3_address: s3_address,
date: date, date: date,
rust_version: String::new(), rust_version: String::new(),
@ -214,7 +214,7 @@ impl Builder {
let mut manifest = Manifest { let mut manifest = Manifest {
manifest_version: "2".to_string(), manifest_version: "2".to_string(),
date: self.date.to_string(), date: self.date.to_string(),
pkg: HashMap::new(), pkg: BTreeMap::new(),
}; };
self.package("rustc", &mut manifest.pkg, HOSTS); self.package("rustc", &mut manifest.pkg, HOSTS);
@ -230,7 +230,7 @@ impl Builder {
let mut pkg = Package { let mut pkg = Package {
version: self.cached_version("rust").to_string(), version: self.cached_version("rust").to_string(),
target: HashMap::new(), target: BTreeMap::new(),
}; };
for host in HOSTS { for host in HOSTS {
let filename = self.filename("rust", host); let filename = self.filename("rust", host);
@ -299,7 +299,7 @@ impl Builder {
fn package(&mut self, fn package(&mut self,
pkgname: &str, pkgname: &str,
dst: &mut HashMap<String, Package>, dst: &mut BTreeMap<String, Package>,
targets: &[&str]) { targets: &[&str]) {
let targets = targets.iter().map(|name| { let targets = targets.iter().map(|name| {
let filename = self.filename(pkgname, name); let filename = self.filename(pkgname, name);