From f2617d8151f55aac6a3c044c04c562f730b22e9a Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Wed, 24 May 2023 13:04:39 +0200 Subject: [PATCH] Use GIT_UPDATE_LOG. pull_customer_repository(): Check the file GIT_UPDATE_LOG for keywords DOWNLOAD or EXECUTE. --- git_helpers | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/git_helpers b/git_helpers index 2a67093..0ec5687 100755 --- a/git_helpers +++ b/git_helpers @@ -90,12 +90,10 @@ clone_customer_repository () { log_debug "$func:${LINENO} cloning ${1} ..." if cd "./$WORKSPACE_DIR" then - $(exec_git_command git clone "$1") + exec_git_command git clone "$1" if [ $? -eq 0 ]; then log_debug "$func:${LINENO} cloning ${1} done" GIT_CLONE_EXECUTED=1 - rm -f $GIT_PULL_TMP - rm -f $OPKG_CMDS_TMP # after cloning, cd into repository, and re-initialize, # setting the work-tree as "/". This has the effect that # a "git pull" will automatically fetched files in the @@ -182,26 +180,20 @@ pull_customer_repository () { return 1 fi - #local commit_before_pull=$(latest_commit) - #if [ -z $commit_before_pull ]; then - # log_warn "$func:${LINENO}: commit_before_pull empty" - # cd_home ; return 1 - #fi - #log_debug "$func:${LINENO}: commit_before_pull=$commit_before_pull" - - rm -f "$OPKG_CMDS_TMP" - rm -f "$GIT_PULL_TMP" - - log_debug "$func:${LINENO}: executing 'git pull'..." + log_crit "$func:${LINENO}: executing 'git pull'..." exec_git_command 'git pull' - # GIT_PULL_TMP created by hook post-merge. it contains the names of the - # changed files. - if [[ -f $GIT_PULL_TMP ]]; then + # GIT_UPDATE_LOG updated by hook post-merge. it contains the names of the + # changed files or opkg-commands to execute. + # If 'git pull' has fetched new data, then there are lines starting with + # DOWNLOAD or EXECUTE. + grep -E -q "^[[:space:]]*(DOWNLOAD|EXECUTE)" "$GIT_UPDATE_LOG" + if [ $? -eq 0]; then + log_info "$func:${LINENO}: new data fetched from repository" cd_home; return 0 fi - - log_warn "$func:${LINENO}: no data fetched form repository" + + log_warn "$func:${LINENO}: no data fetched from repository" cd_home; return 1 } # pull_customer_repository customer_281