... | ... |
@@ -222,14 +222,20 @@ dependency mechanism is beyond the scope of the current work. |
222 | 222 |
System Packages |
223 | 223 |
=============== |
224 | 224 |
|
225 |
-Devstack provides a framework for getting packages installed at an early |
|
226 |
-phase of its execution. These packages may be defined in a plugin as files |
|
227 |
-that contain new-line separated lists of packages required by the plugin |
|
228 | 225 |
|
229 |
-Supported packaging systems include apt and yum across multiple distributions. |
|
230 |
-To enable a plugin to hook into this and install package dependencies, packages |
|
231 |
-may be listed at the following locations in the top-level of the plugin |
|
232 |
-repository: |
|
226 |
+ |
|
227 |
+Devstack based |
|
228 |
+-------------- |
|
229 |
+ |
|
230 |
+Devstack provides a custom framework for getting packages installed at |
|
231 |
+an early phase of its execution. These packages may be defined in a |
|
232 |
+plugin as files that contain new-line separated lists of packages |
|
233 |
+required by the plugin |
|
234 |
+ |
|
235 |
+Supported packaging systems include apt and yum across multiple |
|
236 |
+distributions. To enable a plugin to hook into this and install |
|
237 |
+package dependencies, packages may be listed at the following |
|
238 |
+locations in the top-level of the plugin repository: |
|
233 | 239 |
|
234 | 240 |
- ``./devstack/files/debs/$plugin_name`` - Packages to install when running |
235 | 241 |
on Ubuntu, Debian or Linux Mint. |
... | ... |
@@ -240,6 +246,42 @@ repository: |
240 | 240 |
- ``./devstack/files/rpms-suse/$plugin_name`` - Packages to install when |
241 | 241 |
running on SUSE Linux or openSUSE. |
242 | 242 |
|
243 |
+Although there a no plans to remove this method of installing |
|
244 |
+packages, plugins should consider it deprecated for ``bindep`` support |
|
245 |
+described below. |
|
246 |
+ |
|
247 |
+bindep |
|
248 |
+------ |
|
249 |
+ |
|
250 |
+The `bindep <https://docs.openstack.org/infra/bindep>`__ project has |
|
251 |
+become the defacto standard for OpenStack projects to specify binary |
|
252 |
+dependencies. |
|
253 |
+ |
|
254 |
+A plugin may provide a ``./devstack/files/bindep.txt`` file, which |
|
255 |
+will be called with the *default* profile to install packages. For |
|
256 |
+details on the syntax, etc. see the bindep documentation. |
|
257 |
+ |
|
258 |
+It is also possible to use the ``bindep.txt`` of projects that are |
|
259 |
+being installed from source with the ``-bindep`` flag available in |
|
260 |
+install functions. For example |
|
261 |
+ |
|
262 |
+.. code-block:: bash |
|
263 |
+ |
|
264 |
+ if use_library_from_git "diskimage-builder"; then |
|
265 |
+ GITREPO["diskimage-builder"]=$DISKIMAGE_BUILDER_REPO_URL |
|
266 |
+ GITDIR["diskimage-builder"]=$DEST/diskimage-builder |
|
267 |
+ GITBRANCH["diskimage-builder"]=$DISKIMAGE_BUILDER_REPO_REF |
|
268 |
+ git_clone_by_name "diskimage-builder" |
|
269 |
+ setup_dev_lib -bindep "diskimage-builder" |
|
270 |
+ fi |
|
271 |
+ |
|
272 |
+will result in any packages required by the ``bindep.txt`` of the |
|
273 |
+``diskimage-builder`` project being installed. Note however that jobs |
|
274 |
+that switch projects between source and released/pypi installs |
|
275 |
+(e.g. with a ``foo-dsvm`` and a ``foo-dsvm-src`` test to cover both |
|
276 |
+released dependencies and master versions) will have to deal with |
|
277 |
+``bindep.txt`` being unavailable without the source directory. |
|
278 |
+ |
|
243 | 279 |
|
244 | 280 |
Using Plugins in the OpenStack Gate |
245 | 281 |
=================================== |
... | ... |
@@ -1275,6 +1275,30 @@ function get_plugin_packages { |
1275 | 1275 |
$xtrace |
1276 | 1276 |
} |
1277 | 1277 |
|
1278 |
+# Search plugins for a bindep.txt file |
|
1279 |
+# |
|
1280 |
+# Uses globals ``BINDEP_CMD``, ``GITDIR``, ``DEVSTACK_PLUGINS`` |
|
1281 |
+# |
|
1282 |
+# Note this is only valid after BINDEP_CMD is setup in stack.sh, and |
|
1283 |
+# is thus not really intended to be called externally. |
|
1284 |
+function _get_plugin_bindep_packages { |
|
1285 |
+ local xtrace |
|
1286 |
+ xtrace=$(set +o | grep xtrace) |
|
1287 |
+ set +o xtrace |
|
1288 |
+ |
|
1289 |
+ local bindep_file |
|
1290 |
+ local packages |
|
1291 |
+ |
|
1292 |
+ for plugin in ${DEVSTACK_PLUGINS//,/ }; do |
|
1293 |
+ bindep_file=${GITDIR[$plugin]}/devstack/files/bindep.txt |
|
1294 |
+ if [[ -f ${bindep_file} ]]; then |
|
1295 |
+ packages+=$($BINDEP_CMD -b --file ${bindep_file} || true) |
|
1296 |
+ fi |
|
1297 |
+ done |
|
1298 |
+ echo "${packages}" |
|
1299 |
+ $xtrace |
|
1300 |
+} |
|
1301 |
+ |
|
1278 | 1302 |
# Distro-agnostic package installer |
1279 | 1303 |
# Uses globals ``NO_UPDATE_REPOS``, ``REPOS_UPDATED``, ``RETRY_UPDATE`` |
1280 | 1304 |
# install_package package [package ...] |
... | ... |
@@ -809,6 +809,13 @@ install_infra |
809 | 809 |
$VIRTUALENV_CMD $DEST/bindep-venv |
810 | 810 |
# TODO(ianw) : optionally install from zuul checkout? |
811 | 811 |
$DEST/bindep-venv/bin/pip install bindep |
812 |
+export BINDEP_CMD=${DEST}/bindep-venv/bin/bindep |
|
813 |
+ |
|
814 |
+# Install packages as defined in plugin bindep.txt files |
|
815 |
+pkgs="$( _get_plugin_bindep_packages )" |
|
816 |
+if [[ -n "${pkgs}" ]]; then |
|
817 |
+ install_package ${pkgs} |
|
818 |
+fi |
|
812 | 819 |
|
813 | 820 |
# Extras Pre-install |
814 | 821 |
# ------------------ |