diff options
| author | kennytm <kennytm@gmail.com> | 2018-02-07 03:23:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-07 03:23:26 +0800 |
| commit | 3373f656824d3e6c2a5af149e9fa1dbe3161ade9 (patch) | |
| tree | d92bda871b057571abe975ae7cc123401e4f25bb | |
| parent | 4f184eb6a383de7c6421d77544182fd94e216e45 (diff) | |
| parent | 1461d12b3c9778a51c443b804f2db5e235554151 (diff) | |
| download | rust-3373f656824d3e6c2a5af149e9fa1dbe3161ade9.tar.gz rust-3373f656824d3e6c2a5af149e9fa1dbe3161ade9.zip | |
Rollup merge of #48013 - onur:use-time-in-bootstrap-dist, r=alexcrichton
Use time crate in bootstrap dist instead of date `bootstrap dist` command is trying to run *NIX specific `date` command to get current month and year. This command keep failing when it's called on a Windows command prompt. This patch is making it use time crate. Closes: #47908
| -rw-r--r-- | src/Cargo.lock | 1 | ||||
| -rw-r--r-- | src/bootstrap/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/bootstrap/dist.rs | 6 | ||||
| -rw-r--r-- | src/bootstrap/lib.rs | 1 |
4 files changed, 6 insertions, 3 deletions
diff --git a/src/Cargo.lock b/src/Cargo.lock index 1393dd46d6b..52ed134c01e 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -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)", ] diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index bbbbf0e1915..2d478341317 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -41,3 +41,4 @@ serde_derive = "1.0.8" serde_json = "1.0.2" toml = "0.4" lazy_static = "0.2" +time = "0.1" diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs index dbb7d19e432..6717b1cb098 100644 --- a/src/bootstrap/dist.rs +++ b/src/bootstrap/dist.rs @@ -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)]); } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index f2a7ce30c8a..a84a6a8990b 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -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; |
