git: 922686e80097 - main - USES=cargo: Fix CARGO_BUILDDEP=any-version

From: Tobias Kortkamp <tobik_at_FreeBSD.org>
Date: Tue, 08 Nov 2022 09:15:59 UTC
The branch main has been updated by tobik:

URL: https://cgit.FreeBSD.org/ports/commit/?id=922686e80097c77e700c1788dd78fbd3bd8777a0

commit 922686e80097c77e700c1788dd78fbd3bd8777a0
Author:     Tobias Kortkamp <tobik@FreeBSD.org>
AuthorDate: 2022-11-08 09:12:59 +0000
Commit:     Tobias Kortkamp <tobik@FreeBSD.org>
CommitDate: 2022-11-08 09:12:59 +0000

    USES=cargo: Fix CARGO_BUILDDEP=any-version
    
    Fix update.sh to only replace the first version.
---
 Mk/Uses/cargo.mk    | 2 +-
 lang/rust/update.sh | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
index 91172824264d..cbf91d27c70a 100644
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -99,7 +99,7 @@ CARGO_BUILDDEP?=	yes
 .  if ${CARGO_BUILDDEP:tl} == "yes"
 BUILD_DEPENDS+=	${RUST_DEFAULT}>=1.64.0:lang/${RUST_DEFAULT}
 .  elif ${CARGO_BUILDDEP:tl} == "any-version"
-BUILD_DEPENDS+=	${RUST_DEFAULT}>=1.64.0:lang/${RUST_DEFAULT}
+BUILD_DEPENDS+=	${RUST_DEFAULT}>=0:lang/${RUST_DEFAULT}
 .  endif
 
 # Location of toolchain (default to lang/rust's toolchain)
diff --git a/lang/rust/update.sh b/lang/rust/update.sh
index 64ac7180b0b7..80b8da99b5c3 100644
--- a/lang/rust/update.sh
+++ b/lang/rust/update.sh
@@ -13,8 +13,11 @@ fetch -qo - https://raw.githubusercontent.com/rust-lang/rust/${new_commit}/src/s
 	"RUST_BOOTSTRAP_VERSION=\(.compiler.version)"
 ' | portedit merge -i .
 
-sed -i '' -E -e "s,(\\$\\{RUST_DEFAULT\\}>=).*(:lang/\\$\\{RUST_DEFAULT\\}),\\1${version}\\2," \
-	../../Mk/Uses/cargo.mk ../../Mk/bsd.gecko.mk
+cat <<EOF | sed -i '' -E -f - ../../Mk/Uses/cargo.mk ../../Mk/bsd.gecko.mk
+1,/\\$\\{RUST_DEFAULT\\}>=/ {
+	s,(\\$\\{RUST_DEFAULT\\}>=).*(:lang/\\$\\{RUST_DEFAULT\\}),\\1${version}\\2,
+}
+EOF
 
 portedit set-version -i "${version}" .
 portedit set-version -i "${version}" ../rust-bootstrap