about summary refs log tree commit diff
path: root/pkgs/build-support/rust
diff options
context:
space:
mode:
authorRicardo M. Correia <rcorreia@wizy.org>2015-11-24 20:42:31 +0100
committerRicardo M. Correia <rcorreia@wizy.org>2015-11-24 20:50:11 +0100
commit799f0f1f239b00177b72322e261ab350647dbd60 (patch)
tree4281d429c4b93959d0e1afa735c9178d8ee49259 /pkgs/build-support/rust
parent373da3b815bd9512ed96abe51e8fd94e7cdab276 (diff)
downloadnixlib-799f0f1f239b00177b72322e261ab350647dbd60.tar
nixlib-799f0f1f239b00177b72322e261ab350647dbd60.tar.gz
nixlib-799f0f1f239b00177b72322e261ab350647dbd60.tar.bz2
nixlib-799f0f1f239b00177b72322e261ab350647dbd60.tar.lz
nixlib-799f0f1f239b00177b72322e261ab350647dbd60.tar.xz
nixlib-799f0f1f239b00177b72322e261ab350647dbd60.tar.zst
nixlib-799f0f1f239b00177b72322e261ab350647dbd60.zip
buildRustPackage: fix failure due to branch names with slashes
Fixes #11237
Diffstat (limited to 'pkgs/build-support/rust')
-rwxr-xr-xpkgs/build-support/rust/fetch-cargo-deps14
1 files changed, 9 insertions, 5 deletions
diff --git a/pkgs/build-support/rust/fetch-cargo-deps b/pkgs/build-support/rust/fetch-cargo-deps
index b119be273ba1..5074e26848ed 100755
--- a/pkgs/build-support/rust/fetch-cargo-deps
+++ b/pkgs/build-support/rust/fetch-cargo-deps
@@ -115,14 +115,18 @@ rm -rf $out/registry/index/*
 # Make git DBs deterministic
 # TODO: test with git submodules
 [[ ! -d $out/git/checkouts ]] || (cd $out/git/checkouts && for name in *; do
-    cd "$out/git/checkouts/$name"
     revs=""
-    for branch in *; do
-        cd "$branch"
+    cd "$out/git/checkouts/$name"
+    while read dir; do
+        # extract substring: [dir = "./xxx/yyy/.git"] => [branch = "xxx/yyy"]
+        branch="${dir:2:$((${#dir}-7))}"
+
+        cd "$out/git/checkouts/$name/$branch"
         rev="$(git rev-parse HEAD)"
         revs="$revs $rev"
-        cd ..
-    done
+    done < <(find . -type d -name .git -print)
+
+    echo "List of revs to keep for git db $name: $revs"
 
     (
         # The following code was adapted from nix-prefetch-git