Skip to content

Commit 5c654f2

Browse files
committed
use a simple script instead of cargo clone.
1 parent c2b612a commit 5c654f2

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/test/run-make/git_clone_sha1.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash -x
2+
3+
# Usage: $0 project_name url sha1
4+
# Get the crate with the specified sha1.
5+
#
6+
# all arguments are required.
7+
#
8+
# See below link for git usage:
9+
# https://stackoverflow.com/questions/3489173/how-to-clone-git-repository-with-specific-revision-changeset/14091182#14091182
10+
11+
# Mandatory arguments:
12+
PROJECT_NAME=$1
13+
URL=$2
14+
SHA1=$3
15+
16+
function err_exit() {
17+
echo "ERROR:" $*
18+
exit 1
19+
}
20+
21+
git clone $URL $PROJECT_NAME || err_exit
22+
cd $PROJECT_NAME || err_exit
23+
git reset --hard $SHA1 || err_exit

src/test/run-make/thumb-none-cortex-m/Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ ifneq (,$(filter $(TARGET),thumbv6m-none-eabi thumbv7em-none-eabi thumbv7em-none
1515

1616
# We need to be outside of 'src' dir in order to run cargo
1717
WORK_DIR := $(RUST_TEST_TMPDIR)/run-make/$(TARGET)
18+
HERE := $(shell pwd)
1819

1920
CRATE := cortex-m
20-
CRATE_VER := 0.5.0
21+
CRATE_URL := https://github.com/rust-embedded/cortex-m
22+
CRATE_SHA1 := a448e9156e2cb1e556e5441fd65426952ef4b927 # 0.5.0
2123

2224
RUSTC := $(RUSTC_ORIGINAL)
2325
LD_LIBRARY_PATH := $(HOST_RPATH_DIR)
@@ -26,7 +28,7 @@ all:
2628
env
2729
mkdir -p $(WORK_DIR)
2830
-cd $(WORK_DIR) && rm -rf $(CRATE)
29-
cd $(WORK_DIR) && $(CARGO) clone $(CRATE) --vers $(CRATE_VER)
31+
cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1)
3032
cd $(WORK_DIR) && cd $(CRATE) && $(CARGO) build --target $(TARGET) -v
3133
else
3234

0 commit comments

Comments
 (0)