Browse code

Merge "Add new function get_from_global_requirements"

Jenkins authored on 2015/02/18 08:47:54
Showing 3 changed files
... ...
@@ -95,6 +95,17 @@ function pip_install {
95 95
     fi
96 96
 }
97 97
 
98
+# get version of a package from global requirements file
99
+# get_from_global_requirements <package>
100
+function get_from_global_requirements {
101
+    local package=$1
102
+    local required_pkg=$(grep -h ${package} $REQUIREMENTS_DIR/global-requirements.txt | cut -d\# -f1)
103
+    if [[ $required_pkg == ""  ]]; then
104
+        die $LINENO "Can't find package $package in requirements"
105
+    fi
106
+    echo $required_pkg
107
+}
108
+
98 109
 # should we use this library from their git repo, or should we let it
99 110
 # get pulled in via pip dependencies.
100 111
 function use_library_from_git {
... ...
@@ -182,8 +182,7 @@ function stop_horizon {
182 182
 # NOTE: It can be moved to common functions, but it is only used by compilation
183 183
 # of django_openstack_auth catalogs at the moment.
184 184
 function _prepare_message_catalog_compilation {
185
-    local babel_package=$(grep ^Babel $REQUIREMENTS_DIR/global-requirements.txt)
186
-    pip_install "$babel_package"
185
+    pip_install $(get_from_global_requirements Babel)
187 186
 }
188 187
 
189 188
 
... ...
@@ -95,7 +95,8 @@ function remove_disabled_extensions {
95 95
 # configure_tempest() - Set config files, create data dirs, etc
96 96
 function configure_tempest {
97 97
     # install testr since its used to process tempest logs
98
-    pip_install `grep -h testrepository $REQUIREMENTS_DIR/global-requirements.txt | cut -d\# -f1`
98
+    pip_install $(get_from_global_requirements testrepository)
99
+
99 100
     local image_lines
100 101
     local images
101 102
     local num_images