From 1b41f7fa61dbdad4d33f243c5c747bcdb5287cdd Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Wed, 10 Jan 2018 20:15:33 -0500 Subject: [PATCH] Packaging: add bash RPM sub package To remove some of the bloat (even if little) of the base python-avocado package, let's move content that is not useful to Python developers out of the way. This should also make the experience of content more similar across users of the Python module (say, from a `pip install`) and users of the python-avocado package. Signed-off-by: Cleber Rosa --- docs/source/WritingTests.rst | 24 +++++++++++++++++------- python-avocado.spec | 23 ++++++++++++++++++----- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/docs/source/WritingTests.rst b/docs/source/WritingTests.rst index cefac069..7e7c47da 100644 --- a/docs/source/WritingTests.rst +++ b/docs/source/WritingTests.rst @@ -1724,18 +1724,28 @@ tests: +-----------------------------+---------------------------------------+-----------------------------------------------------------------------------------------------------+ -Simple Tests BASH extensions +SIMPLE Tests BASH extensions ============================ -To enhance simple tests one can use supported set of libraries we created. The -only requirement is to use:: +SIMPLE tests written in shell can use a few Avocado utilities. In your +shell code, check if the libraries are available with something like:: - PATH=$(avocado "exec-path"):$PATH + AVOCADO_SHELL_EXTENSIONS_DIR=$(avocado exec-path 2>/dev/null) -which injects path to Avocado utils into shell PATH. Take a look into -``avocado exec-path`` to see list of available functions and take a look at -``examples/tests/simplewarning.sh`` for inspiration. +And if available, injects that directory containing those utilities +into the PATH used by the shell, making those utilities readily +accessible:: + if [ $? == 0 ]; then + PATH=$AVOCADO_SHELL_EXTENSIONS_DIR:$PATH + fi + +For a full list of utilities, take a look into at the directory return +by ``avocado exec-path`` (if any). Also, the example test +``examples/tests/simplewarning.sh`` can serve as further inspiration. + +.. tip:: These extensions may be available as a separate package. For + RPM packages, look for the ``bash`` sub-package. Wrap Up ======= diff --git a/python-avocado.spec b/python-avocado.spec index 7fd47148..6b94dcc8 100644 --- a/python-avocado.spec +++ b/python-avocado.spec @@ -194,6 +194,8 @@ popd %{__cp} -r examples/yaml_to_mux %{buildroot}%{_datadir}/avocado %{__cp} -r examples/yaml_to_mux_loader %{buildroot}%{_datadir}/avocado %{__cp} -r examples/varianter_pict %{buildroot}%{_datadir}/avocado +%{__install} -d -m 0755 %{buildroot}%{_libexecdir}/avocado +%{__install} -m 0755 libexec/avocado* %{buildroot}%{_libexecdir}/avocado %check %if %{with_tests} @@ -277,11 +279,6 @@ AVOCADO_CHECK_LEVEL=0 selftests/run %exclude %{python_sitelib}/avocado_framework_plugin_loader_yaml* %exclude %{python_sitelib}/avocado_framework_plugin_golang* %exclude %{python_sitelib}/avocado_framework_plugin_result_upload* -%{_libexecdir}/avocado/avocado-bash-utils -%{_libexecdir}/avocado/avocado_debug -%{_libexecdir}/avocado/avocado_error -%{_libexecdir}/avocado/avocado_info -%{_libexecdir}/avocado/avocado_warn %package plugins-output-html Summary: Avocado HTML report plugin @@ -449,12 +446,28 @@ examples of how to write tests on your own. %{_datadir}/avocado/yaml_to_mux_loader %{_datadir}/avocado/varianter_pict +%package bash +Summary: Avocado Test Framework Bash Utilities +Requires: %{name} == %{version} + +%description bash +A small set of utilities to interact with Avocado from the Bourne +Again Shell code (and possibly other similar shells). + +%files bash +%{_libexecdir}/avocado/avocado-bash-utils +%{_libexecdir}/avocado/avocado_debug +%{_libexecdir}/avocado/avocado_error +%{_libexecdir}/avocado/avocado_info +%{_libexecdir}/avocado/avocado_warn + %changelog * Sat Jan 6 2018 Cleber Rosa - 57.0-3 - Move the avocado package config files to the system location - Add missing configuration files for sub packages - Adapt to change in example file installation - Remove man pages source files from package +- Add bash subpackage * Tue Dec 19 2017 Cleber Rosa - 57.0-2 - Removed patch added on release 1, considering it's upstream -- GitLab