From b22744b87f3aa3f56d5cfbd12fda403b303fa7b8 Mon Sep 17 00:00:00 2001 From: Ivan Mahonin Date: Apr 07 2017 19:43:14 +0000 Subject: Fix update-function --- diff --git a/docker-builder-data/build/script/common/helpers.sh b/docker-builder-data/build/script/common/helpers.sh index 5dc6a97..0a769c9 100644 --- a/docker-builder-data/build/script/common/helpers.sh +++ b/docker-builder-data/build/script/common/helpers.sh @@ -130,9 +130,11 @@ foreachfile() { sha512dir() { local DIR="$1" local INFO="$2" + + local BASE=$(basename "$DIR") - [[ "$DIR" = ".git" ]] || return 0 - [[ "$DIR" = *.po ]] || return 0 + [[ "$BASE" != ".git" ]] || return 0 + [[ "$BASE" != *.po ]] || return 0 if [ "$INFO" = "info" ]; then basename "$DIR" || return 1 @@ -141,6 +143,8 @@ sha512dir() { if [ -d "$DIR" ]; then (foreachfile "$DIR" "${FUNCNAME[0]}" info | sha512sum -b | cut -c1-128) || return 1 + elif [ -L "$DIR" ]; then + (readlink "$DIR" | sha512sum -b | cut -c1-128) || return 1 else (sha512sum -b "$DIR" | cut -c1-128) || return 1 fi diff --git a/docker-builder-data/build/script/common/manager.sh b/docker-builder-data/build/script/common/manager.sh index f5c8029..77afea8 100755 --- a/docker-builder-data/build/script/common/manager.sh +++ b/docker-builder-data/build/script/common/manager.sh @@ -333,17 +333,18 @@ call_packet_function() { message "$NAME $FUNC" try_do_nothing $NAME $FUNC && return 0 - echo "${DRY_RUN_DONE[@]}" - - local PREV_HASH= - if [ "$COMPARE_RESULTS" = "compare_results" ]; then - if check_packet_function $NAME $FUNC; then - PREV_HASH=`sha512dir "$FUNC_CURRENT_PACKET_DIR"` - [ ! $? -eq 0 ] && return 1 - fi + echo "${DRY_RUN_DONE[@]}" + + local PREV_HASH= + if [ "$COMPARE_RESULTS" = "compare_results" ]; then + if check_packet_function $NAME $FUNC; then + PREV_HASH=`sha512dir "$FUNC_CURRENT_PACKET_DIR"` + [ ! $? -eq 0 ] && return 1 + echo "sha512: $PREV_HASH" + fi else - set_undone_silent $NAME $FUNC - fi + set_undone_silent $NAME $FUNC + fi mkdir -p $FUNC_CURRENT_PACKET_DIR cd $FUNC_CURRENT_PACKET_DIR @@ -369,14 +370,17 @@ call_packet_function() { fi fi - if [ ! -z "$PREV_HASH" ]; then - local HASH=`sha512dir "$FUNC_CURRENT_PACKET_DIR"` - [ ! $? -eq 0 ] && return 1 - if [ "$HASH" = "$PREV_HASH" ]; then - message "$NAME $FUNC - not changed" - return 0 - fi - fi + if [ ! -z "$PREV_HASH" ]; then + local HASH=`sha512dir "$FUNC_CURRENT_PACKET_DIR"` + [ ! $? -eq 0 ] && return 1 + echo "sha512: $HASH" + if [ "$HASH" = "$PREV_HASH" ]; then + message "$NAME $FUNC - not changed" + return 0 + else + message "$NAME $FUNC - changed" + fi + fi set_done $NAME $FUNC } diff --git a/publish/publish.sh b/publish/publish.sh index 48709b2..2846637 100755 --- a/publish/publish.sh +++ b/publish/publish.sh @@ -27,7 +27,7 @@ publish() { | sed "s|%VERSION%|$VERSION|g" \ | sed "s|%DATE%|*|g" \ | sed "s|%COMMIT%|$COMMIT|g" ` - local CHECK=`ls "$PUBLISH_DIR/"$CHECK_MASK` + local CHECK=`ls "$PUBLISH_DIR/"$CHECK_MASK 2>/dev/null` if [ -z "$CHECK" ]; then local TARGET_NAME=` \ echo "$TEMPLATE" \