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
This commit is contained in:
Dean Troyer 2012-03-07 14:52:25 -06:00
parent 51aa401ff1
commit d0b21e2d19
2 changed files with 14 additions and 10 deletions

View File

@ -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 @@ function is_set() {
# 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 \

View File

@ -516,12 +516,16 @@ fi
# 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 @@ function get_packages() {
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 @@ function get_packages() {
# 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