Blame SPECS/scapy.spec

51aaa4
Name:           scapy
51aaa4
Version:        2.4.4
51aaa4
Release:        5%{?dist}
51aaa4
Summary:        Interactive packet manipulation tool and network scanner
51aaa4
51aaa4
%global         gituser         secdev
51aaa4
%global         gitname         scapy
51aaa4
%global         commit          95ba5b8504152a1f820bbe679ccf03668cb5118f
51aaa4
%global         shortcommit     %(c=%{commit}; echo ${c:0:7})
51aaa4
51aaa4
License:        GPLv2
51aaa4
URL:            http://www.secdev.org/projects/scapy/
51aaa4
#               https://github.com/secdev/scapy/releases
51aaa4
#               https://bitbucket.org/secdev/scapy/pull-request/80
51aaa4
#               https://scapy.readthedocs.io/en/latest/introduction.html
51aaa4
Source0:        https://github.com/%{gituser}/%{gitname}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
51aaa4
Patch1:         scapy-2.4.3-libc.patch
51aaa4
51aaa4
%global         common_desc %{expand:
51aaa4
Scapy is a powerful interactive packet manipulation program built on top
51aaa4
of the Python interpreter. It can be used to forge or decode packets of
51aaa4
a wide number of protocols, send them over the wire, capture them, match
51aaa4
requests and replies, and much more.}
51aaa4
51aaa4
51aaa4
# By default build with python3 subpackage
51aaa4
%bcond_without     python3
51aaa4
51aaa4
# Build also the python2 package on releases up to fc31 and rhel8
51aaa4
%if (0%{?fedora} && 0%{?fedora} <= 31 ) || ( 0%{?rhel} && 0%{?rhel} <= 8 )
51aaa4
%bcond_without     python2
51aaa4
%else
51aaa4
%bcond_with        python2
51aaa4
%endif
51aaa4
51aaa4
# Build the documentation only on Fedora due to cc-by-nc-sa license
51aaa4
%if 0%{?fedora}
51aaa4
%bcond_without     doc
51aaa4
%else
51aaa4
%bcond_with        doc
51aaa4
%endif
51aaa4
51aaa4
51aaa4
51aaa4
51aaa4
BuildArch:      noarch
51aaa4
51aaa4
BuildRequires:  make
51aaa4
BuildRequires:  sed
51aaa4
51aaa4
%if 0%{?with_python2}
51aaa4
BuildRequires:  python2-devel
51aaa4
BuildRequires:  python2-setuptools
51aaa4
%endif
51aaa4
51aaa4
%if 0%{?with_python3}
51aaa4
BuildRequires:  python%{python3_pkgversion}-devel
51aaa4
BuildRequires:  python%{python3_pkgversion}-setuptools
51aaa4
%endif
51aaa4
51aaa4
# Recommends only supported on fedora and rhel8+
51aaa4
%if (0%{?fedora}) || ( 0%{?rhel} && 0%{?rhel} >= 8 )
51aaa4
Recommends:     tcpdump
51aaa4
# Using database of manufactures /usr/share/wireshark/manuf
51aaa4
Recommends:     wireshark-cli
51aaa4
%endif
51aaa4
51aaa4
%description %{common_desc}
51aaa4
51aaa4
%if 0%{?with_python2}
51aaa4
%package -n python2-%{name}
51aaa4
Summary:        Interactive packet manipulation tool and network scanner
51aaa4
51aaa4
%{?python_provide:%python_provide python2-%{name}}
51aaa4
51aaa4
%if (0%{?fedora}) || ( 0%{?rhel} && 0%{?rhel} >= 8 ) 
51aaa4
Recommends:     python2-pyx
51aaa4
Recommends:     python2-matplotlib
51aaa4
Recommends:     ipython2
51aaa4
%endif
51aaa4
51aaa4
%description -n python2-%{name}
51aaa4
%{common_desc}
51aaa4
51aaa4
%endif
51aaa4
51aaa4
51aaa4
%if 0%{?with_python3}
51aaa4
%package -n python%{python3_pkgversion}-%{name}
51aaa4
Summary:        Interactive packet manipulation tool and network scanner
51aaa4
51aaa4
%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}
51aaa4
Provides:       %{name} = %{version}-%{release}
51aaa4
51aaa4
%if (0%{?fedora}) || ( 0%{?rhel} && 0%{?rhel} >= 8 ) 
51aaa4
Recommends:     PyX
51aaa4
Recommends:     python%{python3_pkgversion}-matplotlib
51aaa4
Recommends:     ipython3
51aaa4
%endif
51aaa4
51aaa4
%description -n python%{python3_pkgversion}-%{name}
51aaa4
%{common_desc}
51aaa4
%endif
51aaa4
51aaa4
%if 0%{?with_doc}
51aaa4
%package doc
51aaa4
Summary:        Interactive packet manipulation tool and network scanner
51aaa4
51aaa4
BuildRequires:  python%{python3_pkgversion}-sphinx
51aaa4
BuildRequires:  python%{python3_pkgversion}-sphinx_rtd_theme
51aaa4
51aaa4
%description doc
51aaa4
%{common_desc}
51aaa4
%endif
51aaa4
51aaa4
51aaa4
51aaa4
%prep
51aaa4
%autosetup -p 1 -n %{name}-%{version}
51aaa4
51aaa4
# Remove shebang
51aaa4
# https://github.com/secdev/scapy/pull/2332
51aaa4
SHEBANGS=$(find ./scapy -name '*.py' -print | xargs grep -l -e '^#!.*env python')
51aaa4
for FILE in $SHEBANGS ; do
51aaa4
    sed -i.orig -e 1d "${FILE}"
