commit:     e13b0ea6d4432745d9275d98fdb7ee36cd62ac8f
Author:     Matt Jolly <kangie <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 25 12:40:51 2024 +0000
Commit:     Matt Jolly <kangie <AT> gentoo <DOT> org>
CommitDate: Mon Dec  2 07:54:17 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e13b0ea6

cargo.eclass: add ${CARGO_BOOTSTRAP}

This variable enables ebuilds to tell the eclass to ignore
the minimum Rust/Cargo version reqirement. It is intended
for use when bootstrapping older Rust, consumers who are
not dev-lang/rust should have a good reason for using this.

Signed-off-by: Matt Jolly <kangie <AT> gentoo.org>

 eclass/cargo.eclass | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index 95ff317e1f21..5a3820267544 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -30,6 +30,9 @@ fi
 # Either the lowest slot supported by rust.eclass _or_
 # reference the changelog for a particular feature requirement
 # https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md
+# For reference the actual minimum version of cargo that can be used
+# is 1.53.0 for `cargo update --offline`; updated to 1.71.1 with rust eclass.
+# No need to enable usage of legacy rust versions in ebuilds; keep it as-is.
 _CARGO_ECLASS_RUST_MIN_VER="1.71.1"
 
 case ${EAPI} in
@@ -37,8 +40,10 @@ case ${EAPI} in
                if [[ -n ${RUST_MIN_VER} ]]; then
                        # This is _very_ unlikely given that we leverage the 
rust eclass but just in case cargo requires a newer version
                        # than the oldest in-tree in future.
-                       if ver_test "${RUST_MIN_VER}" -lt 
"${_CARGO_ECLASS_RUST_MIN_VER}"; then
-                               die "RUST_MIN_VERSION must be at least 
${_CARGO_ECLASS_RUST_MIN_VER}"
+                       if [[ -z ${CARGO_BOOTSTRAP} ]]; then
+                               if ver_test "${RUST_MIN_VER}" -lt 
"${_CARGO_ECLASS_RUST_MIN_VER}"; then
+                                       die "RUST_MIN_VERSION must be at least 
${_CARGO_ECLASS_RUST_MIN_VER}"
+                               fi
                        fi
                else
                        RUST_MIN_VER="${_CARGO_ECLASS_RUST_MIN_VER}"
@@ -109,6 +114,13 @@ ECARGO_VENDOR="${ECARGO_HOME}/gentoo"
 # )
 # @CODE
 
+# @ECLASS_VARIABLE: CARGO_BOOTSTRAP
+# @DEFAULT_UNSET
+# @PRE_INHERIT
+# @DESCRIPTION:
+# Ignore `_CARGO_ECLASS_RUST_MIN_VER` checks.
+# If you aren't bootstrapping Rust you probably don't need this.
+
 # @ECLASS_VARIABLE: CARGO_OPTIONAL
 # @DEFAULT_UNSET
 # @PRE_INHERIT

Reply via email to