- remove colliding manpage from python2 package
- add license files - add doc subpackage - remove shebangs
This commit is contained in:
parent
eafb5d0e5c
commit
0b2bf2c344
125
scapy.spec
125
scapy.spec
@ -1,6 +1,6 @@
|
||||
Name: scapy
|
||||
Version: 2.4.3
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: Interactive packet manipulation tool and network scanner
|
||||
|
||||
%global gituser secdev
|
||||
@ -12,19 +12,25 @@ License: GPLv2
|
||||
URL: http://www.secdev.org/projects/scapy/
|
||||
# https://github.com/secdev/scapy/releases
|
||||
# https://bitbucket.org/secdev/scapy/pull-request/80
|
||||
# https://scapy.readthedocs.io/en/latest/introduction.html
|
||||
Source0: https://github.com/%{gituser}/%{gitname}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
||||
Patch0: scapy-2.4.3-ethertypes.patch
|
||||
Patch0: https://github.com/secdev/scapy/commit/0c3d5e417bbd923c4729d15572c3d693d58aff81.patch#/scapy-2.4.3-ethertypes.patch
|
||||
|
||||
%global common_desc \
|
||||
Scapy is a powerful interactive packet manipulation program built on top\
|
||||
of the Python interpreter. It can be used to forge or decode packets of\
|
||||
a wide number of protocols, send them over the wire, capture them, match\
|
||||
requests and replies, and much more.\
|
||||
%global common_desc %{expand:
|
||||
Scapy is a powerful interactive packet manipulation program built on top
|
||||
of the Python interpreter. It can be used to forge or decode packets of
|
||||
a wide number of protocols, send them over the wire, capture them, match
|
||||
requests and replies, and much more.}
|
||||
|
||||
%bcond_with python2
|
||||
# Build also the python2 package
|
||||
%if %{with python2} || (0%{?fedora} && 0%{?fedora} <= 31 ) || ( 0%{?rhel} && 0%{?rhel} <= 8 )
|
||||
%global with_python2 1
|
||||
|
||||
# By default build with python3 subpackage
|
||||
%bcond_without python3
|
||||
|
||||
# Build also the python2 package on releases up to fc31 and rhel8
|
||||
%if (0%{?fedora} && 0%{?fedora} <= 31 ) || ( 0%{?rhel} && 0%{?rhel} <= 8 )
|
||||
%bcond_without python2
|
||||
%else
|
||||
%bcond_with python2
|
||||
%endif
|
||||
|
||||
|
||||
@ -35,19 +41,21 @@ BuildRequires: sed
|
||||
%if 0%{?with_python2}
|
||||
BuildRequires: python2-devel
|
||||
BuildRequires: python2-setuptools
|
||||
%endif # if with_python2
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
BuildRequires: python%{python3_pkgversion}-devel
|
||||
BuildRequires: python%{python3_pkgversion}-setuptools
|
||||
%endif
|
||||
|
||||
# Recommends only supported on fedora and rhel8+
|
||||
%if (0%{?fedora}) || ( 0%{?rhel} && 0%{?rhel} >= 8 )
|
||||
Recommends: tcpdump
|
||||
# Using database of manufactures /usr/share/wireshark/manuf
|
||||
Recommends: wireshark-cli
|
||||
%endif # Recommends
|
||||
%endif
|
||||
|
||||
%description
|
||||
%{common_desc}
|
||||
%description %{common_desc}
|
||||
|
||||
%if 0%{?with_python2}
|
||||
%package -n python2-%{name}
|
||||
@ -59,15 +67,15 @@ Summary: Interactive packet manipulation tool and network scanner
|
||||
Recommends: python2-pyx
|
||||
Recommends: python2-matplotlib
|
||||
Recommends: ipython2
|
||||
%endif # Recommends
|
||||
%endif
|
||||
|
||||
%description -n python2-%{name}
|
||||
%{common_desc}
|
||||
|
||||
%endif # if with_python2
|
||||
|
||||
%endif
|
||||
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%package -n python%{python3_pkgversion}-%{name}
|
||||
Summary: Interactive packet manipulation tool and network scanner
|
||||
|
||||
@ -78,23 +86,51 @@ Provides: %{name} = %{version}-%{release}
|
||||
Recommends: PyX
|
||||
Recommends: python%{python3_pkgversion}-matplotlib
|
||||
Recommends: ipython3
|
||||
%endif # Recommends
|
||||
%endif
|
||||
|
||||
%description -n python%{python3_pkgversion}-%{name}
|
||||
%{common_desc}
|
||||
%endif
|
||||
|
||||
%package doc
|
||||
Summary: Interactive packet manipulation tool and network scanner
|
||||
|
||||
BuildRequires: /usr/bin/sphinx-build
|
||||
|
||||
%description doc
|
||||
%{common_desc}
|
||||
|
||||
|
||||
|
||||
%prep
|
||||
%autosetup -p 1 -n %{name}-%{version}
|
||||
|
||||
# Remove shebang
|
||||
# https://github.com/secdev/scapy/pull/2332
|
||||
SHEBANGS=$(find ./scapy -name '*.py' -print | xargs grep -l -e '^#!.*env python')
|
||||
for FILE in $SHEBANGS ; do
|
||||
sed -i.orig -e 1d "${FILE}"
|
||||
touch -r "${FILE}.orig" "${FILE}"
|
||||
rm "${FILE}.orig"
|
||||
done
|
||||
|
||||
|
||||
|
||||
%build
|
||||
%if 0%{?with_python2}
|
||||
%py2_build
|
||||
%endif # if with_python2
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%py3_build
|
||||
%endif
|
||||
|
||||
pushd doc/scapy
|
||||
make html
|
||||
popd
|
||||
|
||||
rm -f doc/scapy/_build/html/.buildinfo
|
||||
rm -f doc/scapy/_build/html/_static/_dummy
|
||||
|
||||
|
||||
|
||||
@ -106,34 +142,22 @@ install -Dp -m0644 doc/scapy.1* %{buildroot}%{_mandir}/man1/
|
||||
%py2_install
|
||||
rm -f %{buildroot}%{python2_sitelib}/*egg-info/requires.txt
|
||||
|
||||
# Remove shebang
|
||||
for FILE in %{buildroot}%{python2_sitelib}/scapy/contrib/*.py \
|
||||
%{buildroot}%{python2_sitelib}/scapy/pipetool.py \
|
||||
%{buildroot}%{python2_sitelib}/scapy/layers/inet6.py \
|
||||
%{buildroot}%{python2_sitelib}/scapy/tools/check_asdis.py; do
|
||||
sed -i.orig -e 1d "${FILE}"
|
||||
touch -r "${FILE}.orig" "${FILE}"
|
||||
rm "${FILE}.orig"
|
||||
done
|
||||
|
||||
# Rename the executables
|
||||
mv -f %{buildroot}%{_bindir}/scapy %{buildroot}%{_bindir}/scapy2
|
||||
mv -f %{buildroot}%{_bindir}/UTscapy %{buildroot}%{_bindir}/UTscapy2
|
||||
%endif # if with_python2
|
||||
|
||||
%if ! 0%{?with_python3}
|
||||
# Link the default to the py2 version of executables if py3 not built
|
||||
ln -s %{_bindir}/scapy2 %{buildroot}%{_bindir}/scapy
|
||||
ln -s %{_bindir}/UTscapy2 %{buildroot}%{_bindir}/UTscapy
|
||||
%endif
|
||||
%endif
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%py3_install
|
||||
rm -f %{buildroot}%{python3_sitelib}/*egg-info/requires.txt
|
||||
|
||||
# Remove shebang
|
||||
for FILE in %{buildroot}%{python3_sitelib}/scapy/contrib/*.py \
|
||||
%{buildroot}%{python3_sitelib}/scapy/pipetool.py \
|
||||
%{buildroot}%{python3_sitelib}/scapy/layers/inet6.py \
|
||||
%{buildroot}%{python3_sitelib}/scapy/tools/check_asdis.py; do
|
||||
sed -i.orig -e 1d "${FILE}"
|
||||
touch -r "${FILE}.orig" "${FILE}"
|
||||
rm "${FILE}.orig"
|
||||
done
|
||||
|
||||
# Rename the executables
|
||||
mv -f %{buildroot}%{_bindir}/scapy %{buildroot}%{_bindir}/scapy3
|
||||
mv -f %{buildroot}%{_bindir}/UTscapy %{buildroot}%{_bindir}/UTscapy3
|
||||
@ -141,6 +165,7 @@ mv -f %{buildroot}%{_bindir}/UTscapy %{buildroot}%{_bindir}/UTscapy3
|
||||
# Link the default to the python3 version of executables
|
||||
ln -s %{_bindir}/scapy3 %{buildroot}%{_bindir}/scapy
|
||||
ln -s %{_bindir}/UTscapy3 %{buildroot}%{_bindir}/UTscapy
|
||||
%endif
|
||||
|
||||
|
||||
|
||||
@ -151,17 +176,26 @@ ln -s %{_bindir}/UTscapy3 %{buildroot}%{_bindir}/UTscapy
|
||||
# ./run_tests_py3 || true
|
||||
|
||||
|
||||
|
||||
%if 0%{?with_python2}
|
||||
%files -n python2-%{name}
|
||||
%license LICENSE
|
||||
%if ! 0%{?with_python3}
|
||||
%doc %{_mandir}/man1/scapy.1*
|
||||
%{_bindir}/scapy
|
||||
%{_bindir}/UTscapy
|
||||
%endif
|
||||
%{_bindir}/scapy2
|
||||
%{_bindir}/UTscapy2
|
||||
%{python2_sitelib}/scapy/
|
||||
%{python2_sitelib}/scapy-*.egg-info
|
||||
%endif # if with_python2
|
||||
%endif
|
||||
|
||||
|
||||
|
||||
%if 0%{?with_python3}
|
||||
%files -n python%{python3_pkgversion}-%{name}
|
||||
%license LICENSE
|
||||
%doc %{_mandir}/man1/scapy.1*
|
||||
%{_bindir}/scapy
|
||||
%{_bindir}/UTscapy
|
||||
@ -169,10 +203,19 @@ ln -s %{_bindir}/UTscapy3 %{buildroot}%{_bindir}/UTscapy
|
||||
%{_bindir}/UTscapy3
|
||||
%{python3_sitelib}/scapy/
|
||||
%{python3_sitelib}/scapy-*.egg-info
|
||||
%endif
|
||||
|
||||
|
||||
%files doc
|
||||
%doc doc/scapy/_build/html
|
||||
|
||||
%changelog
|
||||
* Fri Nov 08 2019 Michal Ambroz <rebus _AT seznam.cz> - 2.4.3-3
|
||||
- remove colliding manpage from python2 package
|
||||
- add license files
|
||||
- add doc subpackage
|
||||
- remove shebangs
|
||||
|
||||
* Sun Oct 06 2019 Michal Ambroz <rebus _AT seznam.cz> - 2.4.3-2
|
||||
- change to recommended python build dependencies for EPEL7 - thanks Miro Hroncok
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user