51aaa4
    touch -r "${FILE}.orig" "${FILE}"
51aaa4
    rm "${FILE}.orig"
51aaa4
done
51aaa4
51aaa4
51aaa4
51aaa4
%build
51aaa4
%if 0%{?with_python2}
51aaa4
%py2_build
51aaa4
%endif
51aaa4
51aaa4
%if 0%{?with_python3}
51aaa4
%py3_build
51aaa4
%endif
51aaa4
51aaa4
%if 0%{?with_doc}
51aaa4
# the following commands are copied from tox.ini to avoid a dependency on tox
51aaa4
pushd doc/scapy
51aaa4
sphinx-apidoc-%python3_version -f --no-toc --separate --module-first --output-dir api ../../scapy ../../scapy/modules/ ../../scapy/libs/ ../../scapy/tools/ ../../scapy/arch/ ../../scapy/contrib/cansocket* ../../scapy/contrib/scada/* ../../scapy/all.py ../../scapy/layers/all.py
51aaa4
%{python3} sphinx_apidoc_postprocess.py
51aaa4
make html BUILDDIR=_build_doc SCAPY_APITREE=0 SPHINXBUILD=sphinx-build-%python3_version
51aaa4
51aaa4
rm -f _build_doc/html/.buildinfo
51aaa4
rm -f _build_doc/html/_static/_dummy
51aaa4
popd
51aaa4
%endif
51aaa4
51aaa4
51aaa4
51aaa4
%install
51aaa4
install -dp -m0755 %{buildroot}%{_mandir}/man1
51aaa4
install -Dp -m0644 doc/scapy.1* %{buildroot}%{_mandir}/man1/
51aaa4
51aaa4
%if 0%{?with_python2}
51aaa4
%py2_install
51aaa4
rm -f %{buildroot}%{python2_sitelib}/*egg-info/requires.txt
51aaa4
51aaa4
51aaa4
# Rename the executables
51aaa4
mv -f %{buildroot}%{_bindir}/scapy   %{buildroot}%{_bindir}/scapy2
51aaa4
mv -f %{buildroot}%{_bindir}/UTscapy %{buildroot}%{_bindir}/UTscapy2
51aaa4
51aaa4
%if ! 0%{?with_python3}
51aaa4
# Link the default to the py2 version of executables if py3 not built
51aaa4
ln -s %{_bindir}/scapy2   %{buildroot}%{_bindir}/scapy
51aaa4
ln -s %{_bindir}/UTscapy2 %{buildroot}%{_bindir}/UTscapy
51aaa4
%endif
51aaa4
%endif
51aaa4
51aaa4
%if 0%{?with_python3}
51aaa4
%py3_install
51aaa4
rm -f %{buildroot}%{python3_sitelib}/*egg-info/requires.txt
51aaa4
51aaa4
# Rename the executables
51aaa4
mv -f %{buildroot}%{_bindir}/scapy   %{buildroot}%{_bindir}/scapy3
51aaa4
mv -f %{buildroot}%{_bindir}/UTscapy %{buildroot}%{_bindir}/UTscapy3
51aaa4
51aaa4
# Link the default to the python3 version of executables
51aaa4
ln -s %{_bindir}/scapy3   %{buildroot}%{_bindir}/scapy
51aaa4
ln -s %{_bindir}/UTscapy3 %{buildroot}%{_bindir}/UTscapy
51aaa4
%endif
51aaa4
51aaa4
51aaa4
51aaa4
# check
51aaa4
# TODO: Need to fix/remove slow/failed test
51aaa4
# cd test/
51aaa4
# ./run_tests_py2 || true
51aaa4
# ./run_tests_py3 || true
51aaa4
51aaa4
51aaa4
51aaa4
%if 0%{?with_python2}
51aaa4
%files -n python2-%{name}
51aaa4
%license LICENSE
51aaa4
%if ! 0%{?with_python3}
51aaa4
%doc %{_mandir}/man1/scapy.1*
51aaa4
%{_bindir}/scapy
51aaa4
%{_bindir}/UTscapy
51aaa4
%endif
51aaa4
%{_bindir}/scapy2
51aaa4
%{_bindir}/UTscapy2
51aaa4
%{python2_sitelib}/scapy/
51aaa4
%{python2_sitelib}/scapy-*.egg-info
51aaa4
%endif
51aaa4
51aaa4
51aaa4
51aaa4
%if 0%{?with_python3}
51aaa4
%files -n python%{python3_pkgversion}-%{name}
51aaa4
%license LICENSE
51aaa4
%doc %{_mandir}/man1/scapy.1*
51aaa4
%{_bindir}/scapy
51aaa4
%{_bindir}/UTscapy
51aaa4
%{_bindir}/scapy3
51aaa4
%{_bindir}/UTscapy3
51aaa4
%{python3_sitelib}/scapy/
51aaa4
%{python3_sitelib}/scapy-*.egg-info
51aaa4
%endif
51aaa4
51aaa4
51aaa4
%if 0%{?with_doc}
51aaa4
%files doc
51aaa4
%doc doc/scapy/_build_doc/html
51aaa4
%endif
51aaa4
51aaa4
51aaa4
%changelog
51aaa4
* Tue Aug 10 2021 Mohan Boddu <mboddu@redhat.com> - 2.4.4-5
51aaa4
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
51aaa4
  Related: rhbz#1991688
51aaa4
51aaa4
* Fri Jul 23 2021 Andrea Claudi <aclaudi@redhat.com> - [2.4.4-4.el9]
51aaa4
- Don't build scapy-doc package on rhel (Andrea Claudi) [1973720]
51aaa4
- Enable gating test on RHEL9 (Jianwen Ji) [1974642]
51aaa4
51aaa4
* Mon May 31 2021 Miro Hrončok <mhroncok@redhat.com> - 2.4.4-3
51aaa4
- Drop build dependency on tox
51aaa4
- Resolves: rhbz#1956399
51aaa4
51aaa4
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.4.4-2
51aaa4
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
51aaa4
51aaa4
* Fri Mar 12 2021 Michal Ambroz <rebus _AT seznam.cz> - 2.4.4-1
51aaa4
- bump to 2.4.4 release
51aaa4
51aaa4
* Thu Mar 11 2021 W. Michael Petullo <mike@flyn.org> - 2.4.3-8
51aaa4
- Patch to fix loading libc.a; see https://bugs.python.org/issue42580
51aaa4
51aaa4
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.3-7
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
51aaa4
51aaa4
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.3-6
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
51aaa4
51aaa4
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 2.4.3-5
51aaa4
- Rebuilt for Python 3.9
51aaa4
51aaa4
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.3-4
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
51aaa4
51aaa4
* Fri Nov 08 2019 Michal Ambroz <rebus _AT seznam.cz> - 2.4.3-3
51aaa4
- remove colliding manpage from python2 package
51aaa4
- add license files
51aaa4
- add doc subpackage
51aaa4
- remove shebangs
51aaa4
51aaa4
* Sun Oct 06 2019 Michal Ambroz <rebus _AT seznam.cz> - 2.4.3-2
51aaa4
- change to recommended python build dependencies for EPEL7 - thanks Miro Hroncok
51aaa4
51aaa4
* Thu Sep 26 2019 Michal Ambroz <rebus _AT seznam.cz> - 2.4.3-1
51aaa4
- bump to 2.4.3 release
51aaa4
- change the python2 to conditional build to be able to keep one spec for all
51aaa4
- add Recommends for dependencies, except for EPEL7
51aaa4
51aaa4
* Fri Sep 20 2019 Miro Hrončok <mhroncok@redhat.com> - 2.4.0-8
51aaa4
- Subpackage python2-scapy has been removed
51aaa4
  See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
51aaa4
51aaa4
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 2.4.0-7
51aaa4
- Rebuilt for Python 3.8
51aaa4
51aaa4
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-6
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
51aaa4
51aaa4
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-5
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
51aaa4
51aaa4
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-4
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
51aaa4
51aaa4
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.4.0-3
51aaa4
- Rebuilt for Python 3.7
51aaa4
51aaa4
* Mon Apr 30 2018 Michal Ambroz <rebus _AT seznam.cz> - 2.4.0-2
51aaa4
- disable the test for now - there is too many failing (network) tests
51aaa4
51aaa4
* Mon Apr 30 2018 Michal Ambroz <rebus _AT seznam.cz> - 2.4.0-1
51aaa4
- bump to 2.4.0 release
51aaa4
51aaa4
* Fri Mar 9 2018 Michal Ambroz <rebus _AT seznam.cz> - 2.4.0-0.rc5.1
51aaa4
- bump to upstream 2.4.0 release candidate 5
51aaa4
- enable separate python3 and python2 build
51aaa4
51aaa4
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.3-4
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
51aaa4
51aaa4
* Wed Jan 31 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.3.3-3
51aaa4
- Update Python 2 dependency declarations to new packaging standards
51aaa4
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
51aaa4
51aaa4
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.3-2
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
51aaa4
51aaa4
* Tue May 23 2017 Michal Ambroz <rebus _AT seznam.cz> - 2.3.3-1
51aaa4
- bump to upstream 2.3.3
51aaa4
51aaa4
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.1-4
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
51aaa4
51aaa4
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.3.1-3
51aaa4
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
51aaa4
51aaa4
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.3.1-2
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
51aaa4
51aaa4
* Sat Dec 26 2015 Sven Lankes <athmane@fedoraproject.org> - 2.3.1-1
51aaa4
- update to latest upstream release (2.3.1)
51aaa4
- Update to 2.3.1
51aaa4
- Remove upstreamed patch
51aaa4
- Some spec fixes
51aaa4
- Thanks to Athmane Madjoudj for the patch
51aaa4
51aaa4
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.0-6
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
51aaa4
51aaa4
* Thu Oct 02 2014 Lubomir Rintel <lkundrak@v3.sk> - 2.2.0-5
51aaa4
- Fix psdump()/pdfdump()
51aaa4
51aaa4
* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.0-4
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
51aaa4
51aaa4
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.0-3
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
51aaa4
51aaa4
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.0-2
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
51aaa4
51aaa4
* Sun Jul 22 2012 Sven Lankes <sven@lank.es> - 2.2.0-1
51aaa4
- Update to Scapy 2.2.0
51aaa4
- Fixes rhbz #788659 - thanks to Thiébaud Weksteen
51aaa4
51aaa4
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0.10-7
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
51aaa4
51aaa4
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0.10-6
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
51aaa4
51aaa4
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0.10-5
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
51aaa4
51aaa4
* Thu Jul 22 2010 David Malcolm <dmalcolm@redhat.com> - 2.0.0.10-4
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild
51aaa4
51aaa4
* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0.10-3
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
51aaa4
51aaa4
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0.10-2
51aaa4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
51aaa4
51aaa4
* Mon Dec 22 2008 Devan Goodwin <dgoodwin@dangerouslyinc.com> 2.0.0.10-1
51aaa4
- Update to Scapy 2.0.0.10.
51aaa4
51aaa4
* Sun Dec 07 2008 Devan Goodwin <dgoodwin@dangerouslyinc.com> 2.0.0.9-2
51aaa4
- Update for Scapy 2.0.0.9.
51aaa4
51aaa4
* Tue Jan 22 2008 Devan Goodwin <dgoodwin@dangerouslyinc.com> 1.1.1-4
51aaa4
- Switch to using rm macro.
51aaa4
51aaa4
* Mon Jan 21 2008 Devan Goodwin <dgoodwin@dangerouslyinc.com> 1.1.1-2
51aaa4
- Spec file cleanup.
51aaa4
51aaa4
* Fri Jan 18 2008 Devan Goodwin <dgoodwin@dangerouslyinc.com> 1.1.1-1
51aaa4
- Initial packaging for Fedora.
51aaa4