diff --git a/.gitignore b/.gitignore index 999cc12..71b8b4c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ +/test-sources-2020-04-29.tar.gz +/tests/__pycache__/ /tests/data/scripts_pythondistdeps/usr/ diff --git a/python-rpm-generators.spec b/python-rpm-generators.spec index e446519..6687b81 100644 --- a/python-rpm-generators.spec +++ b/python-rpm-generators.spec @@ -1,7 +1,7 @@ Name: python-rpm-generators Summary: Dependency generators for Python RPMs Version: 11 -Release: 4%{?dist} +Release: 5%{?dist} # Originally all those files were part of RPM, so license is kept here License: GPLv2+ @@ -45,6 +45,15 @@ install -Dpm0755 -t %{buildroot}%{_rpmconfigdir} pythondistdeps.py %{_rpmconfigdir}/pythondistdeps.py %changelog +* Wed Apr 29 2020 Tomas Orsava - 11-5 +- Backporting proposed upstream changes + https://github.com/rpm-software-management/rpm/pull/1195 + - Only provide python3dist(..) for the main Python versions (BZ#1812083) + - Preparation for the proper handling of normalized names (BZ#1791530) + - Add a test suite (and enable it in Fedora CI) + - Better error messages for unsupported package versions + - Fix sorting of dev versions + * Tue Apr 28 2020 Miro HronĨok - 11-4 - Don't define global Lua variables from Python generator diff --git a/pythondist.attr b/pythondist.attr index 2bf737a..be23e16 100644 --- a/pythondist.attr +++ b/pythondist.attr @@ -1,3 +1,3 @@ -%__pythondist_provides %{_rpmconfigdir}/pythondistdeps.py --provides --majorver-provides -%__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires +%__pythondist_provides %{_rpmconfigdir}/pythondistdeps.py --provides --normalized-names-format legacy-dots --normalized-names-provide-both --majorver-provides-versions 2.7,%{__default_python3_version} +%__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires --normalized-names-format legacy-dots %__pythondist_path ^/usr/lib(64)?/python[[:digit:]]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$ diff --git a/sources b/sources new file mode 100644 index 0000000..1d7f97a --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (test-sources-2020-04-29.tar.gz) = a5539fbe05a4f7128b4f82e960c3f1392a55ad53086dfd7fbc436d2743feaf64784e08667237baed3a32f149db25bc63e4ab3efc2b0270f969c59550b75102b1 diff --git a/tests/data/scripts_pythondistdeps/update-test-sources.sh b/tests/data/scripts_pythondistdeps/update-test-sources.sh new file mode 120000 index 0000000..7fc1a5a --- /dev/null +++ b/tests/data/scripts_pythondistdeps/update-test-sources.sh @@ -0,0 +1 @@ +../../../update-test-sources.sh \ No newline at end of file diff --git a/tests/test_scripts_pythondistdeps.py b/tests/test_scripts_pythondistdeps.py index 5bbf357..2dc9a30 100644 --- a/tests/test_scripts_pythondistdeps.py +++ b/tests/test_scripts_pythondistdeps.py @@ -37,7 +37,7 @@ import sys import tempfile import yaml -PYTHONDISTDEPS_PATH = Path(__file__).parent / '..' / 'scripts' / 'pythondistdeps.py' +PYTHONDISTDEPS_PATH = Path(__file__).parent / '..' / 'pythondistdeps.py' TEST_DATA_PATH = Path(__file__).parent / 'data' / 'scripts_pythondistdeps' diff --git a/tests/tests.yml b/tests/tests.yml index cceb9b4..676d22c 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -8,10 +8,15 @@ state: latest - hosts: localhost + tags: + - classic + pre_tasks: + - import_role: + name: standard-test-source + vars: + fetch_only: True roles: - role: standard-test-basic - tags: - - classic tests: - pythonabi: dir: . @@ -19,6 +24,18 @@ - pythonname: dir: . run: ./pythonname.sh + - prepare-test-data: + dir: . + run: tar -xvf test-sources-*.tar.gz -C ./tests/data/scripts_pythondistdeps/ + - pythondistdeps: + dir: ./tests + # Use update-test-sources.sh to update the test data + run: python3 -m pytest --capture=no -vvv required_packages: - rpm-build - python3-devel + - python3-pip + - python3-pytest + - python3-pyyaml + - python3-setuptools + - python3-wheel diff --git a/update-test-sources.sh b/update-test-sources.sh new file mode 100755 index 0000000..b7fa68b --- /dev/null +++ b/update-test-sources.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# +# Requirements: +# - pip >= 20.0.1 +# + +# First prune old test data +rm -rf ./tests/data/scripts_pythondistdeps/usr + +# First run the test suite, it will download the test-data again +python3 -m pytest --capture=no -vvv + +# Archive the test data into a file with today's date +archive=test-sources-$(date +%Y-%m-%d).tar.gz +tar -zcvf ${archive} -C ./tests/data/scripts_pythondistdeps/ usr + +# Now manually run: +# $ fedpkg new-sources ${archive}