Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sat, 03 Jul 2021 07:03:11
Message-Id: 1625295549.e24170cba4af14df622c4a2d465534583d30d625.gyakovlev@gentoo
1 commit: e24170cba4af14df622c4a2d465534583d30d625
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 2 00:34:04 2021 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 3 06:59:09 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e24170cb
7
8 cargo.eclass: support EAPI=8, misc changes
9
10 remove cargo-snapshot* unpacker, it was needed
11 for separate dev-util/cargo we used to have.
12
13 Bug: https://bugs.gentoo.org/715890
14 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
15
16 eclass/cargo.eclass | 39 ++++++++++++++++++++++++++-------------
17 1 file changed, 26 insertions(+), 13 deletions(-)
18
19 diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
20 index 15b9d455bde..9923b1c9deb 100644
21 --- a/eclass/cargo.eclass
22 +++ b/eclass/cargo.eclass
23 @@ -7,20 +7,33 @@
24 # @AUTHOR:
25 # Doug Goldstein <cardoe@g.o>
26 # Georgy Yakovlev <gyakovlev@×××××××.org>
27 -# @SUPPORTED_EAPIS: 7
28 +# @SUPPORTED_EAPIS: 7 8
29 # @BLURB: common functions and variables for cargo builds
30
31 if [[ -z ${_CARGO_ECLASS} ]]; then
32 _CARGO_ECLASS=1
33
34 -# we need this for 'cargo vendor' subcommand and net.offline config knob
35 -RUST_DEPEND=">=virtual/rust-1.37.0"
36 +# check and document RUST_DEPEND and options we need below in case conditions.
37 +# https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md
38 +RUST_DEPEND="virtual/rust"
39
40 case "${EAPI:-0}" in
41 0|1|2|3|4|5|6)
42 die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
43 ;;
44 7)
45 + # 1.37 added 'cargo vendor' subcommand and net.offline config knob
46 + RUST_DEPEND=">=virtual/rust-1.37.0"
47 + ;;
48 +
49 + 8)
50 + # 1.39 added --workspace
51 + # 1.46 added --target dir
52 + # 1.48 added term.progress config option
53 + # 1.51 added split-debuginfo profile option
54 + # 1.52 may need setting RUSTC_BOOTSTRAP envvar for some crates
55 + # 1.53 added cargo update --offline, can be used to update vulnerable crates from pre-fetched registry without editing toml
56 + RUST_DEPEND=">=virtual/rust-1.53"
57 ;;
58 *)
59 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
60 @@ -184,15 +197,6 @@ cargo_src_unpack() {
61 fi
62 eend $?
63 ;;
64 - cargo-snapshot*)
65 - ebegin "Unpacking ${archive}"
66 - mkdir -p "${S}"/target/snapshot
67 - tar -xzf "${DISTDIR}"/${archive} -C "${S}"/target/snapshot --strip-components 2 || die
68 - # cargo's makefile needs this otherwise it will try to
69 - # download it
70 - touch "${S}"/target/snapshot/bin/cargo || die
71 - eend $?
72 - ;;
73 *)
74 unpack ${archive}
75 ;;
76 @@ -376,7 +380,16 @@ cargo_src_install() {
77 rm -f "${ED}/usr/.crates.toml" || die
78 rm -f "${ED}/usr/.crates2.json" || die
79
80 - [ -d "${S}/man" ] && doman "${S}/man" || return 0
81 + # it turned out to be non-standard dir, so get rid of it future EAPI
82 + # and only run for EAPI=7
83 + # https://bugs.gentoo.org/715890
84 + case ${EAPI:-0} in
85 + 7)
86 + if [ -d "${S}/man" ]; then
87 + doman "${S}/man" || return 0
88 + fi
89 + ;;
90 + esac
91 }
92
93 # @FUNCTION: cargo_src_test