Browse code

introduce pip_install_gr

This creates a new pip_install_gr that installs from global
requirements allowed versions. Now that stable branches are getting
capped all of devstack needs to be fixed to do things like this.

Conflicts:
inc/python
lib/ceilometer
lib/databases/mysql
lib/databases/postgresql
lib/horizon
lib/keystone
lib/ldap
lib/nova_plugins/functions-libvirt
lib/nova_plugins/hypervisor-xenserver
lib/tempest
lib/zaqar
pkg/elasticsearch.sh
stack.sh

Change-Id: I8fd0ef2bfc544ca2576fab09d3018f760b8848fe
(cherry picked from commit 19e06206cd66713d3f776baaefc050a965edc037)

Sean Dague authored on 2015/04/08 22:06:49
Showing 10 changed files
... ...
@@ -1519,6 +1519,18 @@ function get_python_exec_prefix {
1519 1519
     fi
1520 1520
 }
1521 1521
 
1522
+# Wrapper for ``pip install`` that only installs versions of libraries
1523
+# from the global-requirements specification.
1524
+#
1525
+# Uses globals ``REQUIREMENTS_DIR``
1526
+#
1527
+# pip_install_gr packagename
1528
+function pip_install_gr {
1529
+    local name=$1
1530
+    local clean_name=$(get_from_global_requirements $name)
1531
+    pip_install $clean_name
1532
+}
1533
+
1522 1534
 # Wrapper for ``pip install`` to set cache and proxy environment variables
1523 1535
 # Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``, ``PIP_USE_MIRRORS``,
1524 1536
 # ``TRACK_DEPENDS``, ``*_proxy``
... ...
@@ -1575,6 +1587,17 @@ function pip_install {
1575 1575
     fi
1576 1576
 }
1577 1577
 
1578
+# get version of a package from global requirements file
1579
+# get_from_global_requirements <package>
1580
+function get_from_global_requirements {
1581
+    local package=$1
1582
+    local required_pkg=$(grep -h ^${package} $REQUIREMENTS_DIR/global-requirements.txt | cut -d\# -f1)
1583
+    if [[ $required_pkg == ""  ]]; then
1584
+        die $LINENO "Can't find package $package in requirements"
1585
+    fi
1586
+    echo $required_pkg
1587
+}
1588
+
1578 1589
 # should we use this library from their git repo, or should we let it
1579 1590
 # get pulled in via pip dependencies.
1580 1591
 function use_library_from_git {
... ...
@@ -162,7 +162,7 @@ function is_baremetal {
162 162
 # so that we can build the deployment kernel & ramdisk
163 163
 function prepare_baremetal_toolchain {
164 164
     if [[ $(type -P ramdisk-image-create) == "" ]]; then
165
-        pip_install diskimage_builder
165
+        pip_install_gr diskimage-builder
166 166
     fi
167 167
     local shellinabox_basename=$(basename $BM_SHELL_IN_A_BOX)
168 168
     if [[ ! -e $DEST/$shellinabox_basename ]]; then
... ...
@@ -47,7 +47,7 @@ fi
47 47
 
48 48
 # install_dib() - Collect source and prepare
49 49
 function install_dib {
50
-    pip_install diskimage-builder
50
+    pip_install_gr diskimage-builder
51 51
 
52 52
     git_clone $TIE_REPO $TIE_DIR $TIE_BRANCH
53 53
     git_clone $OCC_REPO $OCC_DIR $OCC_BRANCH
... ...
@@ -178,8 +178,7 @@ function stop_horizon {
178 178
 # NOTE: It can be moved to common functions, but it is only used by compilation
179 179
 # of django_openstack_auth catalogs at the moment.
180 180
 function _prepare_message_catalog_compilation {
181
-    local babel_package=$(grep ^Babel $REQUIREMENTS_DIR/global-requirements.txt)
182
-    pip_install "$babel_package"
181
+    pip_install_gr Babel
183 182
 }
184 183
 
185 184
 # Restore xtrace
... ...
@@ -157,7 +157,7 @@ function install_ironicclient {
157 157
         sudo install -D -m 0644 -o $STACK_USER {${GITDIR["python-ironicclient"]}/tools/,/etc/bash_completion.d/}ironic.bash_completion
158 158
     else
159 159
         # nothing actually "requires" ironicclient, so force instally from pypi
160
-        pip_install python-ironicclient
160
+        pip_install_gr python-ironicclient
161 161
     fi
162 162
 }
163 163
 
... ...
@@ -622,7 +622,7 @@ function upload_baremetal_ironic_deploy {
622 622
 
623 623
     # install diskimage-builder
624 624
     if [[ $(type -P ramdisk-image-create) == "" ]]; then
625
-        pip_install diskimage_builder
625
+        pip_install_gr diskimage-builder
626 626
     fi
627 627
 
628 628
     if [ -z "$IRONIC_DEPLOY_KERNEL" -o -z "$IRONIC_DEPLOY_RAMDISK" ]; then
... ...
@@ -491,6 +491,9 @@ function install_keystonemiddleware {
491 491
     if use_library_from_git "keystonemiddleware"; then
492 492
         git_clone_by_name "keystonemiddleware"
493 493
         setup_dev_lib "keystonemiddleware"
494
+    else
495
+        # When not installing from repo, keystonemiddleware is still needed...
496
+        pip_install_gr keystonemiddleware
494 497
     fi
495 498
 }
496 499
 
... ...
@@ -138,7 +138,6 @@ function install_ldap {
138 138
         sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/cosine.ldif
139 139
         sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif
140 140
     fi
141
-
142 141
     rm -rf $tmp_ldap_dir
143 142
 }
144 143
 
... ...
@@ -125,7 +125,7 @@ function install_rpc_backend {
125 125
         # TODO(kgiusti) can remove once python qpid bindings are
126 126
         # available on all supported platforms _and_ pyngus is added
127 127
         # to the requirements.txt file in oslo.messaging
128
-        pip_install pyngus
128
+        pip_install_gr pyngus
129 129
     fi
130 130
 
131 131
     if is_service_enabled rabbit; then
... ...
@@ -78,7 +78,8 @@ IPV6_SUBNET_ATTRIBUTES_ENABLED=$(trueorfalse True $IPV6_SUBNET_ATTRIBUTES_ENABLE
78 78
 # configure_tempest() - Set config files, create data dirs, etc
79 79
 function configure_tempest {
80 80
     # install testr since its used to process tempest logs
81
-    pip_install `grep -h testrepository $REQUIREMENTS_DIR/global-requirements.txt | cut -d\# -f1`
81
+    pip_install_gr testrepository
82
+
82 83
     local image_lines
83 84
     local images
84 85
     local num_images
... ...
@@ -869,7 +869,7 @@ if use_library_from_git "python-openstackclient"; then
869 869
     git_clone_by_name "python-openstackclient"
870 870
     setup_dev_lib "python-openstackclient"
871 871
 else
872
-    pip_install 'python-openstackclient==1.0.1'
872
+    pip_install_gr python-openstackclient
873 873
 fi
874 874
 
875 875