From addcb2da869daec7782ef79387d921f32dbfccd0 Mon Sep 17 00:00:00 2001 From: Yuya Hamamachi Date: Tue, 16 Jan 2024 17:35:40 +0900 Subject: [PATCH] DEV: ca55: Avoid to run git clone again when clean build Git clone takes a lot of time and network resource. This patch makes local reposoitory into common_data direcotry to avoid git clone everytime to clean build. Signed-off-by: Yuya Hamamachi --- application_cpu/build_xenhypervisor.sh | 8 ++++++++ application_cpu/setup_local_repository.sh | 16 ++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 application_cpu/setup_local_repository.sh diff --git a/application_cpu/build_xenhypervisor.sh b/application_cpu/build_xenhypervisor.sh index e0cc373..37dd6be 100755 --- a/application_cpu/build_xenhypervisor.sh +++ b/application_cpu/build_xenhypervisor.sh @@ -93,6 +93,14 @@ if [[ ! -e "${SCRIPT_DIR}/work" || "$CLEAN_BUILD_FLAG" == "true" ]]; then ############################################# fi +# To avoid increasing network usage, using local repository +cd ${SCRIPT_DIR}/work +if [[ -d $SCRIPT_DIR/common_data/repo ]]; then + bash ../setup_local_repository.sh + # Replace Yocto path + sed -i -e 's|url: ".*://.*/|url: "../common_data/repo/|' -e 's/\.git//' ./*.yaml +fi + cd ${SCRIPT_DIR}/work moulin ./aos-rcar-gen4-wb.yaml \ --TARGET_BOARD $1 \ diff --git a/application_cpu/setup_local_repository.sh b/application_cpu/setup_local_repository.sh new file mode 100644 index 0000000..57b92fc --- /dev/null +++ b/application_cpu/setup_local_repository.sh @@ -0,0 +1,16 @@ +#!/bin/bash -eu + +SCRIPT_DIR=$(cd `dirname $0` && pwd) +repolist=$(grep -h url: ./*.yaml | grep -v "^#" | awk '{print $2}' | sed 's/"//g' ) +REPO_DIR=${SCRIPT_DIR}/common_data/repo + +mkdir -p $REPO_DIR +for repo in ${repolist[@]}; do + DIR_NAME=$(echo $repo | rev | cut -d'/' -f1 | rev | sed 's/.git//') + # echo $repo: dir_name is $DIR_NAME + if [ ! -d ${REPO_DIR}/${DIR_NAME} ]; then + git clone $repo ${REPO_DIR}/${DIR_NAME} + fi + cd ${REPO_DIR}/${DIR_NAME} && git pull +done +