From 660b54a79238e2091c5c73e6487aadd95a705ef7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Tue, 12 Sep 2017 14:11:47 +0200 Subject: [PATCH 1/6] setup: Only run it when actually executed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't run the setup on import, but only when the script is actually executed. Signed-off-by: Lukáš Doktor --- setup.py | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/setup.py b/setup.py index e5c25ebdf3..e9148e28ff 100644 --- a/setup.py +++ b/setup.py @@ -79,25 +79,26 @@ def pre_post_plugin_type(): return 'avocado.plugins.job.prepost' -setup(name='avocado-plugins-vt', - version=VERSION, - description='Avocado Virt Test Compatibility Layer plugin', - author='Avocado Developers', - author_email='avocado-devel@redhat.com', - url='http://github.com/avocado-framework/avocado-vt', - packages=find_packages(exclude=('selftests*',)), - package_data={"virttest": ["*.*"]}, - data_files=get_data_files(), - entry_points={ - 'avocado.plugins.cli': [ - 'vt-list = avocado_vt.plugins.vt_list:VTLister', - 'vt = avocado_vt.plugins.vt:VTRun', - ], - 'avocado.plugins.cli.cmd': [ - 'vt-bootstrap = avocado_vt.plugins.vt_bootstrap:VTBootstrap', - ], - pre_post_plugin_type(): [ - 'vt-joblock = avocado_vt.plugins.vt_joblock:VTJobLock', - ], - }, - ) +if __name__ == "__main__": + setup(name='avocado-plugins-vt', + version=VERSION, + description='Avocado Virt Test Compatibility Layer plugin', + author='Avocado Developers', + author_email='avocado-devel@redhat.com', + url='http://github.com/avocado-framework/avocado-vt', + packages=find_packages(exclude=('selftests*',)), + package_data={"virttest": ["*.*"]}, + data_files=get_data_files(), + entry_points={ + 'avocado.plugins.cli': [ + 'vt-list = avocado_vt.plugins.vt_list:VTLister', + 'vt = avocado_vt.plugins.vt:VTRun', + ], + 'avocado.plugins.cli.cmd': [ + 'vt-bootstrap = avocado_vt.plugins.vt_bootstrap:VTBootstrap', + ], + pre_post_plugin_type(): [ + 'vt-joblock = avocado_vt.plugins.vt_joblock:VTJobLock', + ], + }, + ) From d2bf55e174b900475f313fc262b8e13141ec6042 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Mon, 4 Sep 2017 14:21:54 +0200 Subject: [PATCH 2/6] requirements: Add all mandatory requirements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The requirements are quite outdated. Let's include the mandatory ones to `setup.py` and include only optional ones in `requirements.txt`. Note that the "avocado-framework" dependency excludes some older versions of avocado that were called "avocado" only, but given those versions are ancient it shouldn't be a problem. Signed-off-by: Lukáš Doktor --- requirements.txt | 4 ---- setup.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index b23dba19cd..455beaa53c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1 @@ autotest>=0.16.2; python_version < '3.0' -aexpect>1.5.0 -simplejson>=3.5.3 -netaddr>=0.7.18 -netifaces>=0.10.5 diff --git a/setup.py b/setup.py index e9148e28ff..f643452f09 100644 --- a/setup.py +++ b/setup.py @@ -80,6 +80,17 @@ def pre_post_plugin_type(): if __name__ == "__main__": + requirements = ["netifaces", "aexpect", "netaddr", "simplejson"] + if sys.version_info[:2] >= (2, 7): + requirements.append("avocado-framework") + else: + # Latest py2 supported stevedore is 1.10.0, need to limit it here + # as older avocado versions were not limiting it. + # Note: Avocado 70+ doesn't require stevedore and older Avocado + # can use whatever version of stevedore on py3 + requirements.append("stevedore>=1.8.0,<=1.10.0") + requirements.append("avocado-framework<70.0") + setup(name='avocado-plugins-vt', version=VERSION, description='Avocado Virt Test Compatibility Layer plugin', @@ -101,4 +112,5 @@ def pre_post_plugin_type(): 'vt-joblock = avocado_vt.plugins.vt_joblock:VTJobLock', ], }, + install_requires=requirements, ) From aea2d6a6c57b3e256f299dc4f58e95e25f903aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Fri, 13 Oct 2017 09:55:09 +0200 Subject: [PATCH 3/6] Always use "pip" to install Avocado MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using the "setup.py" directly is not recommended as it invokes old and buggy easy_install. Let's use and promote "pip" installation method everywhere. Signed-off-by: Lukáš Doktor --- Makefile.include | 2 +- docs/source/GetStartedGuide.rst | 53 +++++++++++++++++++++++++-------- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/Makefile.include b/Makefile.include index a022d35c5f..412b3cb66c 100644 --- a/Makefile.include +++ b/Makefile.include @@ -7,7 +7,7 @@ source-release: clean git archive --prefix="$(ARCHIVE_BASE_NAME)-$(VERSION)/" -o "SOURCES/$(ARCHIVE_BASE_NAME)-$(VERSION).tar.gz" $(VERSION) install: - $(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE) + $(PYTHON) -m pip install --root $(DESTDIR) . srpm: source if test ! -d BUILD/SRPM; then mkdir -p BUILD/SRPM; fi diff --git a/docs/source/GetStartedGuide.rst b/docs/source/GetStartedGuide.rst index 0b117eebae..3c14766c47 100644 --- a/docs/source/GetStartedGuide.rst +++ b/docs/source/GetStartedGuide.rst @@ -6,30 +6,59 @@ Getting Started The first step towards using Avocado-VT is, quite obviously, installing it. -Installing Avocado -================== - -Start by following the instructions on `this link `__. - -Installing Avocado-VT +Installing Avocado-vt ===================== -Having installed Avocado, you should already have the right repos enabled. +Avocado-vt is an Avocado plugin, therefor you are going to need both in +order to be able to execute the tests. Usually the packaging mechanism +should take care of the deps, but when package is not available for +your distro, you need to start by installing Avocado, steps are +`described here `__. -.. note:: If you use avocado from sources, use `make link` as described `here `__. - -Fedora and Enterprise Linux ---------------------------- +Fedora and Red Hat Enterprise Linux +----------------------------------- Installing Avocado-VT on Fedora or Enterprise Linux is a matter of installing the `avocado-plugins-vt` package. Install it with:: $ yum install avocado-plugins-vt +Which takes care of all the dependencies (python and non-python ones). + +Installing via PIP +------------------ + +Pip is useful when it comes to python dependencies, but it fails +in non-python ones. List of non-python requirements based on Fedora +package names is:: + + $ dnf install xz tcpdump iproute iputils gcc glibc-headers nc git python-netaddr + +Then you can get Avocado-vt via pip:: + + $ pip install git+https://github.com/avocado-framework/avocado-vt + +Or by manually cloning it from github:: + + $ git clone https://github.com/avocado-framework/avocado-vt + $ cd avocado-vt + $ pip install . + +It's recommended to use ``pip`` even for local install as it treats +requirements differently and the use of ``python setup.py install`` +might fail. + +Using Avocado-vt from sources +----------------------------- + +If you intend use avocado from sources, clone it into the same parent dir +as Avocado sources and use ``make link`` from the Avocado sources dir. +Details about this can be found `here `__. + .. _run_bootstrap: Bootstrapping Avocado-VT ------------------------- +======================== After the package, a bootstrap process must be run. Choose your test backend (qemu, libvirt, v2v, openvswitch, etc) and run the `vt-bootstrap` command. Example:: From ade4e809ce8ff2c92c685827f7742e8e5e417dcc Mon Sep 17 00:00:00 2001 From: Lucas Meneghel Rodrigues Date: Mon, 22 Jan 2018 17:01:28 +0100 Subject: [PATCH 4/6] setup.py: Standardize plugin naming Let's use the same naming standard that other avocado plugins are using (avocado-framework-plugin-[name]). Signed-off-by: Lucas Meneghel Rodrigues --- avocado-plugins-vt.spec | 9 ++++++--- setup.py | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/avocado-plugins-vt.spec b/avocado-plugins-vt.spec index 5733c42955..8e32315173 100644 --- a/avocado-plugins-vt.spec +++ b/avocado-plugins-vt.spec @@ -38,7 +38,7 @@ Summary: Avocado Virt Test Plugin Name: avocado-plugins-vt Version: 70.0 -Release: 0%{?gitrel}%{?dist} +Release: 1%{?gitrel}%{?dist} License: GPLv2 Group: Development/Tools URL: http://avocado-framework.readthedocs.org/ @@ -139,7 +139,7 @@ Xunit output, among others. %config(noreplace)/etc/avocado/conf.d/vt.conf %doc README.rst LICENSE %{python2_sitelib}/avocado_vt* -%{python2_sitelib}/avocado_plugins_vt* +%{python2_sitelib}/avocado_framework_plugins_vt* %{python2_sitelib}/virttest* %{_datadir}/avocado-plugins-vt/backends/* %{_datadir}/avocado-plugins-vt/shared/* @@ -153,7 +153,7 @@ Xunit output, among others. %config(noreplace)/etc/avocado/conf.d/vt.conf %doc README.rst LICENSE %{python3_sitelib}/avocado_vt* -%{python3_sitelib}/avocado_plugins_vt* +%{python3_sitelib}/avocado_framework_plugins_vt* %{python3_sitelib}/virttest* %{_datadir}/avocado-plugins-vt/backends/* %{_datadir}/avocado-plugins-vt/shared/* @@ -162,6 +162,9 @@ Xunit output, among others. %changelog +* Wed Aug 14 2019 Lukas Doktor - 70.0-1 +- Rename package to "avocado_framework_plugins_vt" + * Wed Jun 26 2019 Cleber Rosa - 70.0-0 - New release diff --git a/setup.py b/setup.py index f643452f09..aefd35d9de 100644 --- a/setup.py +++ b/setup.py @@ -91,9 +91,9 @@ def pre_post_plugin_type(): requirements.append("stevedore>=1.8.0,<=1.10.0") requirements.append("avocado-framework<70.0") - setup(name='avocado-plugins-vt', + setup(name='avocado-framework-plugins-vt', version=VERSION, - description='Avocado Virt Test Compatibility Layer plugin', + description='Avocado Plugin for Virtualization Testing', author='Avocado Developers', author_email='avocado-devel@redhat.com', url='http://github.com/avocado-framework/avocado-vt', From 971fe35d0c6040dc0666a3585362291a24982b7f Mon Sep 17 00:00:00 2001 From: Lucas Meneghel Rodrigues Date: Tue, 23 Jan 2018 10:40:25 +0100 Subject: [PATCH 5/6] debian: Update distribution name Let's build for the most recent (at the moment), Ubuntu LTS (18.04). Signed-off-by: Lucas Meneghel Rodrigues --- contrib/packages/debian/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/packages/debian/Makefile b/contrib/packages/debian/Makefile index c3d268a57d..6485e3a2f7 100644 --- a/contrib/packages/debian/Makefile +++ b/contrib/packages/debian/Makefile @@ -11,7 +11,7 @@ all: prepare-source: # build the source package in the parent directory # then rename it to project_version.orig.tar.gz - dch -D "vivid" -M -v "$(VERSION)" "Automated (make builddeb) build." + dch -D "bionic" -M -v "$(VERSION)" "Automated (make builddeb) build." $(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../ --prune rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../* From 5ffef819cc487554cc55dae9d12d34001360dc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Fri, 17 Aug 2018 17:26:44 +0200 Subject: [PATCH 6/6] Use SettingPlugin to register config files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The SettingPlugin allows to extend setting paths. let's use this plugin to include our config files instead of injecting them to a magic location. Signed-off-by: Lukáš Doktor --- MANIFEST.in | 1 + Makefile | 8 ++--- avocado-plugins-vt.spec | 15 ++++++--- {etc/avocado => avocado_vt}/conf.d/vt.conf | 0 .../conf.d/vt_joblock.conf | 0 avocado_vt/plugins/vt_settings.py | 33 +++++++++++++++++++ setup.py | 13 ++++---- 7 files changed, 54 insertions(+), 16 deletions(-) rename {etc/avocado => avocado_vt}/conf.d/vt.conf (100%) rename {etc/avocado => avocado_vt}/conf.d/vt_joblock.conf (100%) create mode 100644 avocado_vt/plugins/vt_settings.py diff --git a/MANIFEST.in b/MANIFEST.in index a5021c60e3..8020c3d3c2 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,2 +1,3 @@ include README.rst include LICENSE +recursive-include avocado_vt/conf.d * diff --git a/Makefile b/Makefile index 5a4bcc0d07..6c57da1be5 100644 --- a/Makefile +++ b/Makefile @@ -57,14 +57,12 @@ develop: $(PYTHON) setup.py develop $(PYTHON_DEVELOP_ARGS) link: develop - for CONF in etc/avocado/conf.d/*; do\ - [ -d "../$(AVOCADO_DIRNAME)/avocado/etc/avocado/conf.d" ] && ln -srf $(CURDIR)/$$CONF ../$(AVOCADO_DIRNAME)/avocado/$$CONF || true;\ - [ -d "../$(AVOCADO_DIRNAME)/etc/avocado/conf.d" ] && ln -srf $(CURDIR)/$$CONF ../$(AVOCADO_DIRNAME)/$$CONF || true;\ - done unlink: $(PYTHON) setup.py develop --uninstall $(PYTHON_DEVELOP_ARGS) - for CONF in etc/avocado/conf.d/*; do\ + # For compatibility reasons remove old symlinks + for NAME in $$(ls -1 avocado_vt/conf.d); do\ + CONF="etc/avocado/conf.d/$$NAME";\ [ -L ../$(AVOCADO_DIRNAME)/avocado/$$CONF ] && rm -f ../$(AVOCADO_DIRNAME)/avocado/$$CONF || true;\ [ -L ../$(AVOCADO_DIRNAME)/$$CONF ] && rm -f ../$(AVOCADO_DIRNAME)/$$CONF || true;\ done diff --git a/avocado-plugins-vt.spec b/avocado-plugins-vt.spec index 8e32315173..4d1d0dcfaa 100644 --- a/avocado-plugins-vt.spec +++ b/avocado-plugins-vt.spec @@ -38,7 +38,7 @@ Summary: Avocado Virt Test Plugin Name: avocado-plugins-vt Version: 70.0 -Release: 1%{?gitrel}%{?dist} +Release: 2%{?gitrel}%{?dist} License: GPLv2 Group: Development/Tools URL: http://avocado-framework.readthedocs.org/ @@ -130,13 +130,15 @@ Xunit output, among others. %{__python2} setup.py install --root %{buildroot} --skip-build %if %{with_python3} %{__python3} setup.py install --root %{buildroot} --skip-build +%{__mkdir} -p %{buildroot}/etc/avocado/conf.d +%{__mv} %{buildroot}%{python2_sitelib}/avocado_vt/conf.d/* %{buildroot}/etc/avocado/conf.d %endif %files -n python2-%{name} %defattr(-,root,root,-) -%dir /etc/avocado -%dir /etc/avocado/conf.d -%config(noreplace)/etc/avocado/conf.d/vt.conf +%dir %{_sysconfdir}/avocado +%dir %{_sysconfdir}/avocado/conf.d +%config(noreplace)%{_sysconfdir}/avocado/conf.d/*.conf %doc README.rst LICENSE %{python2_sitelib}/avocado_vt* %{python2_sitelib}/avocado_framework_plugins_vt* @@ -150,7 +152,7 @@ Xunit output, among others. %defattr(-,root,root,-) %dir /etc/avocado %dir /etc/avocado/conf.d -%config(noreplace)/etc/avocado/conf.d/vt.conf +%config(noreplace)%{_sysconfdir}/avocado/conf.d/*.conf %doc README.rst LICENSE %{python3_sitelib}/avocado_vt* %{python3_sitelib}/avocado_framework_plugins_vt* @@ -162,6 +164,9 @@ Xunit output, among others. %changelog +* Wed Aug 14 2019 Lukas Doktor - 70.0-2 +- Change the way config files are packaged + * Wed Aug 14 2019 Lukas Doktor - 70.0-1 - Rename package to "avocado_framework_plugins_vt" diff --git a/etc/avocado/conf.d/vt.conf b/avocado_vt/conf.d/vt.conf similarity index 100% rename from etc/avocado/conf.d/vt.conf rename to avocado_vt/conf.d/vt.conf diff --git a/etc/avocado/conf.d/vt_joblock.conf b/avocado_vt/conf.d/vt_joblock.conf similarity index 100% rename from etc/avocado/conf.d/vt_joblock.conf rename to avocado_vt/conf.d/vt_joblock.conf diff --git a/avocado_vt/plugins/vt_settings.py b/avocado_vt/plugins/vt_settings.py new file mode 100644 index 0000000000..1d12014369 --- /dev/null +++ b/avocado_vt/plugins/vt_settings.py @@ -0,0 +1,33 @@ +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# +# See LICENSE for more details. +# +# Copyright: Red Hat Inc. 2018 +# Author: Lukas Doktor + +""" +Avocado plugin that extends the settings path of our config paths +""" + +import os +from pkg_resources import resource_filename +from pkg_resources import resource_listdir + +from avocado.core.plugin_interfaces import Settings + + +class VTSettings(Settings): + + def adjust_settings_paths(self, paths): + base = resource_filename('avocado_vt', 'conf.d') + for path in [os.path.join(base, conf) + for conf in resource_listdir('avocado_vt', 'conf.d') + if conf.endswith('.conf')]: + paths.insert(0, path) diff --git a/setup.py b/setup.py index aefd35d9de..f1aec4c58f 100644 --- a/setup.py +++ b/setup.py @@ -55,10 +55,7 @@ def add_files(level=[]): os.path.isfile(path)] return [((get_dir(installed_location, level)), files_found)] - data_files = [(get_dir(['etc', 'avocado', 'conf.d']), - ['etc/avocado/conf.d/vt.conf'])] - - data_files += add_files(["test-providers.d"]) + data_files = add_files(["test-providers.d"]) data_files_dirs = ['backends', 'shared'] for data_file_dir in data_files_dirs: @@ -82,14 +79,14 @@ def pre_post_plugin_type(): if __name__ == "__main__": requirements = ["netifaces", "aexpect", "netaddr", "simplejson"] if sys.version_info[:2] >= (2, 7): - requirements.append("avocado-framework") + requirements.append("avocado-framework>=68.0") else: # Latest py2 supported stevedore is 1.10.0, need to limit it here # as older avocado versions were not limiting it. # Note: Avocado 70+ doesn't require stevedore and older Avocado # can use whatever version of stevedore on py3 requirements.append("stevedore>=1.8.0,<=1.10.0") - requirements.append("avocado-framework<70.0") + requirements.append("avocado-framework>=68.0,<70.0") setup(name='avocado-framework-plugins-vt', version=VERSION, @@ -100,7 +97,11 @@ def pre_post_plugin_type(): packages=find_packages(exclude=('selftests*',)), package_data={"virttest": ["*.*"]}, data_files=get_data_files(), + include_package_data=True, entry_points={ + 'avocado.plugins.settings': [ + 'vt-settings = avocado_vt.plugins.vt_settings:VTSettings', + ], 'avocado.plugins.cli': [ 'vt-list = avocado_vt.plugins.vt_list:VTLister', 'vt = avocado_vt.plugins.vt:VTRun',