diff options
Diffstat (limited to 'debian/_buildscripts/local/update_repositories.sh')
-rwxr-xr-x | debian/_buildscripts/local/update_repositories.sh | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/debian/_buildscripts/local/update_repositories.sh b/debian/_buildscripts/local/update_repositories.sh index 197a3e86c..b07220085 100755 --- a/debian/_buildscripts/local/update_repositories.sh +++ b/debian/_buildscripts/local/update_repositories.sh @@ -56,13 +56,11 @@ declare -A COLOR_STRINGS=( # $1 - module folder # $2 - operation type # $3 - branch to update -# $4 - new branch flag (only for reporting) function _do_update() { local MOD_PATH=$1 local OP_TYPE=$2 local BRANCH=$3 - local NEW_BRANCH=$4 local RESULT="" local LINE_CTRL_SUFFIX="" @@ -93,14 +91,12 @@ function _do_update() fi # Make sure the local branch exists if [[ -z `git branch | grep -E "\b$BRANCH\b"` ]]; then - NEW_BRANCH="y" eval git checkout -b \"$BRANCH\" \"origin/$BRANCH\" $OPT_VERBOSE_LOG else eval git checkout \"$BRANCH\" $OPT_VERBOSE_LOG fi # Make sure the local branch is a tracking branch if [[ -z `git config branch."$BRANCH".remote` ]]; then - NEW_BRANCH="y" git branch -u "origin/$BRANCH" &>/dev/null #$ git reset --hard "origin/$BRANCH" &>/dev/null fi @@ -115,11 +111,7 @@ function _do_update() RESULT="FAIL" fi else - if [[ "$NEW_BRANCH" = "y" ]]; then - RESULT="UPDATE" - else - RESULT="OK" - fi + RESULT="OK" fi else RESULT="FAIL" @@ -156,7 +148,6 @@ function _do_update() # $1 - module folder # $2 - operation type # $3 - branch to update -# $4 - new branch flag (only for reporting) function _update_module() { local MOD_PATH=$1 @@ -166,22 +157,18 @@ function _update_module() # Current module _do_update "$@" # Submodules - local NEW_BRANCH="n" local SUBMOD_LIST="$MOD_PATH/.gitmodules" if [[ -e "$SUBMOD_LIST" ]]; then sed -n "s|^\[submodule \"\([^\"]*\)\"\]$|\1|p" <$SUBMOD_LIST |\ while read -r SUBMOD_PATH; do - NEW_BRANCH="n" cd "$MOD_PATH" &>/dev/null if [[ -z "`git config --get submodule.$SUBMOD_PATH.url`" ]]; then - NEW_BRANCH="y" # if a submodule is missing, need to report "update" status eval git submodule init -- \"$SUBMOD_PATH\" $OPT_VERBOSE_LOG fi if [[ ! -e "$MOD_PATH/$SUBMOD_PATH/.git" ]]; then - NEW_BRANCH="y" # if a submodule is incomplete, need to report "update" status eval git submodule update -- \"$SUBMOD_PATH\" $OPT_VERBOSE_LOG fi - _update_module "$MOD_PATH/$SUBMOD_PATH" "$OP_TYPE" "$BRANCH" "$NEW_BRANCH" + _update_module "$MOD_PATH/$SUBMOD_PATH" "$OP_TYPE" "$BRANCH" done fi } @@ -238,10 +225,10 @@ if [[ "$flag_SWITCH_ONLY" != "y" ]]; then echo_and_tee "${CLightCyan}---------------------------------------${CNone}" "$LOG_UPDATE_REPO_FILENAME" # Update TDE main repository - _update_module "$REPO_TDE" "update" "$branch" "n" + _update_module "$REPO_TDE" "update" "$branch" # Update TDE packaging repository - _update_module "$TDE_DIR/$CFG_GIT_DIR/tde-packaging" "update" "$branch" "n" + _update_module "$TDE_DIR/$CFG_GIT_DIR/tde-packaging" "update" "$branch" echo -e "\033[2K" echo "" >> "$LOG_UPDATE_REPO_FILENAME" @@ -255,10 +242,10 @@ if [[ "$DEFAULT_REPO_BRANCH" != "$_LAST_BRANCH" ]]; then echo_and_tee "${CLightCyan}---------------------------------------${CNone}" "$LOG_UPDATE_REPO_FILENAME" # Switch TDE main repository - _update_module "$REPO_TDE" "switch-to" "$DEFAULT_REPO_BRANCH" "n" + _update_module "$REPO_TDE" "switch-to" "$DEFAULT_REPO_BRANCH" # Switch TDE packaging repository - _update_module "$TDE_DIR/$CFG_GIT_DIR/tde-packaging" "switch-to" "$DEFAULT_REPO_BRANCH" "n" + _update_module "$TDE_DIR/$CFG_GIT_DIR/tde-packaging" "switch-to" "$DEFAULT_REPO_BRANCH" echo -e "\033[2K" echo "" >> "$LOG_UPDATE_REPO_FILENAME" |