Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/rust/files/, dev-lang/rust/
Date: Fri, 18 Jun 2021 09:16:46
Message-Id: 1624007643.895e90ff6caf38ed0625ca12feb4f7230794947e.gyakovlev@gentoo
1 commit: 895e90ff6caf38ed0625ca12feb4f7230794947e
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jun 18 08:34:35 2021 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 18 09:14:03 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=895e90ff
7
8 dev-lang/rust: add miri patch to 1.53.0
9
10 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
11
12 dev-lang/rust/files/1.53.0-miri-vergen.patch | 53 ++++++++++++++++++++++++++++
13 dev-lang/rust/rust-1.53.0.ebuild | 1 +
14 2 files changed, 54 insertions(+)
15
16 diff --git a/dev-lang/rust/files/1.53.0-miri-vergen.patch b/dev-lang/rust/files/1.53.0-miri-vergen.patch
17 new file mode 100644
18 index 00000000000..347f147c994
19 --- /dev/null
20 +++ b/dev-lang/rust/files/1.53.0-miri-vergen.patch
21 @@ -0,0 +1,53 @@
22 +From 64f128c45687d18d64fc6856a30fde585b007e00 Mon Sep 17 00:00:00 2001
23 +From: Ralf Jung <post@×××××.de>
24 +Date: Sat, 15 May 2021 14:17:30 +0200
25 +Subject: [PATCH] support building Miri outside a git repo
26 +
27 +---
28 + cargo-miri/bin.rs | 14 ++++++++------
29 + cargo-miri/build.rs | 2 +-
30 + 2 files changed, 9 insertions(+), 7 deletions(-)
31 +
32 +diff --git a/cargo-miri/bin.rs b/cargo-miri/bin.rs
33 +index e29bdc771..84447b3a1 100644
34 +--- a/src/tools/miri/cargo-miri/bin.rs
35 ++++ b/src/tools/miri/cargo-miri/bin.rs
36 +@@ -6,6 +6,7 @@ use std::io::{self, BufRead, BufReader, BufWriter, Read, Write};
37 + use std::ops::Not;
38 + use std::path::{Path, PathBuf};
39 + use std::process::Command;
40 ++use std::fmt::{Write as _};
41 +
42 + use serde::{Deserialize, Serialize};
43 +
44 +@@ -90,12 +91,13 @@ fn show_help() {
45 + }
46 +
47 + fn show_version() {
48 +- println!(
49 +- "miri {} ({} {})",
50 +- env!("CARGO_PKG_VERSION"),
51 +- env!("VERGEN_GIT_SHA_SHORT"),
52 +- env!("VERGEN_GIT_COMMIT_DATE")
53 +- );
54 ++ let mut version = format!("miri {}", env!("CARGO_PKG_VERSION"));
55 ++ // Only use `option_env` on vergen variables to ensure the build succeeds
56 ++ // when vergen failed to find the git info.
57 ++ if let Some(sha) = option_env!("VERGEN_GIT_SHA_SHORT") {
58 ++ write!(&mut version, " ({} {})", sha, option_env!("VERGEN_GIT_COMMIT_DATE").unwrap()).unwrap();
59 ++ }
60 ++ println!("{}", version);
61 + }
62 +
63 + fn show_error(msg: String) -> ! {
64 +diff --git a/cargo-miri/build.rs b/cargo-miri/build.rs
65 +index cff135fe4..ebd8e7003 100644
66 +--- a/src/tools/miri/cargo-miri/build.rs
67 ++++ b/src/tools/miri/cargo-miri/build.rs
68 +@@ -7,5 +7,5 @@ fn main() {
69 + let mut gen_config = vergen::Config::default();
70 + *gen_config.git_mut().sha_kind_mut() = vergen::ShaKind::Short;
71 + *gen_config.git_mut().commit_timestamp_kind_mut() = vergen::TimestampKind::DateOnly;
72 +- vergen(gen_config).expect("Unable to generate vergen keys!");
73 ++ vergen(gen_config).ok(); // Ignore failure (in case we are built outside a git repo)
74 + }
75
76 diff --git a/dev-lang/rust/rust-1.53.0.ebuild b/dev-lang/rust/rust-1.53.0.ebuild
77 index e8b0c98a8c1..c48d00bb2a6 100644
78 --- a/dev-lang/rust/rust-1.53.0.ebuild
79 +++ b/dev-lang/rust/rust-1.53.0.ebuild
80 @@ -149,6 +149,7 @@ PATCHES=(
81 "${FILESDIR}"/1.47.0-ignore-broken-and-non-applicable-tests.patch
82 "${FILESDIR}"/1.49.0-gentoo-musl-target-specs.patch
83 "${FILESDIR}"/1.53.0-rustversion-1.0.5.patch # https://github.com/rust-lang/rust/pull/86425
84 + "${FILESDIR}"/1.53.0-miri-vergen.patch # https://github.com/rust-lang/rust/issues/84182
85 )
86
87 S="${WORKDIR}/${MY_P}-src"