Fix dependency list generation corner cases
* Handle empty install lists in apt_get() and pip_install()
* pip_install now uses get_packages() to get the dependency list
Fixes bug 948714
Change-Id: I174a60976df18c670eab2067edcd1871c51d07d6
diff --git a/functions b/functions
index adcf5bd..c4d56a2 100644
--- a/functions
+++ b/functions
@@ -4,7 +4,7 @@
# apt-get wrapper to set arguments correctly
# apt_get package [package ...]
function apt_get() {
- [[ "$OFFLINE" = "True" ]] && return
+ [[ "$OFFLINE" = "True" || -z "$@" ]] && return
local sudo="sudo"
[[ "$(id -u)" = "0" ]] && sudo="env"
$sudo DEBIAN_FRONTEND=noninteractive \
@@ -124,7 +124,7 @@
# pip install wrapper to set cache and proxy environment variables
# pip_install package [package ...]
function pip_install {
- [[ "$OFFLINE" = "True" ]] && return
+ [[ "$OFFLINE" = "True" || -z "$@" ]] && return
sudo PIP_DOWNLOAD_CACHE=/var/cache/pip \
HTTP_PROXY=$http_proxy \
HTTPS_PROXY=$https_proxy \
diff --git a/stack.sh b/stack.sh
index eead8a1..fa5652f 100755
--- a/stack.sh
+++ b/stack.sh
@@ -516,12 +516,16 @@
# dist:DISTRO1,DISTRO2 it will be installed only for those
# distros (case insensitive).
function get_packages() {
- local file_to_parse="general"
+ local package_dir=$1
+ local file_to_parse
local service
- for service in ${ENABLED_SERVICES//,/ }; do
- # Allow individual services to specify dependencies
- if [[ -e $FILES/apts/${service} ]]; then
+ if [[ -z "$package_dir" ]]; then
+ echo "No package directory supplied"
+ return 1
+ fi
+ for service in general ${ENABLED_SERVICES//,/ }; do # Allow individual services to specify dependencies
+ if [[ -e ${package_dir}/${service} ]]; then
file_to_parse="${file_to_parse} $service"
fi
if [[ $service == n-* ]]; then
@@ -540,9 +544,9 @@
done
for file in ${file_to_parse}; do
- local fname=${FILES}/apts/${file}
+ local fname=${package_dir}/${file}
local OIFS line package distros distro
- [[ -e $fname ]] || { echo "missing: $fname"; exit 1 ;}
+ [[ -e $fname ]] || continue
OIFS=$IFS
IFS=$'\n'
@@ -568,10 +572,10 @@
# install apt requirements
apt_get update
-apt_get install $(get_packages)
+apt_get install $(get_packages $FILES/apts)
# install python requirements
-pip_install `cat $FILES/pips/* | uniq`
+pip_install $(get_packages $FILES/pips | sort -u)
# compute service
git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH