Use time crate in bootstrap dist instead of date

This commit is contained in:
Onur Aslan 2018-02-05 11:39:54 +03:00
parent 07ea260407
commit 1461d12b3c
4 changed files with 6 additions and 3 deletions

1
src/Cargo.lock generated
View File

@ -133,6 +133,7 @@ dependencies = [
"serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
"toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
]

View File

@ -41,3 +41,4 @@ serde_derive = "1.0.8"
serde_json = "1.0.2"
toml = "0.4"
lazy_static = "0.2"
time = "0.1"

View File

@ -33,6 +33,7 @@ use builder::{Builder, RunConfig, ShouldRun, Step};
use compile;
use tool::{self, Tool};
use cache::{INTERNER, Interned};
use time;
pub fn pkgname(build: &Build, component: &str) -> String {
if component == "cargo" {
@ -445,8 +446,7 @@ impl Step for Rustc {
t!(fs::create_dir_all(image.join("share/man/man1")));
let man_src = build.src.join("src/doc/man");
let man_dst = image.join("share/man/man1");
let date_output = output(Command::new("date").arg("+%B %Y"));
let month_year = date_output.trim();
let month_year = t!(time::strftime("%B %Y", &time::now()));
// don't use our `bootstrap::util::{copy, cp_r}`, because those try
// to hardlink, and we don't want to edit the source templates
for entry_result in t!(fs::read_dir(man_src)) {
@ -456,7 +456,7 @@ impl Step for Rustc {
t!(fs::copy(&page_src, &page_dst));
// template in month/year and version number
replace_in_file(&page_dst,
&[("<INSERT DATE HERE>", month_year),
&[("<INSERT DATE HERE>", &month_year),
("<INSERT VERSION HERE>", channel::CFG_RELEASE_NUM)]);
}

View File

@ -130,6 +130,7 @@ extern crate cc;
extern crate getopts;
extern crate num_cpus;
extern crate toml;
extern crate time;
#[cfg(unix)]
extern crate libc;