Skip to content

Commit

Permalink
DEV: ca55: Avoid to run git clone again when clean build
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
yhamamachi committed Jan 16, 2024
1 parent f40d419 commit addcb2d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions application_cpu/build_xenhypervisor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
16 changes: 16 additions & 0 deletions application_cpu/setup_local_repository.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit addcb2d

Please sign in to comment.