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} ..."
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