152 lines
5 KiB
RPMSpec
152 lines
5 KiB
RPMSpec
%global srcname yara
|
|
%global gituser VirusTotal
|
|
%global gitname %{srcname}-python
|
|
%global commit 9fd9fd290872e36360e5e3839c49e21a908bf128
|
|
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
|
|
|
%if 0%{?fedora} || ( 0%{?rhel} && 0%{?rhel} >= 7 )
|
|
%global with_python3 1
|
|
%endif
|
|
|
|
%if 0%{?rhel} && 0%{?rhel} <= 6
|
|
%{!?__python2: %global __python2 /usr/bin/python2}
|
|
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
|
|
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
|
|
%endif
|
|
|
|
%if 0%{?fedora} <= 21
|
|
%{!?py2_build: %global py2_build %{__python2} setup.py build --executable="%{__python2} -s"}
|
|
%{!?py2_install: %global py2_install %{__python2} setup.py install -O1 --skip-build --root %{buildroot}}
|
|
%{!?py3_build: %global py3_build %{__python3} setup.py build --executable="%{__python3} -s"}
|
|
%{!?py3_install: %global py3_install %{__python3} setup.py install -O1 --skip-build --root %{buildroot}}
|
|
%endif
|
|
|
|
|
|
Name: python-%{srcname}
|
|
Version: 3.5.0
|
|
Release: 4%{?dist}
|
|
Summary: Python binding for the YARA pattern matching tool
|
|
Group: Development/Libraries
|
|
|
|
License: ASL 2.0
|
|
URL: http://github.com/VirusTotal/yara-python/
|
|
#URL: http://VirusTotal.github.io/yara/
|
|
Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
|
|
|
|
BuildRequires: gcc
|
|
BuildRequires: pkgconfig(yara)
|
|
BuildRequires: libtool
|
|
BuildRequires: yara-devel
|
|
BuildRequires: python2
|
|
BuildRequires: python2-devel
|
|
BuildRequires: python-libs
|
|
BuildRequires: python-nose
|
|
BuildRequires: python-setuptools
|
|
|
|
%if 0%{?with_python3}
|
|
BuildRequires: python%{python3_pkgversion}-devel
|
|
BuildRequires: python%{python3_pkgversion}-libs
|
|
BuildRequires: python%{python3_pkgversion}-nose
|
|
BuildRequires: python%{python3_pkgversion}-setuptools
|
|
%endif # if with_python3
|
|
|
|
#html doc generation
|
|
BuildRequires: python-sphinx
|
|
|
|
|
|
%description
|
|
Python binding for the YARA pattern matching tool.
|
|
YARA is a tool aimed at (but not limited to) helping malware researchers to
|
|
identify and classify malware samples. With YARA you can create descriptions
|
|
of malware families (or whatever you want to describe) based on textual or
|
|
binary patterns. Each description, a.k.a rule, consists of a set of strings
|
|
and a Boolean expression which determine its logic.
|
|
|
|
|
|
|
|
%package -n python2-%{srcname}
|
|
Summary: Python2 binding for the YARA pattern matching tool
|
|
Group: Development/Libraries
|
|
%{?python_provide:%python_provide python2-%{srcname}}
|
|
|
|
%description -n python2-%{srcname}
|
|
YARA for Python2 - This is a Python extension that gives access to YARA's
|
|
powerful features from Python scripts.
|
|
|
|
|
|
|
|
%if 0%{?with_python3}
|
|
%package -n python%{python3_pkgversion}-%{srcname}
|
|
Summary: Python3 binding for the YARA pattern matching tool
|
|
Group: Development/Libraries
|
|
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
|
|
|
|
|
|
|
|
%description -n python%{python3_pkgversion}-%{srcname}
|
|
YARA for Python3 - This is a Python extension that gives access to YARA's
|
|
powerful features from Python scripts.
|
|
%endif # with_python3
|
|
|
|
%prep
|
|
%autosetup -n %{gitname}-%{commit}
|
|
|
|
|
|
%build
|
|
%py2_build "--dynamic-linking"
|
|
|
|
%if 0%{?with_python3}
|
|
%py3_build "--dynamic-linking"
|
|
%endif # with_python3
|
|
|
|
|
|
|
|
%install
|
|
%py2_install
|
|
|
|
%if 0%{?with_python3}
|
|
%py3_install
|
|
%endif # with_python3
|
|
|
|
|
|
%check
|
|
NOSETESTS2=`ls /usr/bin/nosetests-2.* || ls /usr/bin/nosetests || which false `
|
|
PYTHONPATH=%{buildroot}/%{python2_sitearch}/ $NOSETESTS2 -v
|
|
|
|
#Tests for python3 always fail on testModuleData testcase
|
|
#Tests for python3 randomly fail on testCompare testcase
|
|
#reporting to upstream - https://github.com/VirusTotal/yara-python/issues/21
|
|
#temporarily run the failing tests but ignore the results for those 2
|
|
%if 0%{?with_python3}
|
|
NOSETESTS3=`ls /usr/bin/nosetests-3.* || which false `
|
|
PYTHONPATH=%{buildroot}/%{python3_sitearch}/ $NOSETESTS3 -v --exclude="^testCompare$|^testModuleData$"
|
|
PYTHONPATH=%{buildroot}/%{python3_sitearch}/ $NOSETESTS3 -v ./tests.py:TestYara.testCompare ./tests.py:TestYara.testModuleData || true
|
|
%endif # with_python3
|
|
|
|
|
|
%files -n python2-%{srcname}
|
|
%license LICENSE
|
|
%doc README.rst
|
|
%{python2_sitearch}/%{srcname}*
|
|
|
|
%if 0%{?with_python3}
|
|
%files -n python%{python3_pkgversion}-%{srcname}
|
|
%license LICENSE
|
|
%doc README.rst
|
|
%{python3_sitearch}/%{srcname}*
|
|
%endif # with_python3
|
|
|
|
|
|
%changelog
|
|
* Fri Aug 12 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-4
|
|
- remove unnecessary ldconfig
|
|
- count with the python3 test values except the 2 known for failing
|
|
|
|
* Thu Aug 11 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-3
|
|
- change python3 naming to allow epel7 python34 packages
|
|
|
|
* Thu Aug 04 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-2
|
|
- cosmetics
|
|
|
|
* Thu Aug 04 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-1
|
|
- with yara 3.5.0 the python yara binding is separate library
|