From 07aa86f09ad9a08aa80f8e1657f29b6040eb3d8d Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Sat, 10 Jun 2023 09:49:47 +0800 Subject: [PATCH 1/7] check CARGO_HOME env var --- scripts/tool_install.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/tool_install.sh b/scripts/tool_install.sh index 1351cd28a..a65ab83ce 100755 --- a/scripts/tool_install.sh +++ b/scripts/tool_install.sh @@ -29,26 +29,29 @@ case "${1:-}" in ;; esac +# check CARGO_HOME env var +CARGO_BIN_DIR="${CARGO_HOME:-~/.cargo/bin}" + if [ "${form:-}" ]; then echo "form = ${form}" - curl -sSfL https://github.com/djmcgill/form/releases/download/$form/form-x86_64-unknown-linux-gnu.gz | gzip -d - > ~/.cargo/bin/form - chmod +x ~/.cargo/bin/form + curl -sSfL https://github.com/djmcgill/form/releases/download/$form/form-x86_64-unknown-linux-gnu.gz | gzip -d - > "${CARGO_BIN_DIR}/form" + chmod +x "${CARGO_BIN_DIR}/form" fi if [ "${svdtools:-}" ]; then echo "svdtools = ${svdtools}" - curl -sSfL https://github.com/stm32-rs/svdtools/releases/download/$svdtools/svdtools-x86_64-unknown-linux-gnu.gz | gzip -d - > ~/.cargo/bin/svdtools - chmod +x ~/.cargo/bin/svdtools + curl -sSfL https://github.com/stm32-rs/svdtools/releases/download/$svdtools/svdtools-x86_64-unknown-linux-gnu.gz | gzip -d - > "${CARGO_BIN_DIR}/svdtools" + chmod +x "${CARGO_BIN_DIR}/svdtools" fi if [ "${svd2rust:-}" ]; then echo "svd2rust = ${svd2rust}" - curl -sSfL https://github.com/rust-embedded/svd2rust/releases/download/$svd2rust/svd2rust-x86_64-unknown-linux-gnu.gz | gzip -d - > ~/.cargo/bin/svd2rust - chmod +x ~/.cargo/bin/svd2rust + curl -sSfL https://github.com/rust-embedded/svd2rust/releases/download/$svd2rust/svd2rust-x86_64-unknown-linux-gnu.gz | gzip -d - > "${CARGO_BIN_DIR}/svd2rust" + chmod +x "${CARGO_BIN_DIR}/svd2rust" fi if [ "${svd2html:-}" ]; then echo "svd2html = ${svd2html}" - curl -sSfL https://github.com/burrbull/svd2html/releases/download/$svd2html/svd2html-x86_64-unknown-linux-gnu.gz | gzip -d - > ~/.cargo/bin/svd2html - chmod +x ~/.cargo/bin/svd2html + curl -sSfL https://github.com/burrbull/svd2html/releases/download/$svd2html/svd2html-x86_64-unknown-linux-gnu.gz | gzip -d - > "${CARGO_BIN_DIR}/svd2html" + chmod +x "${CARGO_BIN_DIR}/svd2html" fi From c776faa34c8bf813e60ccd8d617c09d56dd697bd Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Sat, 10 Jun 2023 09:56:56 +0800 Subject: [PATCH 2/7] Update CHANGELOG.md for `CARGO_HOME` check --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14a4b4329..5874ce4cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Replace `makehtml.py` with `svd2html` * Updated to svd2rust 0.28.0, svdtools 0.3.0, use tools binaries for CI * files in devices/common_patches moved to subdirectories +* check `CARGO_HOME` env var before put binary into default place (#850) ## [v0.15.1] 2022-07-04 From e2f9b6715a7906029cb1d1e43941dc145a4448f4 Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Sat, 10 Jun 2023 10:03:21 +0800 Subject: [PATCH 3/7] patch for CI compatibility --- scripts/tool_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tool_install.sh b/scripts/tool_install.sh index a65ab83ce..bdb5735cc 100755 --- a/scripts/tool_install.sh +++ b/scripts/tool_install.sh @@ -30,7 +30,7 @@ case "${1:-}" in esac # check CARGO_HOME env var -CARGO_BIN_DIR="${CARGO_HOME:-~/.cargo/bin}" +CARGO_BIN_DIR="${CARGO_HOME:-${HOME}/.cargo/bin}" if [ "${form:-}" ]; then echo "form = ${form}" From 0dedc9774091e189cbfcd4d48a4a71e4a2ce9541 Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Mon, 12 Jun 2023 11:59:46 +0800 Subject: [PATCH 4/7] DEBUG: try print CARGO_HOME after env setup --- Makefile.toml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index c1d1a9b70..868bda952 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -1,5 +1,4 @@ -env_scripts = [ -''' +env_scripts = [''' #!@duckscript crates = get_env CRATES crates = array %{crates} @@ -35,6 +34,7 @@ FORMATTED_SVDS = trim ${FORMATTED_SVDS} set_env FORMATTED_SVDS ${FORMATTED_SVDS} RUST_DIRS = trim ${RUST_DIRS} set_env RUST_DIRS ${RUST_DIRS} +exec echo CARGO_HOME is ${CARGO_HOME} '''] [tasks.default] @@ -318,4 +318,6 @@ script = "rm -r .deps" [env] PYTHON = { value = "python3", condition = { env_not_set = ["PYTHON"] } } SVDTOOLS = { value = "svdtools", condition = { env_not_set = ["SVDTOOLS"] } } -CRATES = { value = "stm32c0 stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32h5 stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32g0 stm32g4 stm32mp1 stm32wl stm32wb stm32u5", condition = { env_not_set = ["CRATES"] } } +CRATES = { value = "stm32c0 stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32h5 stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32g0 stm32g4 stm32mp1 stm32wl stm32wb stm32u5", condition = { env_not_set = [ + "CRATES", +] } } From 56a85bcf9f180403311c888449f020ffc733fbea Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Mon, 12 Jun 2023 12:03:40 +0800 Subject: [PATCH 5/7] DEBUG: print PATH after env setup --- Makefile.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.toml b/Makefile.toml index 868bda952..d45a39f85 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -35,6 +35,7 @@ set_env FORMATTED_SVDS ${FORMATTED_SVDS} RUST_DIRS = trim ${RUST_DIRS} set_env RUST_DIRS ${RUST_DIRS} exec echo CARGO_HOME is ${CARGO_HOME} +exec echo PATH is ${PATH} '''] [tasks.default] From 537368f422d76982b3f07d23065f15fb0c6a2f88 Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Tue, 1 Aug 2023 14:12:25 +0800 Subject: [PATCH 6/7] path bug fix --- scripts/tool_install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tool_install.sh b/scripts/tool_install.sh index bdb5735cc..5b04325a2 100755 --- a/scripts/tool_install.sh +++ b/scripts/tool_install.sh @@ -30,7 +30,7 @@ case "${1:-}" in esac # check CARGO_HOME env var -CARGO_BIN_DIR="${CARGO_HOME:-${HOME}/.cargo/bin}" +CARGO_BIN_DIR="${CARGO_HOME:-${HOME}/.cargo}/bin" if [ "${form:-}" ]; then echo "form = ${form}" From 984e59294950a0692678c8e5ca35eabeec20eac1 Mon Sep 17 00:00:00 2001 From: eZio Pan Date: Tue, 1 Aug 2023 14:16:45 +0800 Subject: [PATCH 7/7] remove unneeded echo --- Makefile.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile.toml b/Makefile.toml index d45a39f85..916445c6f 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -34,8 +34,6 @@ FORMATTED_SVDS = trim ${FORMATTED_SVDS} set_env FORMATTED_SVDS ${FORMATTED_SVDS} RUST_DIRS = trim ${RUST_DIRS} set_env RUST_DIRS ${RUST_DIRS} -exec echo CARGO_HOME is ${CARGO_HOME} -exec echo PATH is ${PATH} '''] [tasks.default]