tools: chromeos: Use relative path to Cargo.toml in setup_cargo

This change will allow the script to be executed from any path.

BUG=none
TEST=run tools/chromeos/setup_cargo from outside of crosvm directory

Change-Id: I9752f4a41987259f446431bf89c322095ef26e63
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3280361
Reviewed-by: Dennis Kempin <denniskempin@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Dennis Kempin <denniskempin@google.com>
Auto-Submit: Keiichi Watanabe <keiichiw@chromium.org>
This commit is contained in:
Keiichi Watanabe 2021-11-14 20:21:53 +09:00 committed by Commit Bot
parent c3dedf3cc1
commit eef484c20a

View file

@ -6,6 +6,8 @@
# To build crosvm using cargo against libraries and crates provided by ChromeOS
# use this script to update path references in Cargo.toml.
CARGO_PATH=$(dirname "$0")/../../Cargo.toml
declare -A replacements=(
["libcras_stub"]="../../third_party/adhd/cras/client/libcras"
["system_api_stub"]="../../platform2/system_api"
@ -15,7 +17,7 @@ declare -A replacements=(
for crate in "${!replacements[@]}"; do
echo "Replacing '${crate}' with '${replacements[$crate]}'"
sed -i "s|path = \"${crate}|path = \"${replacements[$crate]}|g" \
Cargo.toml
"${CARGO_PATH}"
done
echo "Modified Cargo.toml with new paths. Please do not commit those."