commit: 48168cfc3dc5291587caf5e7cc6559ac40005132 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> AuthorDate: Fri Jun 18 05:25:24 2021 +0000 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> CommitDate: Fri Jun 18 05:26:14 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=48168cfc
dev-lang/rust: add rustversion patch otherwise bootstrap may fail with nightly branded compiler Upstream-issue: https://github.com/dtolnay/rustversion/issues/28 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> dev-lang/rust/files/1.53.0-rustversion.patch | 80 ++++++++++++++++++++++++++++ dev-lang/rust/rust-1.53.0.ebuild | 1 + 2 files changed, 81 insertions(+) diff --git a/dev-lang/rust/files/1.53.0-rustversion.patch b/dev-lang/rust/files/1.53.0-rustversion.patch new file mode 100644 index 00000000000..a654d4ac7e6 --- /dev/null +++ b/dev-lang/rust/files/1.53.0-rustversion.patch @@ -0,0 +1,80 @@ +From b0b666350a91529caeb36e957e465eba3b6d7589 Mon Sep 17 00:00:00 2001 +From: David Tolnay <[email protected]> +Date: Fri, 14 May 2021 13:49:17 -0700 +Subject: [PATCH 1/2] Add regression test for issue 28 + +--- + tests/test_parse.rs | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/tests/test_parse.rs b/tests/test_parse.rs +index a5de1aa..cb39b31 100644 +--- a/vendor/rustversion/tests/test_parse.rs ++++ b/vendor/rustversion/tests/test_parse.rs +@@ -76,6 +76,14 @@ fn test_parse() { + }), + }, + ), ++ ( ++ "rustc 1.52.1-nightly (gentoo)", ++ Version { ++ minor: 52, ++ patch: 1, ++ channel: Dev, ++ }, ++ ), + ]; + + for (string, expected) in cases { + +From 2ee81bd2701915684137ae40415afa4b552af79e Mon Sep 17 00:00:00 2001 +From: David Tolnay <[email protected]> +Date: Fri, 14 May 2021 13:59:44 -0700 +Subject: [PATCH 2/2] Parse distro nightly without a date + +--- + build/rustc.rs | 30 ++++++++++++++---------------- + 1 file changed, 14 insertions(+), 16 deletions(-) + +diff --git a/build/rustc.rs b/build/rustc.rs +index 723e6bd..dfc6a05 100644 +--- a/vendor/rustversion/build/rustc.rs ++++ b/vendor/rustversion/build/rustc.rs +@@ -48,23 +48,21 @@ pub fn parse(string: &str) -> Option<Version> { + Some(channel) if channel == "dev" => Dev, + Some(channel) if channel.starts_with("beta") => Beta, + Some(channel) if channel == "nightly" => match words.next() { +- Some(hash) => { +- if !hash.starts_with('(') { +- return None; ++ Some(hash) if hash.starts_with('(') => match words.next() { ++ None if hash.ends_with(')') => Dev, ++ Some(date) if date.ends_with(')') => { ++ let mut date = date[..date.len() - 1].split('-'); ++ let year = date.next()?.parse().ok()?; ++ let month = date.next()?.parse().ok()?; ++ let day = date.next()?.parse().ok()?; ++ match date.next() { ++ None => Nightly(Date { year, month, day }), ++ Some(_) => return None, ++ } + } +- let date = words.next()?; +- if !date.ends_with(')') { +- return None; +- } +- let mut date = date[..date.len() - 1].split('-'); +- let year = date.next()?.parse().ok()?; +- let month = date.next()?.parse().ok()?; +- let day = date.next()?.parse().ok()?; +- match date.next() { +- None => Nightly(Date { year, month, day }), +- Some(_) => return None, +- } +- } ++ None | Some(_) => return None, ++ }, ++ Some(_) => return None, + None => Dev, + }, + Some(_) => return None, diff --git a/dev-lang/rust/rust-1.53.0.ebuild b/dev-lang/rust/rust-1.53.0.ebuild index 79a4b179f6b..07427b717a4 100644 --- a/dev-lang/rust/rust-1.53.0.ebuild +++ b/dev-lang/rust/rust-1.53.0.ebuild @@ -148,6 +148,7 @@ VERIFY_SIG_OPENPGP_KEY_PATH="/usr/share/openpgp-keys/rust.asc" PATCHES=( "${FILESDIR}"/1.47.0-ignore-broken-and-non-applicable-tests.patch "${FILESDIR}"/1.49.0-gentoo-musl-target-specs.patch + "${FILESDIR}"/1.53.0-rustversion.patch #https://github.com/dtolnay/rustversion/issues/28 ) S="${WORKDIR}/${MY_P}-src"
