2 ##############################################################################
3 # Copyright (c) 2016 Dan Radez (Red Hat) and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
16 $0 Builds the Apex OPNFV Deployment Toolchain
18 usage: $0 [ -c cache_dir ] -r release_name [ --iso | --rpms ]
21 -c cache destination - directory of cached files, defaults to ./cache
22 -r release name/version of the build result
23 --iso build the iso (implies RPMs too)
26 -h help, prints this help text
29 build -c file:///tmp/cache -r dev123
33 BUILD_BASE=$(readlink -e ../build/)
36 CACHE_NAME="apex-cache"
40 while [ "${1:0:1}" = "-" ]
57 echo "Building opnfv-apex RPMs and ISO"
62 echo "Buiding opnfv-apex RPMs"
67 echo "Enable debug output"
81 if [ -n "$RELEASE" ]; then MAKE_ARGS+="RELEASE=$RELEASE "; fi
84 if [ -n "$CACHE_DEST" ]; then
85 echo "Retrieving Cache"
86 if [ -f $CACHE_DEST/${CACHE_NAME}.tgz ]; then
87 rm -rf $BUILD_BASE/$CACHE_DIR
88 cp -f $CACHE_DEST/${CACHE_NAME}.tgz $BUILD_BASE/${CACHE_NAME}.tgz
89 tar xzf $BUILD_BASE/${CACHE_NAME}.tgz
90 elif [ ! -d $BUILD_BASE/$CACHE_DIR ]; then
91 mkdir $BUILD_BASE/$CACHE_DIR
95 #create build_output for legecy functionality compatibiltiy in jenkins
96 if [[ ! -d ../build_output ]]; then
98 ln -s build/noarch/ ../build_output
102 make $MAKE_ARGS -C ${BUILD_BASE} $MAKE_TARGET
103 echo "Build Complete"
106 if [ -n "$CACHE_DEST" ]; then
107 echo "Building Cache"
108 tar --atime-preserve --dereference -C $BUILD_BASE -caf $BUILD_BASE/${CACHE_NAME}.tgz $CACHE_DIR
110 if [ ! -d $CACHE_DEST ]; then mkdir -p $CACHE_DEST; fi
111 cp $BUILD_BASE/${CACHE_NAME}.tgz $CACHE_DEST/${CACHE_NAME}.tgz