summaryrefslogtreecommitdiffstats
path: root/build/cache.sh
diff options
context:
space:
mode:
authorTim Rozet <trozet@redhat.com>2016-12-06 12:58:55 -0500
committerTim Rozet <trozet@redhat.com>2016-12-08 21:52:32 -0500
commit58a098e08ec131338b0c29b902472c54b2a26168 (patch)
tree8fb5727e1511d1114cd5b60f0659d624105b4542 /build/cache.sh
parent9131b0a81c22e713b4d4798d7ff32254be3b99e3 (diff)
Fixes and cleans up build/cache directory usage
Changes include: - Building is isolated to a .build directory that is git ignored - Caching is isolated to a .cache directory that is git ignored - Build scripts have been variablized, and relative paths have been removed - Unused files removed - build.sh, make file cleaned up - Fixed broken building of markupsafe and jinja2 packages - make clean-cache will remove the cache now - per item cleans are removed in place of simple clean .build now - includes fix for OSC issue with LP# 1642301 Change-Id: I42b8e4eb694bf0a2c398858814f8b73785931896 Signed-off-by: Tim Rozet <trozet@redhat.com>
Diffstat (limited to 'build/cache.sh')
-rw-r--r--build/cache.sh29
1 files changed, 5 insertions, 24 deletions
diff --git a/build/cache.sh b/build/cache.sh
index 0c2da399..4c530b02 100644
--- a/build/cache.sh
+++ b/build/cache.sh
@@ -7,9 +7,7 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-
-CACHE_DIR="$(pwd)/.cache"
-CACHE_HISTORY=".cache_history"
+source ./variables.sh
# Make sure the cache dir exists
function cache_dir {
@@ -19,10 +17,6 @@ function cache_dir {
echo "Cache Dir: $CACHE_DIR"
}
-function cache_git_tar {
- echo "cache_git_tar git ls-remote"
-}
-
# $1 = download url
# $2 = filename to write to
function curl_file {
@@ -52,22 +46,22 @@ function populate_cache {
# check if the cache file exists
# and if it has an md5 compare that
- echo "Checking cache file exists: ${filename}"
+ echo "Checking if cache file exists: ${filename}"
if [ ! -f $CACHE_DIR/${filename} ]; then
echo "Cache file: ${CACHE_DIR}/${filename} missing...will download..."
curl_file $1 $filename
else
echo "Cache file exists...comparing MD5 checksum"
- if [ -z $remote_md5 ]; then
+ if [ -z "$remote_md5" ]; then
remote_md5="$(curl -sf -L ${1}.md5 | awk {'print $1'})"
fi
if [ -z "$remote_md5" ]; then
echo "Got empty MD5 from remote for $filename, skipping MD5 check"
curl_file $1 $filename
else
- my_md5=$(grep ${filename} $CACHE_HISTORY | awk {'print $1'})
+ my_md5=$(grep ${filename} ${CACHE_DIR}/${CACHE_HISTORY} | awk {'print $1'})
if [ -z "$my_md5" ]; then
- echo "${filename} missing in $CACHE_HISTORY file. Caculating md5..."
+ echo "${filename} missing in ${CACHE_HISTORY} file. Caculating md5..."
my_md5=$(md5sum ${CACHE_DIR}/${filename} | awk {'print $1'})
fi
if [ "$remote_md5" != "$my_md5" ]; then
@@ -81,16 +75,3 @@ function populate_cache {
fi
fi
}
-
-# $1 = filename to get from cache
-# $2 = destintation
-function get_cached_file {
- if [ ! -f $CACHE_DIR/$1 ]; then
- echo "Cache file: ${CACHE_DIR}/$1 is not in cache."
- else
- echo "Cache file: Using cached file ${CACHE_DIR}/$1."
- dest='.'
- if [ -n $2 ]; then dest=$2; fi
- cp -f $CACHE_DIR/$1 $dest
- fi
-}