Use GIT_UPDATE_LOG.

pull_customer_repository():
    Check the file GIT_UPDATE_LOG for keywords DOWNLOAD or EXECUTE.
This commit is contained in:
Gerhard Hoffmann 2023-05-24 13:04:39 +02:00
parent 4f9c6155e1
commit f2617d8151

View File

@ -90,12 +90,10 @@ clone_customer_repository () {
log_debug "$func:${LINENO} cloning ${1} ..." log_debug "$func:${LINENO} cloning ${1} ..."
if cd "./$WORKSPACE_DIR" if cd "./$WORKSPACE_DIR"
then then
$(exec_git_command git clone "$1") exec_git_command git clone "$1"
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
log_debug "$func:${LINENO} cloning ${1} done" log_debug "$func:${LINENO} cloning ${1} done"
GIT_CLONE_EXECUTED=1 GIT_CLONE_EXECUTED=1
rm -f $GIT_PULL_TMP
rm -f $OPKG_CMDS_TMP
# after cloning, cd into repository, and re-initialize, # after cloning, cd into repository, and re-initialize,
# setting the work-tree as "/". This has the effect that # setting the work-tree as "/". This has the effect that
# a "git pull" will automatically fetched files in the # a "git pull" will automatically fetched files in the
@ -182,26 +180,20 @@ pull_customer_repository () {
return 1 return 1
fi fi
#local commit_before_pull=$(latest_commit) log_crit "$func:${LINENO}: executing 'git pull'..."
#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'..."
exec_git_command 'git pull' exec_git_command 'git pull'
# GIT_PULL_TMP created by hook post-merge. it contains the names of the # GIT_UPDATE_LOG updated by hook post-merge. it contains the names of the
# changed files. # changed files or opkg-commands to execute.
if [[ -f $GIT_PULL_TMP ]]; then # 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 cd_home; return 0
fi fi
log_warn "$func:${LINENO}: no data fetched form repository" log_warn "$func:${LINENO}: no data fetched from repository"
cd_home; return 1 cd_home; return 1
} }
# pull_customer_repository customer_281 # pull_customer_repository customer_281