|
11 | 11 | extern crate toml;
|
12 | 12 | extern crate rustc_serialize;
|
13 | 13 |
|
14 |
| -use std::collections::HashMap; |
| 14 | +use std::collections::{BTreeMap, HashMap}; |
15 | 15 | use std::env;
|
16 | 16 | use std::fs::File;
|
17 | 17 | use std::io::{self, Read, Write};
|
@@ -95,7 +95,6 @@ static MINGW: &'static [&'static str] = &[
|
95 | 95 | "x86_64-pc-windows-gnu",
|
96 | 96 | ];
|
97 | 97 |
|
98 |
| -#[derive(RustcEncodable)] |
99 | 98 | struct Manifest {
|
100 | 99 | manifest_version: String,
|
101 | 100 | date: String,
|
@@ -171,8 +170,18 @@ impl Builder {
|
171 | 170 | self.cargo_version = self.version("cargo", "x86_64-unknown-linux-gnu");
|
172 | 171 |
|
173 | 172 | self.digest_and_sign();
|
174 |
| - let manifest = self.build_manifest(); |
175 |
| - let manifest = toml::encode(&manifest).to_string(); |
| 173 | + let Manifest { manifest_version, date, pkg } = self.build_manifest(); |
| 174 | + |
| 175 | + // Unfortunately we can't use derive(RustcEncodable) here because the |
| 176 | + // version field is called `manifest-version`, not `manifest_version`. |
| 177 | + // In lieu of that just create the table directly here with a `BTreeMap` |
| 178 | + // and wrap it up in a `Value::Table`. |
| 179 | + let mut manifest = BTreeMap::new(); |
| 180 | + manifest.insert("manifest-version".to_string(), |
| 181 | + toml::Value::String(manifest_version)); |
| 182 | + manifest.insert("date".to_string(), toml::Value::String(date)); |
| 183 | + manifest.insert("pkg".to_string(), toml::encode(&pkg)); |
| 184 | + let manifest = toml::Value::Table(manifest).to_string(); |
176 | 185 |
|
177 | 186 | let filename = format!("channel-rust-{}.toml", self.channel);
|
178 | 187 | self.write_manifest(&manifest, &filename);
|
@@ -352,7 +361,8 @@ impl Builder {
|
352 | 361 | fn hash(&self, path: &Path) -> String {
|
353 | 362 | let sha = t!(Command::new("shasum")
|
354 | 363 | .arg("-a").arg("256")
|
355 |
| - .arg(path) |
| 364 | + .arg(path.file_name().unwrap()) |
| 365 | + .current_dir(path.parent().unwrap()) |
356 | 366 | .output());
|
357 | 367 | assert!(sha.status.success());
|
358 | 368 |
|
|
0 commit comments