From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 67D25139335 for ; Sun, 27 Jun 2021 00:33:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 58781E082B; Sun, 27 Jun 2021 00:33:15 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 10621E082B for ; Sun, 27 Jun 2021 00:33:14 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id EFC1F33E6A3 for ; Sun, 27 Jun 2021 00:33:12 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 581ED7A7 for ; Sun, 27 Jun 2021 00:33:11 +0000 (UTC) From: "Quentin Retornaz" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Quentin Retornaz" Message-ID: <1624753954.6ebf0cd98d3702562579c9895bad5f4569f8b8b9.quentin@gentoo> Subject: [gentoo-commits] repo/proj/libressl:master commit in: dev-lang/rust/files/, dev-lang/rust/ X-VCS-Repository: repo/proj/libressl X-VCS-Files: dev-lang/rust/files/1.53.0-miri-vergen.patch dev-lang/rust/files/1.53.0-rustversion-1.0.5.patch dev-lang/rust/rust-1.53.0.ebuild X-VCS-Directories: dev-lang/rust/ dev-lang/rust/files/ X-VCS-Committer: quentin X-VCS-Committer-Name: Quentin Retornaz X-VCS-Revision: 6ebf0cd98d3702562579c9895bad5f4569f8b8b9 X-VCS-Branch: master Date: Sun, 27 Jun 2021 00:33:11 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 7f3fae24-bbe1-4a2a-923e-4a34cfab78e0 X-Archives-Hash: 6c55647cd864255fa994206bfc27edf3 commit: 6ebf0cd98d3702562579c9895bad5f4569f8b8b9 Author: orbea riseup net> AuthorDate: Sat Jun 26 19:01:15 2021 +0000 Commit: Quentin Retornaz retornaz com> CommitDate: Sun Jun 27 00:32:34 2021 +0000 URL: https://gitweb.gentoo.org/repo/proj/libressl.git/commit/?id=6ebf0cd9 dev-lang/rust: Version bump Signed-off-by: orbea riseup.net> Closes: https://github.com/gentoo/libressl/pull/345 Signed-off-by: Quentin Retornaz retornaz.com> dev-lang/rust/files/1.53.0-miri-vergen.patch | 53 ++ dev-lang/rust/files/1.53.0-rustversion-1.0.5.patch | 234 +++++++ dev-lang/rust/rust-1.53.0.ebuild | 680 +++++++++++++++++++++ 3 files changed, 967 insertions(+) diff --git a/dev-lang/rust/files/1.53.0-miri-vergen.patch b/dev-lang/rust/files/1.53.0-miri-vergen.patch new file mode 100644 index 0000000..347f147 --- /dev/null +++ b/dev-lang/rust/files/1.53.0-miri-vergen.patch @@ -0,0 +1,53 @@ +From 64f128c45687d18d64fc6856a30fde585b007e00 Mon Sep 17 00:00:00 2001 +From: Ralf Jung +Date: Sat, 15 May 2021 14:17:30 +0200 +Subject: [PATCH] support building Miri outside a git repo + +--- + cargo-miri/bin.rs | 14 ++++++++------ + cargo-miri/build.rs | 2 +- + 2 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/cargo-miri/bin.rs b/cargo-miri/bin.rs +index e29bdc771..84447b3a1 100644 +--- a/src/tools/miri/cargo-miri/bin.rs ++++ b/src/tools/miri/cargo-miri/bin.rs +@@ -6,6 +6,7 @@ use std::io::{self, BufRead, BufReader, BufWriter, Read, Write}; + use std::ops::Not; + use std::path::{Path, PathBuf}; + use std::process::Command; ++use std::fmt::{Write as _}; + + use serde::{Deserialize, Serialize}; + +@@ -90,12 +91,13 @@ fn show_help() { + } + + fn show_version() { +- println!( +- "miri {} ({} {})", +- env!("CARGO_PKG_VERSION"), +- env!("VERGEN_GIT_SHA_SHORT"), +- env!("VERGEN_GIT_COMMIT_DATE") +- ); ++ let mut version = format!("miri {}", env!("CARGO_PKG_VERSION")); ++ // Only use `option_env` on vergen variables to ensure the build succeeds ++ // when vergen failed to find the git info. ++ if let Some(sha) = option_env!("VERGEN_GIT_SHA_SHORT") { ++ write!(&mut version, " ({} {})", sha, option_env!("VERGEN_GIT_COMMIT_DATE").unwrap()).unwrap(); ++ } ++ println!("{}", version); + } + + fn show_error(msg: String) -> ! { +diff --git a/cargo-miri/build.rs b/cargo-miri/build.rs +index cff135fe4..ebd8e7003 100644 +--- a/src/tools/miri/cargo-miri/build.rs ++++ b/src/tools/miri/cargo-miri/build.rs +@@ -7,5 +7,5 @@ fn main() { + let mut gen_config = vergen::Config::default(); + *gen_config.git_mut().sha_kind_mut() = vergen::ShaKind::Short; + *gen_config.git_mut().commit_timestamp_kind_mut() = vergen::TimestampKind::DateOnly; +- vergen(gen_config).expect("Unable to generate vergen keys!"); ++ vergen(gen_config).ok(); // Ignore failure (in case we are built outside a git repo) + } diff --git a/dev-lang/rust/files/1.53.0-rustversion-1.0.5.patch b/dev-lang/rust/files/1.53.0-rustversion-1.0.5.patch new file mode 100644 index 0000000..bc6ae8b --- /dev/null +++ b/dev-lang/rust/files/1.53.0-rustversion-1.0.5.patch @@ -0,0 +1,234 @@ +From 12efa21eb88cb43d3b927952da0c5635373ac92b Mon Sep 17 00:00:00 2001 +From: David Tolnay +Date: Thu, 17 Jun 2021 22:34:55 -0700 +Subject: [PATCH] Update rustversion to 1.0.5 + +--- + Cargo.lock | 4 +-- + vendor/rustversion/.cargo-checksum.json | 2 +- + vendor/rustversion/Cargo.toml | 2 +- + vendor/rustversion/build/build.rs | 6 ++++ + vendor/rustversion/build/rustc.rs | 30 +++++++++----------- + vendor/rustversion/src/lib.rs | 15 ++++++++++ + vendor/rustversion/src/time.rs | 13 +++++++-- + vendor/rustversion/tests/test_parse.rs | 10 +++++++ + vendor/rustversion/tests/ui/bad-bound.stderr | 4 +-- + vendor/rustversion/tests/ui/bad-date.stderr | 4 +-- + 10 files changed, 63 insertions(+), 27 deletions(-) + +diff --git a/Cargo.lock b/Cargo.lock +index 0939f19cdfe..26a89caf050 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -4582,9 +4582,9 @@ dependencies = [ + + [[package]] + name = "rustversion" +-version = "1.0.4" ++version = "1.0.5" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd" ++checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" + + [[package]] + name = "ryu" +diff --git a/vendor/rustversion/.cargo-checksum.json b/vendor/rustversion/.cargo-checksum.json +index e1277df7b59..0a134695aaf 100644 +--- a/vendor/rustversion/.cargo-checksum.json ++++ b/vendor/rustversion/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{"Cargo.toml":"1a91782510461d54726e816ae776042b95c79c9949d49c11b8782caefc22ead2","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"01dc6a1bf499a12bd0bfbbfe4db2ca8460b2c151235bcf2aad2356de4c2ec50a","build/build.rs":"481daf363b7004c90ffc3e012863a4102e9f26b9aaa2a4a295c2dd78f690be28","build/rustc.rs":"4dc8f1764672137bd15758cc19242740b0d6ab99e4a69171ad0999f9112a15a6","src/attr.rs":"9301cd4aff5a9648c057d5d8de9eb66921f0c3a715c51ada4459576bd49c8b19","src/bound.rs":"44bda74d3aacfeeeac9dae2f7eef3acc844d4c3c7eaa9d3e6288e5aeff269dff","src/constfn.rs":"613b8f53b21cc06b4f619fce9000993d3e7873b650701ca01cef1e53bed5b40a","src/date.rs":"454c749a60db8144a706a813e06fe3ae39c981920ba9832ef82f3f9debe1f052","src/error.rs":"cb37102f03ebbaca313d80f9714fe08dfef92fe956789ee87d93eb6121705f4f","src/expr.rs":"8e8ca76f4f5838436d9d7273f499c698bb41f6c15bc07d32ec5c1cb8bd3dd731","sr c/iter.rs":"8d4b817b9abc4e817105b673e15f29ef9bb8284a010ce01ac2d83387fe136947","src/lib.rs":"f8347832d8072058dbb4af6b8d67a834a02fe9c5460bbaa26defec4b66317f1b","src/release.rs":"abb8ddd877c39a023bf5e7bd67063d6e4144e79758a8bafa338167f9d15b89f1","src/time.rs":"45fb48ff0a0046a5a1b108b9ce53b14885637ad868ede1d66970379c2b7f16ef","src/token.rs":"824ce765f692db73afa02d3ebb0281c750748035efc98fa547be29d3072665ce","src/version.rs":"afdb048bba95bbb885945eba5527b6bf0eca0105642bfc304c2f82a8b7d556df","tests/compiletest.rs":"0a52a44786aea1c299c695bf948b2ed2081e4cc344e5c2cadceab4eb03d0010d","tests/test_const.rs":"a8297ca6559f895a3b2664964a42b6f82bbbc3c8faa9556a513006e6e1827995","tests/test_eval.rs":"6f0ee3f49c9a0d0c374a4d0e9a9dce753cd9fc2ca7725e000a435dbd5f4a9ce3","tests/test_parse.rs":"fbf9695f4208263743715e6c8b6294dfffee21462a65dfeb9339a70c0e18dbc6","tests/ui/bad-bound.rs":"25bde278fcaabf62868417148a5e5f2006bf589d7ebd7bf6004fb8d78e47594f","tests/ui/bad-bound.stderr":"bc9297f758c2541fb0a8b48d5785f4bb cd0d2a07d876ba0baf2fc9de9275e7e6","tests/ui/bad-date.rs":"6e23714dae8b6346fefe50dacd4abba3265248bbadfdd60c739138aa8a0037ba","tests/ui/bad-date.stderr":"1ac3cab13ee900fc8344e8fab21ff4d9cad476aca44925a4c1b2293a6b59b742","tests/ui/bad-not.rs":"f003df8bd245e9dd8edc3a6d94078ee5162fac7a98db881271f0f5b6db98d45d","tests/ui/bad-not.stderr":"d4ef78fae4a82419e737757158796cb103a5920df498956eaf57ed201797b463","tests/ui/bad-version.rs":"f4ea2cd038e6c63deb9c2e3ceffce93dbf179d9ce18c16d88f3b6cd7138a8c8e","tests/ui/bad-version.stderr":"60ed51c62f4c2fb6ff95cff7523cfca379ed434f319da9d82704318588792338","tests/ui/const-not-fn.rs":"10bbe38f0d89391fff0698756e4cfd4e72a41090360393a0c951b67df14d1c35","tests/ui/const-not-fn.stderr":"9551f7f222445b31d7af2415d467301c332d55bb3d5a143846484f2f00047a01"},"package":"cb5d2a036dc6d2d8fd16fde3498b04306e29bd193bf306a57427019b823d5acd"} +\ No newline at end of file ++{"files":{"Cargo.toml":"a09ee758f816eddff8a8c7fb5be54dd95e74caad18a207251faedd251ecfaf1c","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"01dc6a1bf499a12bd0bfbbfe4db2ca8460b2c151235bcf2aad2356de4c2ec50a","build/build.rs":"bae427f344972e6e0e348ec48dce0947274b3ec6cac0938497a8d3da5c9834e5","build/rustc.rs":"3e4acf7ea679f9331dd4e8dbe42a08a312f58379ea1eee5898793a9848d06d8c","src/attr.rs":"9301cd4aff5a9648c057d5d8de9eb66921f0c3a715c51ada4459576bd49c8b19","src/bound.rs":"44bda74d3aacfeeeac9dae2f7eef3acc844d4c3c7eaa9d3e6288e5aeff269dff","src/constfn.rs":"613b8f53b21cc06b4f619fce9000993d3e7873b650701ca01cef1e53bed5b40a","src/date.rs":"454c749a60db8144a706a813e06fe3ae39c981920ba9832ef82f3f9debe1f052","src/error.rs":"cb37102f03ebbaca313d80f9714fe08dfef92fe956789ee87d93eb6121705f4f","src/expr.rs":"8e8ca76f4f5838436d9d7273f499c698bb41f6c15bc07d32ec5c1cb8bd3dd731","sr c/iter.rs":"8d4b817b9abc4e817105b673e15f29ef9bb8284a010ce01ac2d83387fe136947","src/lib.rs":"5652f6f84fc80136bd29b2125f7676e80e0df7d40aac274b0658c99cecbd871d","src/release.rs":"abb8ddd877c39a023bf5e7bd67063d6e4144e79758a8bafa338167f9d15b89f1","src/time.rs":"bdd05a743b07a6bbfa0dbc9d4e415e051aba4a51a430c3be1e23447eae298c8b","src/token.rs":"824ce765f692db73afa02d3ebb0281c750748035efc98fa547be29d3072665ce","src/version.rs":"afdb048bba95bbb885945eba5527b6bf0eca0105642bfc304c2f82a8b7d556df","tests/compiletest.rs":"0a52a44786aea1c299c695bf948b2ed2081e4cc344e5c2cadceab4eb03d0010d","tests/test_const.rs":"a8297ca6559f895a3b2664964a42b6f82bbbc3c8faa9556a513006e6e1827995","tests/test_eval.rs":"6f0ee3f49c9a0d0c374a4d0e9a9dce753cd9fc2ca7725e000a435dbd5f4a9ce3","tests/test_parse.rs":"cdfe376020b9391330292968046117b0935c828d73385e8faeb2e333ec897088","tests/ui/bad-bound.rs":"25bde278fcaabf62868417148a5e5f2006bf589d7ebd7bf6004fb8d78e47594f","tests/ui/bad-bound.stderr":"a03dc78b380191c10d3b3406b1fd3208 bb2609d4c26b9c33ccd335721e3cd072","tests/ui/bad-date.rs":"6e23714dae8b6346fefe50dacd4abba3265248bbadfdd60c739138aa8a0037ba","tests/ui/bad-date.stderr":"3a607fb950a69f7dc1b503295bce53541f9dee9f4674edc5d13ee3a69ff0e8cd","tests/ui/bad-not.rs":"f003df8bd245e9dd8edc3a6d94078ee5162fac7a98db881271f0f5b6db98d45d","tests/ui/bad-not.stderr":"d4ef78fae4a82419e737757158796cb103a5920df498956eaf57ed201797b463","tests/ui/bad-version.rs":"f4ea2cd038e6c63deb9c2e3ceffce93dbf179d9ce18c16d88f3b6cd7138a8c8e","tests/ui/bad-version.stderr":"60ed51c62f4c2fb6ff95cff7523cfca379ed434f319da9d82704318588792338","tests/ui/const-not-fn.rs":"10bbe38f0d89391fff0698756e4cfd4e72a41090360393a0c951b67df14d1c35","tests/ui/const-not-fn.stderr":"9551f7f222445b31d7af2415d467301c332d55bb3d5a143846484f2f00047a01"},"package":"61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088"} +\ No newline at end of file +diff --git a/vendor/rustversion/Cargo.toml b/vendor/rustversion/Cargo.toml +index 56995ff0792..c72b1b2b343 100644 +--- a/vendor/rustversion/Cargo.toml ++++ b/vendor/rustversion/Cargo.toml +@@ -13,7 +13,7 @@ + [package] + edition = "2018" + name = "rustversion" +-version = "1.0.4" ++version = "1.0.5" + authors = ["David Tolnay "] + build = "build/build.rs" + description = "Conditional compilation according to rustc compiler version" +diff --git a/vendor/rustversion/build/build.rs b/vendor/rustversion/build/build.rs +index 2a8bc4af39f..15312510d68 100644 +--- a/vendor/rustversion/build/build.rs ++++ b/vendor/rustversion/build/build.rs +@@ -1,3 +1,9 @@ ++#![allow( ++ clippy::enum_glob_use, ++ clippy::must_use_candidate, ++ clippy::single_match_else ++)] ++ + mod rustc; + + use std::env; +diff --git a/vendor/rustversion/build/rustc.rs b/vendor/rustversion/build/rustc.rs +index 723e6bdd0e2..dfc6a05166f 100644 +--- a/vendor/rustversion/build/rustc.rs ++++ b/vendor/rustversion/build/rustc.rs +@@ -48,23 +48,21 @@ pub fn parse(string: &str) -> Option { + 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/vendor/rustversion/src/lib.rs b/vendor/rustversion/src/lib.rs +index 2614105dd1a..172eb89382f 100644 +--- a/vendor/rustversion/src/lib.rs ++++ b/vendor/rustversion/src/lib.rs +@@ -145,6 +145,21 @@ + //! + //!
+ ++#![allow( ++ clippy::cast_lossless, ++ clippy::cast_possible_truncation, ++ clippy::doc_markdown, ++ clippy::enum_glob_use, ++ clippy::from_iter_instead_of_collect, ++ clippy::module_name_repetitions, ++ clippy::must_use_candidate, ++ clippy::needless_doctest_main, ++ clippy::needless_pass_by_value, ++ clippy::redundant_else, ++ clippy::toplevel_ref_arg, ++ clippy::unreadable_literal ++)] ++ + extern crate proc_macro; + + mod attr; +diff --git a/vendor/rustversion/src/time.rs b/vendor/rustversion/src/time.rs +index 1e6dd9066b4..3c21463dd80 100644 +--- a/vendor/rustversion/src/time.rs ++++ b/vendor/rustversion/src/time.rs +@@ -1,4 +1,5 @@ + use crate::date::Date; ++use std::env; + use std::time::{SystemTime, UNIX_EPOCH}; + + // Timestamp of 2016-03-01 00:00:00 in UTC. +@@ -13,14 +14,20 @@ + + pub fn today() -> Date { + let default = Date { +- year: 2019, +- month: 1, +- day: 1, ++ year: 2020, ++ month: 2, ++ day: 25, + }; + try_today().unwrap_or(default) + } + + fn try_today() -> Option { ++ if let Some(pkg_name) = env::var_os("CARGO_PKG_NAME") { ++ if pkg_name.to_str() == Some("rustversion-tests") { ++ return None; // Stable date for ui testing. ++ } ++ } ++ + let now = SystemTime::now(); + let since_epoch = now.duration_since(UNIX_EPOCH).ok()?; + let secs = since_epoch.as_secs(); +diff --git a/vendor/rustversion/tests/test_parse.rs b/vendor/rustversion/tests/test_parse.rs +index 843bd73d3e5..cb39b3179f5 100644 +--- a/vendor/rustversion/tests/test_parse.rs ++++ b/vendor/rustversion/tests/test_parse.rs +@@ -1,3 +1,5 @@ ++#![allow(clippy::enum_glob_use, clippy::must_use_candidate)] ++ + include!("../build/rustc.rs"); + + #[test] +@@ -76,6 +78,14 @@ fn test_parse() { + }), + }, + ), ++ ( ++ "rustc 1.52.1-nightly (gentoo)", ++ Version { ++ minor: 52, ++ patch: 1, ++ channel: Dev, ++ }, ++ ), + ]; + + for (string, expected) in cases { +diff --git a/vendor/rustversion/tests/ui/bad-bound.stderr b/vendor/rustversion/tests/ui/bad-bound.stderr +index f8c498c8577..2c56acbdb33 100644 +--- a/vendor/rustversion/tests/ui/bad-bound.stderr ++++ b/vendor/rustversion/tests/ui/bad-bound.stderr +@@ -1,10 +1,10 @@ +-error: expected rustc release number like 1.31, or nightly date like 2020-10-26 ++error: expected rustc release number like 1.31, or nightly date like 2020-02-25 + --> $DIR/bad-bound.rs:1:22 + | + 1 | #[rustversion::since(stable)] + | ^^^^^^ + +-error: expected rustc release number like 1.31, or nightly date like 2020-10-26 ++error: expected rustc release number like 1.31, or nightly date like 2020-02-25 + --> $DIR/bad-bound.rs:4:26 + | + 4 | #[rustversion::any(since(stable))] +diff --git a/vendor/rustversion/tests/ui/bad-date.stderr b/vendor/rustversion/tests/ui/bad-date.stderr +index 734d7889075..c523ccc02bf 100644 +--- a/vendor/rustversion/tests/ui/bad-date.stderr ++++ b/vendor/rustversion/tests/ui/bad-date.stderr +@@ -1,10 +1,10 @@ +-error: expected nightly date, like 2020-10-26 ++error: expected nightly date, like 2020-02-25 + --> $DIR/bad-date.rs:1:24 + | + 1 | #[rustversion::nightly(stable)] + | ^^^^^^ + +-error: expected nightly date, like 2020-10-26 ++error: expected nightly date, like 2020-02-25 + --> $DIR/bad-date.rs:4:28 + | + 4 | #[rustversion::any(nightly(stable))] +-- +2.32.0 + diff --git a/dev-lang/rust/rust-1.53.0.ebuild b/dev-lang/rust/rust-1.53.0.ebuild new file mode 100644 index 0000000..0507d44 --- /dev/null +++ b/dev-lang/rust/rust-1.53.0.ebuild @@ -0,0 +1,680 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{7..9} ) + +inherit bash-completion-r1 check-reqs estack flag-o-matic llvm multiprocessing \ + multilib-build python-any-r1 rust-toolchain toolchain-funcs verify-sig + +if [[ ${PV} = *beta* ]]; then + betaver=${PV//*beta} + BETA_SNAPSHOT="${betaver:0:4}-${betaver:4:2}-${betaver:6:2}" + MY_P="rustc-beta" + SLOT="beta/${PV}" + SRC="${BETA_SNAPSHOT}/rustc-beta-src.tar.xz -> rustc-${PV}-src.tar.xz" +else + ABI_VER="$(ver_cut 1-2)" + SLOT="stable/${ABI_VER}" + MY_P="rustc-${PV}" + SRC="${MY_P}-src.tar.xz" + KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" +fi + +RUST_STAGE0_VERSION="1.$(($(ver_cut 2) - 1)).0" + +DESCRIPTION="Systems programming language from Mozilla" +HOMEPAGE="https://www.rust-lang.org/" + +SRC_URI=" + https://static.rust-lang.org/dist/${SRC} + verify-sig? ( https://static.rust-lang.org/dist/${SRC}.asc ) + !system-bootstrap? ( $(rust_all_arch_uris rust-${RUST_STAGE0_VERSION}) ) +" + +# keep in sync with llvm ebuild of the same version as bundled one. +ALL_LLVM_TARGETS=( AArch64 AMDGPU ARM AVR BPF Hexagon Lanai Mips MSP430 + NVPTX PowerPC RISCV Sparc SystemZ WebAssembly X86 XCore ) +ALL_LLVM_TARGETS=( "${ALL_LLVM_TARGETS[@]/#/llvm_targets_}" ) +LLVM_TARGET_USEDEPS=${ALL_LLVM_TARGETS[@]/%/(-)?} + +LICENSE="|| ( MIT Apache-2.0 ) BSD-1 BSD-2 BSD-4 UoI-NCSA" + +IUSE="clippy cpu_flags_x86_sse2 debug doc miri nightly parallel-compiler rls rustfmt system-bootstrap system-llvm test wasm ${ALL_LLVM_TARGETS[*]}" + +# Please keep the LLVM dependency block separate. Since LLVM is slotted, +# we need to *really* make sure we're not pulling more than one slot +# simultaneously. + +# How to use it: +# List all the working slots in LLVM_VALID_SLOTS, newest first. +LLVM_VALID_SLOTS=( 12 ) +LLVM_MAX_SLOT="${LLVM_VALID_SLOTS[0]}" + +# splitting usedeps needed to avoid CI/pkgcheck's UncheckableDep limitation +# (-) usedep needed because we may build with older llvm without that target +LLVM_DEPEND="|| ( " +for _s in ${LLVM_VALID_SLOTS[@]}; do + LLVM_DEPEND+=" ( " + for _x in ${ALL_LLVM_TARGETS[@]}; do + LLVM_DEPEND+=" + ${_x}? ( sys-devel/llvm:${_s}[${_x}(-)] )" + done + LLVM_DEPEND+=" )" +done +unset _s _x +LLVM_DEPEND+=" ) + /dev/null) ) + rustc_version=${rustc_version[0]#rust-bin-} + rustc_version=${rustc_version#rust-} + + [[ -z "${rustc_version}" ]] && die "Failed to determine rust version, check 'eselect rust' output" + + if ver_test "${rustc_version}" -lt "${rustc_wanted}" ; then + eerror "Rust >=${rustc_wanted} is required" + eerror "please run 'eselect rust' and set correct rust version" + die "selected rust version is too old" + elif ver_test "${rustc_version}" -ge "${rustc_toonew}" ; then + eerror "Rust <${rustc_toonew} is required" + eerror "please run 'eselect rust' and set correct rust version" + die "selected rust version is too new" + else + einfo "Using rust ${rustc_version} to build" + fi +} + +pre_build_checks() { + local M=8192 + # multiply requirements by 1.5 if we are doing x86-multilib + if use amd64; then + M=$(( $(usex abi_x86_32 15 10) * ${M} / 10 )) + fi + M=$(( $(usex clippy 128 0) + ${M} )) + M=$(( $(usex miri 128 0) + ${M} )) + M=$(( $(usex rls 512 0) + ${M} )) + M=$(( $(usex rustfmt 256 0) + ${M} )) + # add 2G if we compile llvm and 256M per llvm_target + if ! use system-llvm; then + M=$(( 2048 + ${M} )) + local ltarget + for ltarget in ${ALL_LLVM_TARGETS[@]}; do + M=$(( $(usex ${ltarget} 256 0) + ${M} )) + done + fi + M=$(( $(usex wasm 256 0) + ${M} )) + M=$(( $(usex debug 2 1) * ${M} )) + eshopts_push -s extglob + if is-flagq '-g?(gdb)?([1-9])'; then + M=$(( 15 * ${M} / 10 )) + fi + eshopts_pop + M=$(( $(usex system-bootstrap 0 1024) + ${M} )) + M=$(( $(usex doc 256 0) + ${M} )) + CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE} +} + +llvm_check_deps() { + has_version -r "sys-devel/llvm:${LLVM_SLOT}[${LLVM_TARGET_USEDEPS// /,}]" +} + +pkg_pretend() { + pre_build_checks +} + +pkg_setup() { + pre_build_checks + python-any-r1_pkg_setup + + export LIBGIT2_NO_PKG_CONFIG=1 #749381 + + use system-bootstrap && bootstrap_rust_version_check + + if use system-llvm; then + llvm_pkg_setup + + local llvm_config="$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" + export LLVM_LINK_SHARED=1 + export RUSTFLAGS="${RUSTFLAGS} -Lnative=$("${llvm_config}" --libdir)" + fi +} + +src_prepare() { + if ! use system-bootstrap; then + local rust_stage0_root="${WORKDIR}"/rust-stage0 + local rust_stage0="rust-${RUST_STAGE0_VERSION}-$(rust_abi)" + + "${WORKDIR}/${rust_stage0}"/install.sh --disable-ldconfig \ + --without=rust-docs --destdir="${rust_stage0_root}" --prefix=/ || die + fi + + default +} + +src_configure() { + local rust_target="" rust_targets="" arch_cflags + + # Collect rust target names to compile standard libs for all ABIs. + for v in $(multilib_get_enabled_abi_pairs); do + rust_targets="${rust_targets},\"$(rust_abi $(get_abi_CHOST ${v##*.}))\"" + done + if use wasm; then + rust_targets="${rust_targets},\"wasm32-unknown-unknown\"" + if use system-llvm; then + # un-hardcode rust-lld linker for this target + # https://bugs.gentoo.org/715348 + sed -i '/linker:/ s/rust-lld/wasm-ld/' compiler/rustc_target/src/spec/wasm_base.rs || die + fi + fi + rust_targets="${rust_targets#,}" + + local tools="\"cargo\"," + if use clippy; then + tools="\"clippy\",$tools" + fi + if use miri; then + tools="\"miri\",$tools" + fi + if use rls; then + tools="\"rls\",\"analysis\",\"src\",$tools" + fi + if use rustfmt; then + tools="\"rustfmt\",$tools" + fi + + local rust_stage0_root + if use system-bootstrap; then + local printsysroot + printsysroot="$(rustc --print sysroot || die "Can't determine rust's sysroot")" + rust_stage0_root="${printsysroot}" + else + rust_stage0_root="${WORKDIR}"/rust-stage0 + fi + # in case of prefix it will be already prefixed, as --print sysroot returns full path + [[ -d ${rust_stage0_root} ]] || die "${rust_stage0_root} is not a directory" + + rust_target="$(rust_abi)" + + cat <<- _EOF_ > "${S}"/config.toml + changelog-seen = 2 + [llvm] + download-ci-llvm = false + optimize = $(toml_usex !debug) + release-debuginfo = $(toml_usex debug) + assertions = $(toml_usex debug) + ninja = true + targets = "${LLVM_TARGETS// /;}" + experimental-targets = "" + link-shared = $(toml_usex system-llvm) + [build] + build-stage = 2 + test-stage = 2 + doc-stage = 2 + build = "${rust_target}" + host = ["${rust_target}"] + target = [${rust_targets}] + cargo = "${rust_stage0_root}/bin/cargo" + rustc = "${rust_stage0_root}/bin/rustc" + rustfmt = "${rust_stage0_root}/bin/rustfmt" + docs = $(toml_usex doc) + compiler-docs = false + submodules = false + python = "${EPYTHON}" + locked-deps = true + vendor = true + extended = true + tools = [${tools}] + verbose = 2 + sanitizers = false + profiler = false + cargo-native-static = false + [install] + prefix = "${EPREFIX}/usr/lib/${PN}/${PV}" + sysconfdir = "etc" + docdir = "share/doc/rust" + bindir = "bin" + libdir = "lib" + mandir = "share/man" + [rust] + # https://github.com/rust-lang/rust/issues/54872 + codegen-units-std = 1 + optimize = true + debug = $(toml_usex debug) + debug-assertions = $(toml_usex debug) + debug-assertions-std = $(toml_usex debug) + debuginfo-level = $(usex debug 2 0) + debuginfo-level-rustc = $(usex debug 2 0) + debuginfo-level-std = $(usex debug 2 0) + debuginfo-level-tools = $(usex debug 2 0) + debuginfo-level-tests = 0 + backtrace = true + incremental = false + default-linker = "$(tc-getCC)" + parallel-compiler = $(toml_usex parallel-compiler) + channel = "$(usex nightly nightly stable)" + description = "gentoo" + rpath = false + verbose-tests = true + optimize-tests = $(toml_usex !debug) + codegen-tests = true + dist-src = false + remap-debuginfo = true + lld = $(usex system-llvm false $(toml_usex wasm)) + # only deny warnings if doc+wasm are NOT requested, documenting stage0 wasm std fails without it + # https://github.com/rust-lang/rust/issues/74976 + # https://github.com/rust-lang/rust/issues/76526 + deny-warnings = $(usex wasm $(usex doc false true) true) + backtrace-on-ice = true + jemalloc = false + [dist] + src-tarball = false + compression-formats = ["gz"] + _EOF_ + + for v in $(multilib_get_enabled_abi_pairs); do + rust_target=$(rust_abi $(get_abi_CHOST ${v##*.})) + arch_cflags="$(get_abi_CFLAGS ${v##*.})" + + cat <<- _EOF_ >> "${S}"/config.env + CFLAGS_${rust_target}=${arch_cflags} + _EOF_ + + cat <<- _EOF_ >> "${S}"/config.toml + [target.${rust_target}] + cc = "$(tc-getBUILD_CC)" + cxx = "$(tc-getBUILD_CXX)" + linker = "$(tc-getCC)" + ar = "$(tc-getAR)" + _EOF_ + # librustc_target/spec/linux_musl_base.rs sets base.crt_static_default = true; + if use elibc_musl; then + cat <<- _EOF_ >> "${S}"/config.toml + crt-static = false + _EOF_ + fi + if use system-llvm; then + cat <<- _EOF_ >> "${S}"/config.toml + llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" + _EOF_ + fi + done + if use wasm; then + cat <<- _EOF_ >> "${S}"/config.toml + [target.wasm32-unknown-unknown] + linker = "$(usex system-llvm lld rust-lld)" + _EOF_ + fi + + if [[ -n ${I_KNOW_WHAT_I_AM_DOING_CROSS} ]]; then # whitespace intentionally shifted below + # experimental cross support + # discussion: https://bugs.gentoo.org/679878 + # TODO: c*flags, clang, system-llvm, cargo.eclass target support + # it would be much better if we could split out stdlib + # complilation to separate ebuild and abuse CATEGORY to + # just install to /usr/lib/rustlib/ + + # extra targets defined as a bash array + # spec format: :: + # best place would be /etc/portage/env/dev-lang/rust + # Example: + # RUST_CROSS_TARGETS=( + # "AArch64:aarch64-unknown-linux-gnu:aarch64-unknown-linux-gnu" + # ) + # no extra hand holding is done, no target transformations, all + # values are passed as-is with just basic checks, so it's up to user to supply correct values + # valid rust targets can be obtained with + # rustc --print target-list + # matching cross toolchain has to be installed + # matching LLVM_TARGET has to be enabled for both rust and llvm (if using system one) + # only gcc toolchains installed with crossdev are checked for now. + + # BUG: we can't pass host flags to cross compiler, so just filter for now + # BUG: this should be more fine-grained. + filter-flags '-mcpu=*' '-march=*' '-mtune=*' + + local cross_target_spec + for cross_target_spec in "${RUST_CROSS_TARGETS[@]}";do + # extracts first element form :: + local cross_llvm_target="${cross_target_spec%%:*}" + # extracts toolchain triples, : + local cross_triples="${cross_target_spec#*:}" + # extracts first element after before : separator + local cross_rust_target="${cross_triples%%:*}" + # extracts last element after : separator + local cross_toolchain="${cross_triples##*:}" + use llvm_targets_${cross_llvm_target} || die "need llvm_targets_${cross_llvm_target} target enabled" + command -v ${cross_toolchain}-gcc > /dev/null 2>&1 || die "need ${cross_toolchain} cross toolchain" + + cat <<- _EOF_ >> "${S}"/config.toml + [target.${cross_rust_target}] + cc = "${cross_toolchain}-gcc" + cxx = "${cross_toolchain}-g++" + linker = "${cross_toolchain}-gcc" + ar = "${cross_toolchain}-ar" + _EOF_ + if use system-llvm; then + cat <<- _EOF_ >> "${S}"/config.toml + llvm-config = "$(get_llvm_prefix "${LLVM_MAX_SLOT}")/bin/llvm-config" + _EOF_ + fi + if [[ "${cross_toolchain}" == *-musl* ]]; then + cat <<- _EOF_ >> "${S}"/config.toml + musl-root = "$(${cross_toolchain}-gcc -print-sysroot)/usr" + _EOF_ + fi + + # append cross target to "normal" target list + # example 'target = ["powerpc64le-unknown-linux-gnu"]' + # becomes 'target = ["powerpc64le-unknown-linux-gnu","aarch64-unknown-linux-gnu"]' + + rust_targets="${rust_targets},\"${cross_rust_target}\"" + sed -i "/^target = \[/ s#\[.*\]#\[${rust_targets}\]#" config.toml || die + + ewarn + ewarn "Enabled ${cross_rust_target} rust target" + ewarn "Using ${cross_toolchain} cross toolchain" + ewarn + if ! has_version -b 'sys-devel/binutils[multitarget]' ; then + ewarn "'sys-devel/binutils[multitarget]' is not installed" + ewarn "'strip' will be unable to strip cross libraries" + ewarn "cross targets will be installed with full debug information" + ewarn "enable 'multitarget' USE flag for binutils to be able to strip object files" + ewarn + ewarn "Alternatively llvm-strip can be used, it supports stripping any target" + ewarn "define STRIP=\"llvm-strip\" to use it (experimental)" + ewarn + fi + done + fi # I_KNOW_WHAT_I_AM_DOING_CROSS + + einfo "Rust configured with the following flags:" + echo + echo RUSTFLAGS="${RUSTFLAGS:-}" + echo RUSTFLAGS_BOOTSTRAP="${RUSTFLAGS_BOOTSTRAP:-}" + echo RUSTFLAGS_NOT_BOOTSTRAP="${RUSTFLAGS_NOT_BOOTSTRAP:-}" + env | grep "CARGO_TARGET_.*_RUSTFLAGS=" + cat "${S}"/config.env || die + echo + einfo "config.toml contents:" + cat "${S}"/config.toml || die + echo +} + +src_compile() { + # we need \n IFS to have config.env with spaces loaded properly. #734018 + ( + IFS=$'\n' + env $(cat "${S}"/config.env) RUST_BACKTRACE=1\ + "${EPYTHON}" ./x.py build -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die + ) +} + +src_test() { + # https://rustc-dev-guide.rust-lang.org/tests/intro.html + + # those are basic and codegen tests. + local tests=( + codegen + codegen-units + compile-fail + incremental + mir-opt + pretty + run-make + ) + + # fails if llvm is not built with ALL targets. + # and known to fail with system llvm sometimes. + use system-llvm || tests+=( assembly ) + + # fragile/expensive/less important tests + # or tests that require extra builds + # TODO: instead of skipping, just make some nonfatal. + if [[ ${ERUST_RUN_EXTRA_TESTS:-no} != no ]]; then + tests+=( + rustdoc + rustdoc-js + rustdoc-js-std + rustdoc-ui + run-make-fulldeps + ui + ui-fulldeps + ) + fi + + local i failed=() + einfo "rust_src_test: enabled tests ${tests[@]/#/src/test/}" + for i in "${tests[@]}"; do + local t="src/test/${i}" + einfo "rust_src_test: running ${t}" + if ! ( + IFS=$'\n' + env $(cat "${S}"/config.env) RUST_BACKTRACE=1 \ + "${EPYTHON}" ./x.py test -vv --config="${S}"/config.toml \ + -j$(makeopts_jobs) --no-doc --no-fail-fast "${t}" + ) + then + failed+=( "${t}" ) + eerror "rust_src_test: ${t} failed" + fi + done + + if [[ ${#failed[@]} -ne 0 ]]; then + eerror "rust_src_test: failure summary: ${failed[@]}" + die "aborting due to test failures" + fi +} + +src_install() { + ( + IFS=$'\n' + env $(cat "${S}"/config.env) DESTDIR="${D}" \ + "${EPYTHON}" ./x.py install -vv --config="${S}"/config.toml -j$(makeopts_jobs) || die + ) + + # bug #689562, #689160 + rm -v "${ED}/usr/lib/${PN}/${PV}/etc/bash_completion.d/cargo" || die + rmdir -v "${ED}/usr/lib/${PN}/${PV}"/etc{/bash_completion.d,} || die + newbashcomp src/tools/cargo/src/etc/cargo.bashcomp.sh cargo + + local symlinks=( + cargo + rustc + rustdoc + rust-gdb + rust-gdbgui + rust-lldb + ) + + use clippy && symlinks+=( clippy-driver cargo-clippy ) + use miri && symlinks+=( miri cargo-miri ) + use rls && symlinks+=( rls ) + use rustfmt && symlinks+=( rustfmt cargo-fmt ) + + einfo "installing eselect-rust symlinks and paths: ${symlinks[@]}" + local i + for i in "${symlinks[@]}"; do + # we need realpath on /usr/bin/* symlink return version-appended binary path. + # so /usr/bin/rustc should point to /usr/lib/rust//bin/rustc- + # need to fix eselect-rust to remove this hack. + local ver_i="${i}-${PV}" + if [[ -f "${ED}/usr/lib/${PN}/${PV}/bin/${i}" ]]; then + einfo "Installing ${i} symlink" + ln -v "${ED}/usr/lib/${PN}/${PV}/bin/${i}" "${ED}/usr/lib/${PN}/${PV}/bin/${ver_i}" || die + else + ewarn "${i} symlink requested, but source file not found" + ewarn "please report this" + fi + dosym "../lib/${PN}/${PV}/bin/${ver_i}" "/usr/bin/${ver_i}" + done + + # symlinks to switch components to active rust in eselect + dosym "${PV}/lib" "/usr/lib/${PN}/lib-${PV}" + dosym "${PV}/libexec" "/usr/lib/${PN}/libexec-${PV}" + dosym "${PV}/share/man" "/usr/lib/${PN}/man-${PV}" + dosym "rust/${PV}/lib/rustlib" "/usr/lib/rustlib-${PV}" + dosym "../../lib/${PN}/${PV}/share/doc/rust" "/usr/share/doc/${P}" + + newenvd - "50${P}" <<-_EOF_ + LDPATH="${EPREFIX}/usr/lib/rust/lib" + MANPATH="${EPREFIX}/usr/lib/rust/man" + $(use amd64 && usex elibc_musl 'CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '') + $(use arm64 && usex elibc_musl 'CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C target-feature=-crt-static"' '') + _EOF_ + + rm -rf "${ED}/usr/lib/${PN}/${PV}"/*.old || die + rm -rf "${ED}/usr/lib/${PN}/${PV}/doc"/*.old || die + + # note: eselect-rust adds EROOT to all paths below + cat <<-_EOF_ > "${T}/provider-${P}" + /usr/bin/cargo + /usr/bin/rustdoc + /usr/bin/rust-gdb + /usr/bin/rust-gdbgui + /usr/bin/rust-lldb + /usr/lib/rustlib + /usr/lib/rust/lib + /usr/lib/rust/libexec + /usr/lib/rust/man + /usr/share/doc/rust + _EOF_ + + if use clippy; then + echo /usr/bin/clippy-driver >> "${T}/provider-${P}" + echo /usr/bin/cargo-clippy >> "${T}/provider-${P}" + fi + if use miri; then + echo /usr/bin/miri >> "${T}/provider-${P}" + echo /usr/bin/cargo-miri >> "${T}/provider-${P}" + fi + if use rls; then + echo /usr/bin/rls >> "${T}/provider-${P}" + fi + if use rustfmt; then + echo /usr/bin/rustfmt >> "${T}/provider-${P}" + echo /usr/bin/cargo-fmt >> "${T}/provider-${P}" + fi + + insinto /etc/env.d/rust + doins "${T}/provider-${P}" +} + +pkg_postinst() { + eselect rust update + + if has_version sys-devel/gdb || has_version dev-util/lldb; then + elog "Rust installs a helper script for calling GDB and LLDB," + elog "for your convenience it is installed under /usr/bin/rust-{gdb,lldb}-${PV}." + fi + + if has_version app-editors/emacs; then + elog "install app-emacs/rust-mode to get emacs support for rust." + fi + + if has_version app-editors/gvim || has_version app-editors/vim; then + elog "install app-vim/rust-vim to get vim support for rust." + fi +} + +pkg_postrm() { + eselect rust cleanup +}