From ac8892bdb227e135ed7e5c3f8bb34b6b031a4579 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 25 Apr 2017 16:08:14 +0200 Subject: [PATCH 01/10] Accept arbitrary filenames into URLs in build-manifest instead of combining the component and target into a URL. --- src/tools/build-manifest/src/main.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index a8cb30da43513..c6f6b2dbc0f21 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -293,7 +293,7 @@ impl Builder { pkg.target.insert(host.to_string(), Target { available: true, - url: Some(self.url("rust", host)), + url: Some(self.url(&filename)), hash: Some(digest), components: Some(components), extensions: Some(extensions), @@ -325,7 +325,7 @@ impl Builder { (name.to_string(), Target { available: true, - url: Some(self.url(pkgname, name)), + url: Some(self.url(&filename)), hash: Some(digest), components: None, extensions: None, @@ -338,11 +338,11 @@ impl Builder { }); } - fn url(&self, component: &str, target: &str) -> String { + fn url(&self, filename: &str) -> String { format!("{}/{}/{}", self.s3_address, self.date, - self.filename(component, target)) + filename) } fn filename(&self, component: &str, target: &str) -> String { From 5439c9b4ec975083cb1bc2000a5faa21f737997a Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 25 Apr 2017 16:11:18 +0200 Subject: [PATCH 02/10] Define the unavailable target just once and re-use it The same unavailable target value is used in two different places. Abstracting it makes it easier to update it and recognise its purpose. --- src/tools/build-manifest/src/main.rs | 30 +++++++++++++--------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index c6f6b2dbc0f21..574af1246361d 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -120,6 +120,18 @@ struct Target { extensions: Option>, } +impl Target { + fn unavailable() -> Target { + Target { + available: false, + url: None, + hash: None, + components: None, + extensions: None, + } + } +} + #[derive(RustcEncodable)] struct Component { pkg: String, @@ -242,13 +254,7 @@ impl Builder { let digest = match self.digests.remove(&filename) { Some(digest) => digest, None => { - pkg.target.insert(host.to_string(), Target { - available: false, - url: None, - hash: None, - components: None, - extensions: None, - }); + pkg.target.insert(host.to_string(), Target::unavailable()); continue } }; @@ -312,15 +318,7 @@ impl Builder { let filename = self.filename(pkgname, name); let digest = match self.digests.remove(&filename) { Some(digest) => digest, - None => { - return (name.to_string(), Target { - available: false, - url: None, - hash: None, - components: None, - extensions: None, - }) - } + None => return (name.to_string(), Target::unavailable()), }; (name.to_string(), Target { From b1ab145ec265aaa9b6cc9978ae1ef222cdf9e018 Mon Sep 17 00:00:00 2001 From: Martin Hafskjold Thoresen Date: Tue, 2 May 2017 21:12:27 +0200 Subject: [PATCH 03/10] Fix up @martinhath's mailmap entry --- .mailmap | 1 + 1 file changed, 1 insertion(+) diff --git a/.mailmap b/.mailmap index 4b4f343d15a9d..ee5b6f257b555 100644 --- a/.mailmap +++ b/.mailmap @@ -139,6 +139,7 @@ Margaret Meyerhofer Mark Sinclair Mark Sinclair =Mark Sinclair <=125axel125@gmail.com> Markus Westerlind Markus +Martin Hafskjold Thoresen Matej Lach Matej Ľach Matt Brubeck Matthew Auld From aa10fce346e1a19f4badb22a6bb8a240c1fd53db Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Tue, 2 May 2017 23:55:40 -0400 Subject: [PATCH 04/10] Update Duration::from_secs doc example to show underlying values. --- src/libstd/time/duration.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index af7eaeb3106b2..bd8c1fac2dba9 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -84,7 +84,10 @@ impl Duration { /// ``` /// use std::time::Duration; /// - /// let five_seconds = Duration::from_secs(5); + /// let duration = Duration::from_secs(5); + /// + /// assert_eq!(5, duration.as_secs()); + /// assert_eq!(0, duration.subsec_nanos()); /// ``` #[stable(feature = "duration", since = "1.3.0")] #[inline] From ee8ad8eb2e38092096d241f5c2a9df369029497c Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Tue, 2 May 2017 23:56:29 -0400 Subject: [PATCH 05/10] Update Duration::from_millis doc example to show underlying values. --- src/libstd/time/duration.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index bd8c1fac2dba9..268ce733fa314 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -102,7 +102,10 @@ impl Duration { /// ``` /// use std::time::Duration; /// - /// let five_seconds = Duration::from_millis(5000); + /// let duration = Duration::from_millis(2569); + /// + /// assert_eq!(2, duration.as_secs()); + /// assert_eq!(569000000, duration.subsec_nanos()); /// ``` #[stable(feature = "duration", since = "1.3.0")] #[inline] From bdd8e7ffe6cb1cdf100b9ca071e826f153371245 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Tue, 2 May 2017 23:58:39 -0400 Subject: [PATCH 06/10] Update Duration::as_secs doc example to demonstrate truncation. --- src/libstd/time/duration.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 268ce733fa314..4f8f9c36ec76d 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -125,8 +125,8 @@ impl Duration { /// ``` /// use std::time::Duration; /// - /// let five_seconds = Duration::new(5, 0); - /// assert_eq!(five_seconds.as_secs(), 5); + /// let duration = Duration::new(5, 730023852); + /// assert_eq!(duration.as_secs(), 5); /// ``` #[stable(feature = "duration", since = "1.3.0")] #[inline] From a3e8f3622f62022d98c2df1f096f4ef88efb6386 Mon Sep 17 00:00:00 2001 From: Corey Farwell Date: Wed, 3 May 2017 00:04:59 -0400 Subject: [PATCH 07/10] Add doc example for how to determine total number of secs in Duration. --- src/libstd/time/duration.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 4f8f9c36ec76d..55766ba3fed6a 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -128,6 +128,21 @@ impl Duration { /// let duration = Duration::new(5, 730023852); /// assert_eq!(duration.as_secs(), 5); /// ``` + /// + /// To determine the total number of seconds represented by the `Duration`, + /// use `as_secs` in combination with [`subsec_nanos`]: + /// + /// ``` + /// use std::time::Duration; + /// + /// let duration = Duration::new(5, 730023852); + /// + /// assert_eq!(5.730023852, + /// duration.as_secs() as f64 + /// + duration.subsec_nanos() as f64 * 1e-9); + /// ``` + /// + /// [`subsec_nanos`]: #method.subsec_nanos #[stable(feature = "duration", since = "1.3.0")] #[inline] pub fn as_secs(&self) -> u64 { self.secs } From 28a4f57dd0161d7602aed0005ebeddaa5e646367 Mon Sep 17 00:00:00 2001 From: Michael Gattozzi Date: Wed, 3 May 2017 01:13:18 -0400 Subject: [PATCH 08/10] Update ChildStdin/ChildStdout docs to be clearer --- src/libstd/process.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 23ebeb4b8e3fc..3896fc20a2dde 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -148,8 +148,9 @@ impl fmt::Debug for Child { } } -/// A handle to a child process's stdin. This struct is used in the [`stdin`] -/// field on [`Child`]. +/// A handle to a child process's stdin. +/// +/// This struct is used in the [`stdin`] field on [`Child`]. /// /// [`Child`]: struct.Child.html /// [`stdin`]: struct.Child.html#structfield.stdin @@ -190,8 +191,9 @@ impl fmt::Debug for ChildStdin { } } -/// A handle to a child process's stdout. This struct is used in the [`stdout`] -/// field on [`Child`]. +/// A handle to a child process's stdout. +/// +/// This struct is used in the [`stdout`] field on [`Child`]. /// /// [`Child`]: struct.Child.html /// [`stdout`]: struct.Child.html#structfield.stdout From 5dfa08ee1be4cf6485ed6ece0c2b08be394ab8c6 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 25 Apr 2017 16:14:28 +0200 Subject: [PATCH 09/10] Emit information about XZ packages in manifest --- src/rust-installer | 2 +- src/tools/build-manifest/src/main.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/rust-installer b/src/rust-installer index 4f994850808a5..4cf7397fb0566 160000 --- a/src/rust-installer +++ b/src/rust-installer @@ -1 +1 @@ -Subproject commit 4f994850808a572e2cc8d43f968893c8e942e9bf +Subproject commit 4cf7397fb0566e745f0bce4c5b009cfeb5d12c53 diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 574af1246361d..ba37863b1f62d 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -116,6 +116,8 @@ struct Target { available: bool, url: Option, hash: Option, + xz_url: Option, + xz_hash: Option, components: Option>, extensions: Option>, } @@ -126,6 +128,8 @@ impl Target { available: false, url: None, hash: None, + xz_url: None, + xz_hash: None, components: None, extensions: None, } @@ -258,6 +262,8 @@ impl Builder { continue } }; + let xz_filename = filename.replace(".tar.gz", ".tar.xz"); + let xz_digest = self.digests.remove(&xz_filename); let mut components = Vec::new(); let mut extensions = Vec::new(); @@ -301,6 +307,8 @@ impl Builder { available: true, url: Some(self.url(&filename)), hash: Some(digest), + xz_url: xz_digest.as_ref().map(|_| self.url(&xz_filename)), + xz_hash: xz_digest, components: Some(components), extensions: Some(extensions), }); @@ -320,11 +328,15 @@ impl Builder { Some(digest) => digest, None => return (name.to_string(), Target::unavailable()), }; + let xz_filename = filename.replace(".tar.gz", ".tar.xz"); + let xz_digest = self.digests.remove(&xz_filename); (name.to_string(), Target { available: true, url: Some(self.url(&filename)), hash: Some(digest), + xz_url: xz_digest.as_ref().map(|_| self.url(&xz_filename)), + xz_hash: xz_digest, components: None, extensions: None, }) From 5e522d73a3664bbfd0ec5a9ad4efee4165c35d37 Mon Sep 17 00:00:00 2001 From: Andrea Canciani Date: Tue, 2 May 2017 01:42:30 +0200 Subject: [PATCH 10/10] Fix MacOSX build MacOSX does not ship `7z` nor `xz`. Let's use `xz`, just like on the other *nix systems. --- .travis.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5d56379dccebf..5c658f3a8b1b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -95,7 +95,9 @@ matrix: MACOSX_DEPLOYMENT_TARGET=10.7 os: osx osx_image: xcode7 - install: *osx_install_sccache + install: + - brew update && brew install xz + - *osx_install_sccache - env: > RUST_CHECK_TARGET=dist RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-extended" @@ -106,7 +108,9 @@ matrix: MACOSX_DEPLOYMENT_TARGET=10.7 os: osx osx_image: xcode7 - install: *osx_install_sccache + install: + - brew update && brew install xz + - *osx_install_sccache # "alternate" deployments, these are "nightlies" but don't have assertions # turned on, they're deployed to a different location primarily for projects @@ -123,7 +127,9 @@ matrix: MACOSX_DEPLOYMENT_TARGET=10.7 os: osx osx_image: xcode7 - install: *osx_install_sccache + install: + - brew update && brew install xz + - *osx_install_sccache env: global: