Browse code

Merge "Fix dependency list generation corner cases"

Jenkins authored on 2012/03/10 09:45:30
Showing 2 changed files
... ...
@@ -4,7 +4,7 @@
4 4
 # apt-get wrapper to set arguments correctly
5 5
 # apt_get package [package ...]
6 6
 function apt_get() {
7
-    [[ "$OFFLINE" = "True" ]] && return
7
+    [[ "$OFFLINE" = "True" || -z "$@" ]] && return
8 8
     local sudo="sudo"
9 9
     [[ "$(id -u)" = "0" ]] && sudo="env"
10 10
     $sudo DEBIAN_FRONTEND=noninteractive \
... ...
@@ -124,7 +124,7 @@ function is_set() {
124 124
 # pip install wrapper to set cache and proxy environment variables
125 125
 # pip_install package [package ...]
126 126
 function pip_install {
127
-    [[ "$OFFLINE" = "True" ]] && return
127
+    [[ "$OFFLINE" = "True" || -z "$@" ]] && return
128 128
     sudo PIP_DOWNLOAD_CACHE=/var/cache/pip \
129 129
         HTTP_PROXY=$http_proxy \
130 130
         HTTPS_PROXY=$https_proxy \
... ...
@@ -538,12 +538,16 @@ fi
538 538
 #    dist:DISTRO1,DISTRO2 it will be installed only for those
539 539
 #    distros (case insensitive).
540 540
 function get_packages() {
541
-    local file_to_parse="general"
541
+    local package_dir=$1
542
+    local file_to_parse
542 543
     local service
543 544
 
544
-    for service in ${ENABLED_SERVICES//,/ }; do
545
-        # Allow individual services to specify dependencies
546
-        if [[ -e $FILES/apts/${service} ]]; then
545
+    if [[ -z "$package_dir" ]]; then
546
+        echo "No package directory supplied"
547
+        return 1
548
+    fi
549
+    for service in general ${ENABLED_SERVICES//,/ }; do        # Allow individual services to specify dependencies
550
+        if [[ -e ${package_dir}/${service} ]]; then
547 551
             file_to_parse="${file_to_parse} $service"
548 552
         fi
549 553
         if [[ $service == n-* ]]; then
... ...
@@ -562,9 +566,9 @@ function get_packages() {
562 562
     done
563 563
 
564 564
     for file in ${file_to_parse}; do
565
-        local fname=${FILES}/apts/${file}
565
+        local fname=${package_dir}/${file}
566 566
         local OIFS line package distros distro
567
-        [[ -e $fname ]] || { echo "missing: $fname"; exit 1 ;}
567
+        [[ -e $fname ]] || continue
568 568
 
569 569
         OIFS=$IFS
570 570
         IFS=$'\n'
... ...
@@ -590,10 +594,10 @@ function get_packages() {
590 590
 
591 591
 # install apt requirements
592 592
 apt_get update
593
-apt_get install $(get_packages)
593
+apt_get install $(get_packages $FILES/apts)
594 594
 
595 595
 # install python requirements
596
-pip_install `cat $FILES/pips/* | uniq`
596
+pip_install $(get_packages $FILES/pips | sort -u)
597 597
 
598 598
 # compute service
599 599
 git_clone $NOVA_REPO $NOVA_DIR $NOVA_BRANCH