summaryrefslogtreecommitdiffstats
path: root/fuel/ci/build.sh
diff options
context:
space:
mode:
authorJonas Bjurel <jonas.bjurel@ericsson.com>2015-09-19 18:53:42 +0200
committerJonas Bjurel <jonas.bjurel@ericsson.com>2015-09-21 08:48:17 +0000
commit3f42e219d2b2e531a9aa9722ee795cb3a686a017 (patch)
tree3fcc95ddffd7a16820deb905da3927cb3e629d18 /fuel/ci/build.sh
parent53cee12e3767a2a8e31dbefaa68a3fc2881abde2 (diff)
Modified cache naming. Now the cache name comprises an xor of the following:
- config.mk - cache.mk - Upstream fuel commit-id This should avoid any cache flapping, and insted produce a unique cache for any permutation of the above identities. Change-Id: Ieb28748ae9075725e54f6a5e87740281bf81116e Signed-off-by: Jonas Bjurel <jonas.bjurel@ericsson.com>
Diffstat (limited to 'fuel/ci/build.sh')
-rwxr-xr-xfuel/ci/build.sh36
1 files changed, 35 insertions, 1 deletions
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
@@ -80,6 +80,32 @@ EOF
############################################################################
############################################################################
+# 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
#
BUILD_BASE=$(readlink -e ../build/)
@@ -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
############################################################################