Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust build support: Find Cargo.lock file upwards in tree #30412

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion pkgs/build-support/rust/fetch-cargo-deps
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ EOF
export CARGO_HOME=$out
cd $src

if [[ ! -f Cargo.lock ]]; then
find_upwards() {
[[ "$(realpath "$1")" == "/" ]] && return 1
if [ -f "$1/$2" ]; then
echo "$1/$2"
else
find_upwards "../$1" "$2"
fi
}

cargo_lock=$(find_upwards . "Cargo.lock")

if [[ -z "$cargo_lock" ]]; then
echo
echo "ERROR: The Cargo.lock file doesn't exist"
echo
Expand Down