From 80173a999f39883405f3629e70e0ff31328baf54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= Date: Tue, 13 Jun 2017 18:14:22 +0200 Subject: [PATCH] Updated to 0.13, added python3 and python2 subpackages --- .gitignore | 1 + 0001-Include-net-if.h-for-IFF_-macros.patch | 24 ---- python-ethtool.spec | 122 +++++++++++++++----- sources | 2 +- 4 files changed, 92 insertions(+), 57 deletions(-) delete mode 100644 0001-Include-net-if.h-for-IFF_-macros.patch diff --git a/.gitignore b/.gitignore index b7a50ef..b442957 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ python-ethtool-0.5.tar.bz2 /python-ethtool-0.9.tar.bz2 /python-ethtool-0.10.tar.bz2 /python-ethtool-0.11.tar.bz2 +/ethtool-0.13.tar.gz diff --git a/0001-Include-net-if.h-for-IFF_-macros.patch b/0001-Include-net-if.h-for-IFF_-macros.patch deleted file mode 100644 index f5cb929..0000000 --- a/0001-Include-net-if.h-for-IFF_-macros.patch +++ /dev/null @@ -1,24 +0,0 @@ -From a43f582918d3295b7cdef9e056bf5b1c4eb2ef80 Mon Sep 17 00:00:00 2001 -From: Yaakov Selkowitz -Date: Mon, 22 Jun 2015 05:18:44 -0500 -Subject: [PATCH] Include net/if.h for IFF_* macros - ---- - python-ethtool/ethtool.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/python-ethtool/ethtool.c b/python-ethtool/ethtool.c -index 0f9cdbb..5415ec6 100644 ---- a/python-ethtool/ethtool.c -+++ b/python-ethtool/ethtool.c -@@ -27,6 +27,7 @@ - #include - #include - #include -+#include - - #include "etherinfo_struct.h" - #include "etherinfo_obj.h" --- -2.1.0 - diff --git a/python-ethtool.spec b/python-ethtool.spec index 61838ee..902f37b 100644 --- a/python-ethtool.spec +++ b/python-ethtool.spec @@ -1,57 +1,115 @@ -%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} -%{!?python_ver: %define python_ver %(%{__python} -c "import sys ; print sys.version[:3]")} +# The tests fail in mock +%bcond_with tests -Summary: Ethernet settings python bindings -Name: python-ethtool -Version: 0.11 -Release: 8%{?dist} -URL: https://fedorahosted.org/python-ethtool/ -Source: https://fedorahosted.org/releases/p/y/python-ethtool/python-ethtool-%{version}.tar.bz2 -License: GPLv2 -Group: System Environment/Libraries -BuildRequires: python-devel libnl3-devel asciidoc -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +# Created by pyp2rpm-3.2.2 +%global pypi_name ethtool -Patch1: 0001-Include-net-if.h-for-IFF_-macros.patch +Name: python-%{pypi_name} +Version: 0.13 +Release: 1%{?dist} +Summary: Python module to interface with %{pypi_name} + +License: GPLv2 +URL: https://github.com/fedora-python/%{name} +Source0: https://files.pythonhosted.org/packages/source/e/%{pypi_name}/%{pypi_name}-%{version}.tar.gz + +BuildRequires: python2-devel +BuildRequires: python2-setuptools + +BuildRequires: python3-devel +BuildRequires: python3-setuptools + +BuildRequires: libnl3-devel +BuildRequires: asciidoc %description Python bindings for the ethtool kernel interface, that allows querying and changing of Ethernet card settings, such as speed, port, auto-negotiation, and PCI locations. +%package -n python2-%{pypi_name} +Summary: %{summary} +%{?python_provide:%python_provide python2-%{pypi_name}} + +%description -n python2-%{pypi_name} +Python 2 bindings for the ethtool kernel interface, that allows querying and +changing of Ethernet card settings, such as speed, port, auto-negotiation, and +PCI locations. + +%package -n python3-%{pypi_name} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{pypi_name}} + +%description -n python3-%{pypi_name} +Python 3 bindings for the ethtool kernel interface, that allows querying and +changing of Ethernet card settings, such as speed, port, auto-negotiation, and +PCI locations. + + %prep -%setup -q -%patch1 -p1 +%autosetup -n %{pypi_name}-%{version} +# Remove bundled egg-info +rm -rf %{pypi_name}.egg-info + %build -%{__python} setup.py build +%py2_build +%py3_build + a2x -d manpage -f manpage man/pethtool.8.asciidoc a2x -d manpage -f manpage man/pifconfig.8.asciidoc %install -rm -rf %{buildroot} -%{__python} setup.py install --skip-build --root %{buildroot} -mkdir -p %{buildroot}%{_sbindir} %{buildroot}%{_mandir}/man8 -cp -p pethtool.py %{buildroot}%{_sbindir}/pethtool -cp -p pifconfig.py %{buildroot}%{_sbindir}/pifconfig +%py2_install +rm %{buildroot}%{_bindir}/pifconfig +rm %{buildroot}%{_bindir}/pethtool + +%py3_install +mkdir -p %{buildroot}%{_sbindir} +mv %{buildroot}{%{_bindir},%{_sbindir}}/pifconfig +mv %{buildroot}{%{_bindir},%{_sbindir}}/pethtool + +mkdir -p %{buildroot}%{_mandir}/man8/ %{__gzip} -c man/pethtool.8 > %{buildroot}%{_mandir}/man8/pethtool.8.gz %{__gzip} -c man/pifconfig.8 > %{buildroot}%{_mandir}/man8/pifconfig.8.gz -%clean -rm -rf %{buildroot} -%files -%defattr(-,root,root) -%doc COPYING -%{_sbindir}/pethtool -%{_sbindir}/pifconfig -%doc %{_mandir}/man8/* -%{python_sitearch}/ethtool.so -%if "%{python_ver}" >= "2.5" -%{python_sitearch}/*.egg-info +%if %{with tests} +%check +export PYTHONPATH=%{buildroot}%{python2_sitearch} +%{__python2} tests/parse_ifconfig.py -v +%{__python2} -m unittest discover -v + +export PYTHONPATH=%{buildroot}%{python3_sitearch} +%{__python3} tests/parse_ifconfig.py -v +%{__python3} -m unittest discover -v %endif + +%files -n python2-%{pypi_name} +%doc README.rst CHANGES.rst +%license COPYING +%{python2_sitearch}/%{pypi_name}.so +%{python2_sitearch}/%{pypi_name}-%{version}-py?.?.egg-info + +%files -n python3-%{pypi_name} +%doc README.rst CHANGES.rst +%license COPYING +%{_sbindir}/pifconfig +%{_sbindir}/pethtool +%doc %{_mandir}/man8/* +%{python3_sitearch}/%{pypi_name}.cpython-%{python3_version_nodots}*.so +%{python3_sitearch}/%{pypi_name}-%{version}-py?.?.egg-info + %changelog +* Tue Jun 13 2017 Miro HronĨok - 0.13-1 +- Updated to 0.13 +- Added python3 and python2 subpackages +- Add --with tests +- Modernize spec +- Remove merged patch +- Update upstream URL + * Sat Feb 11 2017 Fedora Release Engineering - 0.11-8 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild diff --git a/sources b/sources index df93027..0dc8d56 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -b505501d928debf69664b72fafa9d0c3 python-ethtool-0.11.tar.bz2 +SHA512 (ethtool-0.13.tar.gz) = da2be2d9c4404fc322807128090b483746199ed0def12df4b5a7e9f4fee380a32727d0e43a770e34f0d99fec7d68310ee104deafc92caff262622f623184c118