From 5c654f27b74e69bc78b4b33a7caf21bbcd9a23be Mon Sep 17 00:00:00 2001 From: Hideki Sekine Date: Tue, 14 Aug 2018 22:35:11 +0900 Subject: [PATCH] use a simple script instead of `cargo clone`. --- src/test/run-make/git_clone_sha1.sh | 23 +++++++++++++++++++ .../run-make/thumb-none-cortex-m/Makefile | 6 +++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 src/test/run-make/git_clone_sha1.sh diff --git a/src/test/run-make/git_clone_sha1.sh b/src/test/run-make/git_clone_sha1.sh new file mode 100644 index 00000000000..46ffd7eb145 --- /dev/null +++ b/src/test/run-make/git_clone_sha1.sh @@ -0,0 +1,23 @@ +#!/bin/bash -x + +# Usage: $0 project_name url sha1 +# Get the crate with the specified sha1. +# +# all arguments are required. +# +# See below link for git usage: +# https://stackoverflow.com/questions/3489173/how-to-clone-git-repository-with-specific-revision-changeset/14091182#14091182 + +# Mandatory arguments: +PROJECT_NAME=$1 +URL=$2 +SHA1=$3 + +function err_exit() { + echo "ERROR:" $* + exit 1 +} + +git clone $URL $PROJECT_NAME || err_exit +cd $PROJECT_NAME || err_exit +git reset --hard $SHA1 || err_exit diff --git a/src/test/run-make/thumb-none-cortex-m/Makefile b/src/test/run-make/thumb-none-cortex-m/Makefile index 55b896bf573..4e9a09e4e77 100644 --- a/src/test/run-make/thumb-none-cortex-m/Makefile +++ b/src/test/run-make/thumb-none-cortex-m/Makefile @@ -15,9 +15,11 @@ ifneq (,$(filter $(TARGET),thumbv6m-none-eabi thumbv7em-none-eabi thumbv7em-none # We need to be outside of 'src' dir in order to run cargo WORK_DIR := $(RUST_TEST_TMPDIR)/run-make/$(TARGET) +HERE := $(shell pwd) CRATE := cortex-m -CRATE_VER := 0.5.0 +CRATE_URL := https://github.com/rust-embedded/cortex-m +CRATE_SHA1 := a448e9156e2cb1e556e5441fd65426952ef4b927 # 0.5.0 RUSTC := $(RUSTC_ORIGINAL) LD_LIBRARY_PATH := $(HOST_RPATH_DIR) @@ -26,7 +28,7 @@ all: env mkdir -p $(WORK_DIR) -cd $(WORK_DIR) && rm -rf $(CRATE) - cd $(WORK_DIR) && $(CARGO) clone $(CRATE) --vers $(CRATE_VER) + cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1) cd $(WORK_DIR) && cd $(CRATE) && $(CARGO) build --target $(TARGET) -v else