Adding caching possiblity

The user has now 2 new variables to control a cache.
CACHE
	true -> use cache if exsist and create cash
	false -> do not use cache
RENEW
	-> Only makes sense when cache is true
	true -> renews the cache
	false -> use the old cache

Change-Id: I8da91f6ec2937e6b6e0c66eabdfd41fac6a490b5
This commit is contained in:
Nikolas Hermanns 2016-08-31 09:21:53 +02:00
parent 0ff4ebdbfe
commit c0b6165d5b
1 changed files with 19 additions and 0 deletions

View File

@ -4,7 +4,18 @@
# like packages building, packages downloading from mirrors and so on. # like packages building, packages downloading from mirrors and so on.
# The script should return 0 if there were no errors. # The script should return 0 if there were no errors.
set -eux set -eux
CACHE=${CACHE:-false}
RENEW=${RENEW:-false}
DIR="$(dirname `readlink -f $0`)"
if [ "$CACHE" == true ];then
export cache_dir=$DIR/.cache/;
if [ -e $cache_dir ] && [[ "$RENEW" == false ]];then
export OPNFV_QUAGGE_PACKAGING_REPO=$cache_dir/opnfv-quagga/;
export NETWORKING_ODL_REPO=$cache_dir/networking_odl/;
export ODL_TARBALL_LOCATION=$cache_dir/karaf-odl.tar.gz;
fi
fi
# Where we can find odl karaf distribution tarball # Where we can find odl karaf distribution tarball
# can be http(s) url or absolute path # can be http(s) url or absolute path
ODL_TARBALL_LOCATION=${ODL_TARBALL_LOCATION:-https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/integration/distribution-karaf/0.4.3-Beryllium-SR3/distribution-karaf-0.4.3-Beryllium-SR3.tar.gz} ODL_TARBALL_LOCATION=${ODL_TARBALL_LOCATION:-https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/integration/distribution-karaf/0.4.3-Beryllium-SR3/distribution-karaf-0.4.3-Beryllium-SR3.tar.gz}
@ -225,6 +236,14 @@ do
build_pkg $system build_pkg $system
done done
if [ "$CACHE" == true ];then
if [ ! -e $cache_dir ] || [[ "$RENEW" == true ]];then
rm -rf $cache_dir
mkdir -p $cache_dir
cp -r ${DIR}/tmp/* $cache_dir/
fi
fi
if [ "$CLEANUP" != false ];then if [ "$CLEANUP" != false ];then
cleanup cleanup
fi fi