X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=fuel%2Fci%2Fbuild.sh;h=f8e164a76ed6c3affb915ad87cf4d042cf2ca0c4;hb=3f42e219d2b2e531a9aa9722ee795cb3a686a017;hp=0f544b4345e1eaba0cf34857e24167b3142a7661;hpb=53cee12e3767a2a8e31dbefaa68a3fc2881abde2;p=genesis.git diff --git a/fuel/ci/build.sh b/fuel/ci/build.sh index 0f544b4..f8e164a 100755 --- a/fuel/ci/build.sh +++ b/fuel/ci/build.sh @@ -79,6 +79,32 @@ EOF # END of usage description ############################################################################ +############################################################################ +# Begin of string xor function +# +function xor() +{ + local res=(`echo "$1" | sed "s/../0x& /g"`) + shift 1 + while [[ "$1" ]]; do + local one=(`echo "$1" | sed "s/../0x& /g"`) + local count1=${#res[@]} + if [ $count1 -lt ${#one[@]} ] + then + count1=${#one[@]} + fi + for (( i = 0; i < $count1; i++ )) + do + res[$i]=$((${one[$i]:-0} ^ ${res[$i]:-0})) + done + shift 1 + done + printf "%02x" "${res[@]}" +} +# +# END of string xor function +############################################################################ + ############################################################################ # BEGIN of variables to customize # @@ -87,7 +113,7 @@ RESULT_DIR="${BUILD_BASE}/release" BUILD_SPEC="${BUILD_BASE}/config.mk" CACHE_DIR="cache" LOCAL_CACHE_ARCH_NAME="fuel-cache" -REMOTE_CACHE_ARCH_NAME="fuel_cache-$(md5sum ${BUILD_SPEC}| cut -f1 -d " ")" + REMOTE_ACCESS_METHD=curl INCLUDE_DIR=../include # @@ -117,6 +143,14 @@ BUILD_DIR= BUILD_LOG= BUILD_VERSION= MAKE_ARGS= +FUEL_GIT_SRC="$(make -f ../build/config.mk get-fuel-repo | cut -d " " -f1)" +FUEL_GIT_BRANCH="$(make -f ../build/config.mk get-fuel-repo | cut -d " " -f2)" +CACHE_MD5=$(md5sum ../build/cache.mk | cut -f1 -d " ") +CONFIG_MD5=$(md5sum ../build/config.mk | cut -f1 -d " ") +FUEL_COMMIT_ID=$(git ls-remote $FUEL_GIT_SRC -t $FUEL_GIT_BRANCH | cut -d $'\t' -f1) +REMOTE_CACHE_ARCH_HASH_TMP="$(xor $CACHE_MD5 $CONFIG_MD5)" +REMOTE_CACHE_ARCH_HASH="$(xor $REMOTE_CACHE_ARCH_HASH_TMP $FUEL_COMMIT_ID)" +REMOTE_CACHE_ARCH_NAME="fuel_cache-$REMOTE_CACHE_ARCH_HASH" # # END of script assigned variables ############################################################################