Blob Blame History Raw
From 8be7c4fb325aa875e7d752975d61cd89f9239e7b Mon Sep 17 00:00:00 2001
From: Cleber Rosa <crosa@redhat.com>
Date: Tue, 29 Jan 2019 13:49:32 -0500
Subject: [PATCH] YAML to Mux plugin: use downstream versions in the SPEC file
 only

Commit c60f0ae85 fixed a CVE warning that GitHub sent notifications
about.  While so, it was attempted to fulfill the downstream (Fedora
and EPEL) dependencies in the same patch, keeping users of Python 2
with possibly vulnerable versions.

The matching of versions that ship in the Fedora and EPEL distros are
really best done in the SPEC file.  Finally, this was motivated by the
fact that the simple Python version check was not enough because
PyYAML>=4.2b2 is not available on Fedora 28, even though it contains
Python 3.

Reference: https://trello.com/c/3UMFOyzQ/1484-pyyaml-requirement-not-fulfilled-on-f28
Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 optional_plugins/varianter_yaml_to_mux/setup.py | 11 +----------
 python-avocado.spec                             |  4 ++++
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/optional_plugins/varianter_yaml_to_mux/setup.py b/optional_plugins/varianter_yaml_to_mux/setup.py
index 744bf06be..e6fb8ffa4 100644
--- a/optional_plugins/varianter_yaml_to_mux/setup.py
+++ b/optional_plugins/varianter_yaml_to_mux/setup.py
@@ -13,18 +13,9 @@
 # Copyright: Red Hat Inc. 2017
 # Author: Cleber Rosa <crosa@redhat.com>
 
-import sys
 from setuptools import setup, find_packages
 
 
-INSTALL_REQUIREMENTS = ['avocado-framework']
-
-if sys.version_info[0] == 2:
-    INSTALL_REQUIREMENTS.append('PyYAML>=3.10')
-else:
-    INSTALL_REQUIREMENTS.append('PyYAML>=4.2b2')
-
-
 setup(name='avocado-framework-plugin-varianter-yaml-to-mux',
       description='Avocado Varianter plugin to parse YAML file into variants',
       version=open("VERSION", "r").read().strip(),
@@ -33,7 +24,7 @@
       url='http://avocado-framework.github.io/',
       packages=find_packages(exclude=('tests*',)),
       include_package_data=True,
-      install_requires=INSTALL_REQUIREMENTS,
+      install_requires=('avocado-framework', 'PyYAML>=4.2b2'),
       test_suite='tests',
       entry_points={
           "avocado.plugins.cli": [
diff --git a/python-avocado.spec b/python-avocado.spec
index ca4841a0f..8e2bb3032 100644
--- a/python-avocado.spec
+++ b/python-avocado.spec
@@ -214,6 +214,10 @@ sed -e "s/'libvirt-python'//" -i optional_plugins/runner_vm/setup.py
 %build
 %if 0%{?rhel} == 7
 sed -e "s/'six>=1.10.0'/'six>=1.9.0'/" -i setup.py
+sed -e "s/'PyYAML>=4.2b2'/'PyYAML>=3.10'/" -i optional_plugins/varianter_yaml_to_mux/setup.py
+%endif
+%if 0%{?fedora} && 0%{?fedora} < 29
+sed -e "s/'PyYAML>=4.2b2'/'PyYAML>=3.12'/" -i optional_plugins/varianter_yaml_to_mux/setup.py
 %endif
 %py2_build
 %if %{with_python3}