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.

Change-Id: I8fd0ef2bfc544ca2576fab09d3018f760b8848fe

Sean Dague authored on 2015/04/08 22:06:49
Showing 15 changed files
... ...
@@ -52,6 +52,18 @@ function get_python_exec_prefix {
52 52
     fi
53 53
 }
54 54
 
55
+# Wrapper for ``pip install`` that only installs versions of libraries
56
+# from the global-requirements specification.
57
+#
58
+# Uses globals ``REQUIREMENTS_DIR``
59
+#
60
+# pip_install_gr packagename
61
+function pip_install_gr {
62
+    local name=$1
63
+    local clean_name=$(get_from_global_requirements $name)
64
+    pip_install $clean_name
65
+}
66
+
55 67
 # Wrapper for ``pip install`` to set cache and proxy environment variables
56 68
 # Uses globals ``OFFLINE``, ``PIP_VIRTUAL_ENV``,
57 69
 # ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``
... ...
@@ -125,7 +137,7 @@ function pip_install {
125 125
 # get_from_global_requirements <package>
126 126
 function get_from_global_requirements {
127 127
     local package=$1
128
-    local required_pkg=$(grep -h ${package} $REQUIREMENTS_DIR/global-requirements.txt | cut -d\# -f1)
128
+    local required_pkg=$(grep -h ^${package} $REQUIREMENTS_DIR/global-requirements.txt | cut -d\# -f1)
129 129
     if [[ $required_pkg == ""  ]]; then
130 130
         die $LINENO "Can't find package $package in requirements"
131 131
     fi
... ...
@@ -315,6 +315,9 @@ function install_ceilometermiddleware {
315 315
         git_clone_by_name "ceilometermiddleware"
316 316
         setup_dev_lib "ceilometermiddleware"
317 317
     else
318
+        # BUG: this should be a pip_install_gr except it was never
319
+        # included in global-requirements. Needs to be fixed by
320
+        # https://bugs.launchpad.net/ceilometer/+bug/1441655
318 321
         pip_install ceilometermiddleware
319 322
     fi
320 323
 }
... ...
@@ -155,7 +155,7 @@ EOF
155 155
 
156 156
 function install_database_python_mysql {
157 157
     # Install Python client module
158
-    pip_install MySQL-python
158
+    pip_install_gr MySQL-python
159 159
     ADDITIONAL_VENV_PACKAGES+=",MySQL-python"
160 160
 }
161 161
 
... ...
@@ -104,7 +104,7 @@ EOF
104 104
 
105 105
 function install_database_python_postgresql {
106 106
     # Install Python client module
107
-    pip_install psycopg2
107
+    pip_install_gr psycopg2
108 108
     ADDITIONAL_VENV_PACKAGES+=",psycopg2"
109 109
 }
110 110
 
... ...
@@ -183,7 +183,7 @@ function stop_horizon {
183 183
 # NOTE: It can be moved to common functions, but it is only used by compilation
184 184
 # of django_openstack_auth catalogs at the moment.
185 185
 function _prepare_message_catalog_compilation {
186
-    pip_install $(get_from_global_requirements Babel)
186
+    pip_install_gr Babel
187 187
 }
188 188
 
189 189
 
... ...
@@ -206,7 +206,7 @@ function install_ironicclient {
206 206
         sudo install -D -m 0644 -o $STACK_USER {${GITDIR["python-ironicclient"]}/tools/,/etc/bash_completion.d/}ironic.bash_completion
207 207
     else
208 208
         # nothing actually "requires" ironicclient, so force instally from pypi
209
-        pip_install python-ironicclient
209
+        pip_install_gr python-ironicclient
210 210
     fi
211 211
 }
212 212
 
... ...
@@ -729,7 +729,7 @@ function upload_baremetal_ironic_deploy {
729 729
 
730 730
     # install diskimage-builder
731 731
     if [[ $(type -P ramdisk-image-create) == "" ]]; then
732
-        pip_install diskimage_builder
732
+        pip_install_gr "diskimage-builder"
733 733
     fi
734 734
 
735 735
     if [ -z "$IRONIC_DEPLOY_KERNEL" -o -z "$IRONIC_DEPLOY_RAMDISK" ]; then
... ...
@@ -524,7 +524,7 @@ function install_keystonemiddleware {
524 524
         setup_dev_lib "keystonemiddleware"
525 525
     else
526 526
         # When not installing from repo, keystonemiddleware is still needed...
527
-        pip_install keystonemiddleware
527
+        pip_install_gr keystonemiddleware
528 528
     fi
529 529
 }
530 530
 
... ...
@@ -142,7 +142,7 @@ function install_ldap {
142 142
         sudo ldapadd -Y EXTERNAL -H ldapi:/// -f /etc/openldap/schema/inetorgperson.ldif
143 143
     fi
144 144
 
145
-    pip_install ldappool
145
+    pip_install_gr ldappool
146 146
 
147 147
     rm -rf $tmp_ldap_dir
148 148
 }
... ...
@@ -31,12 +31,12 @@ function install_libvirt {
31 31
             install_package python-guestfs
32 32
         fi
33 33
         install_package libvirt-bin libvirt-dev
34
-        pip_install libvirt-python
35
-        #pip_install <there-si-no-guestfs-in-pypi>
34
+        pip_install_gr libvirt-python
35
+        #pip_install_gr <there-si-no-guestfs-in-pypi>
36 36
     elif is_fedora || is_suse; then
37 37
         install_package kvm
38 38
         install_package libvirt libvirt-devel
39
-        pip_install libvirt-python
39
+        pip_install_gr libvirt-python
40 40
         install_package python-libguestfs
41 41
     fi
42 42
 
... ...
@@ -94,7 +94,7 @@ CRONTAB
94 94
 
95 95
 # install_nova_hypervisor() - Install external components
96 96
 function install_nova_hypervisor {
97
-    pip_install xenapi
97
+    pip_install_gr xenapi
98 98
 }
99 99
 
100 100
 # start_nova_hypervisor - Start any required external services
... ...
@@ -141,7 +141,7 @@ function install_rpc_backend {
141 141
         # TODO(kgiusti) can remove once python qpid bindings are
142 142
         # available on all supported platforms _and_ pyngus is added
143 143
         # to the requirements.txt file in oslo.messaging
144
-        pip_install pyngus
144
+        pip_install_gr pyngus
145 145
     fi
146 146
 
147 147
     if is_service_enabled rabbit; then
... ...
@@ -103,7 +103,7 @@ function configure_tempest {
103 103
         setup_develop $TEMPEST_DIR
104 104
     else
105 105
         # install testr since its used to process tempest logs
106
-        pip_install $(get_from_global_requirements testrepository)
106
+        pip_install_gr testrepository
107 107
     fi
108 108
 
109 109
     local image_lines
... ...
@@ -140,10 +140,10 @@ function configure_zaqar {
140 140
 function configure_redis {
141 141
     if is_ubuntu; then
142 142
         install_package redis-server
143
-        pip_install redis
143
+        pip_install_gr redis
144 144
     elif is_fedora; then
145 145
         install_package redis
146
-        pip_install redis
146
+        pip_install_gr redis
147 147
     else
148 148
         exit_distro_not_supported "redis installation"
149 149
     fi
... ...
@@ -77,7 +77,7 @@ function stop_elasticsearch {
77 77
 }
78 78
 
79 79
 function install_elasticsearch {
80
-    pip_install elasticsearch
80
+    pip_install_gr elasticsearch
81 81
     if is_package_installed elasticsearch; then
82 82
         echo "Note: elasticsearch was already installed."
83 83
         return
... ...
@@ -847,7 +847,7 @@ if use_library_from_git "python-openstackclient"; then
847 847
     git_clone_by_name "python-openstackclient"
848 848
     setup_dev_lib "python-openstackclient"
849 849
 else
850
-    pip_install 'python-openstackclient>=1.0.2'
850
+    pip_install_gr python-openstackclient
851 851
 fi
852 852
 
853 853
 if [[ $TRACK_DEPENDS = True ]]; then