Browse code

Merge "Added options to improve offline usage."

Jenkins authored on 2012/11/08 12:35:57
Showing 2 changed files
... ...
@@ -7,6 +7,7 @@
7 7
 # ``GLANCE_HOSTPORT``
8 8
 # ``OFFLINE``
9 9
 # ``PIP_DOWNLOAD_CACHE``
10
+# ``PIP_USE_MIRRORS``
10 11
 # ``RECLONE``
11 12
 # ``TRACK_DEPENDS``
12 13
 # ``http_proxy``, ``https_proxy``, ``no_proxy``
... ...
@@ -578,7 +579,8 @@ function is_set() {
578 578
 
579 579
 
580 580
 # Wrapper for ``pip install`` to set cache and proxy environment variables
581
-# Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``, ``TRACK_DEPENDES``, ``*_proxy`
581
+# Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``, ``PIP_USE_MIRRORS``,
582
+#   ``TRACK_DEPENDS``, ``*_proxy`
582 583
 # pip_install package [package ...]
583 584
 function pip_install {
584 585
     [[ "$OFFLINE" = "True" || -z "$@" ]] && return
... ...
@@ -597,11 +599,14 @@ function pip_install {
597 597
             CMD_PIP=/usr/bin/pip-python
598 598
         fi
599 599
     fi
600
+    if [[ "$PIP_USE_MIRRORS" != "False" ]]; then
601
+        PIP_MIRROR_OPT="--use-mirrors"
602
+    fi
600 603
     $SUDO_PIP PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \
601 604
         HTTP_PROXY=$http_proxy \
602 605
         HTTPS_PROXY=$https_proxy \
603 606
         NO_PROXY=$no_proxy \
604
-        $CMD_PIP install --use-mirrors $@
607
+        $CMD_PIP install $PIP_MIRROR_OPT $@
605 608
 }
606 609
 
607 610
 
... ...
@@ -57,8 +57,8 @@ then
57 57
 fi
58 58
 
59 59
 # get nova
60
-nova_zipball=$(echo $NOVA_REPO | sed "s:\.git$::;s:$:/zipball/$NOVA_BRANCH:g")
61
-wget $nova_zipball -O nova-zipball --no-check-certificate
60
+NOVA_ZIPBALL_URL=${NOVA_ZIPBALL_URL:-$(echo $NOVA_REPO | sed "s:\.git$::;s:$:/zipball/$NOVA_BRANCH:g")}
61
+wget $NOVA_ZIPBALL_URL -O nova-zipball --no-check-certificate
62 62
 unzip -o nova-zipball  -d ./nova
63 63
 
64 64
 # install xapi plugins