commit:     681ca5418e6a79fdf0e5213e672b568c055ba83a
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 10 06:48:22 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 10 06:50:47 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=681ca541

cargo.eclass: make cargo_live_src_unpack idempotent

Allow multiple calls w/ different S set by guarding the symlink creation.

Bug: https://bugs.gentoo.org/902725
Signed-off-by: Sam James <sam <AT> gentoo.org>

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

diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass
index 7e6fe5c55f9e..991e808d453f 100644
--- a/eclass/cargo.eclass
+++ b/eclass/cargo.eclass
@@ -403,8 +403,8 @@ cargo_live_src_unpack() {
 
        # Users may have git checkouts made by cargo.
        # While cargo vendors the sources, it still needs git checkout to be 
present.
-       # Copying full dir is an overkill, so just symlink it.
-       if [[ -d ${ECARGO_REGISTRY_DIR}/git ]]; then
+       # Copying full dir is overkill, so just symlink it (guard w/ -L to keep 
idempotent).
+       if [[ -d ${ECARGO_REGISTRY_DIR}/git && ! -L "${ECARGO_HOME}/git" ]]; 
then
                ln -sv "${ECARGO_REGISTRY_DIR}/git" "${ECARGO_HOME}/git" || die
        fi
 

Reply via email to