%global srcname yara %global gituser VirusTotal %global gitname %{srcname}-python # Release 3.7.0 - 2017-11-10 %global commit 71138553e7cfe7f96e7822898dd8331f3eacef4e %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.7.0 Release: 1%{?dist} Summary: Python binding for the YARA pattern matching tool Group: Development/Libraries License: ASL 2.0 # http://VirusTotal.github.io/yara/ URL: http://github.com/VirusTotal/yara-python/ #Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz Source0: https://github.com/%{gituser}/%{gitname}/archive/v%{version}.tar.gz#/%{name}-%{version}.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}} # Provide also the upstream original name yara-python %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} %autosetup -n %{gitname}-%{version} %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 # ============================================================================== #python2 EXCLUDE="" # Test for python-2.7 fails on testModuleData testcase on arm platform %ifarch %{arm} EXCLUDE='--exclude=^testModuleData$' %endif # Yara is not prepared to run on s390 - more tests failing on s390 # http://s390.koji.fedoraproject.org/kojifiles/work/tasks/9135/2399135/build.log # https://github.com/VirusTotal/yara-python/issues/25 # 3.6.3 - testCompileFile started failing - https://kojipkgs.fedoraproject.org//work/tasks/9619/20589619/build.log # https://github.com/VirusTotal/yara-python/issues/54 %ifarch s390 s390x %{power64} EXCLUDE='--exclude=^testModuleData$|^testEntrypoint$|^testIn$|^testIntegerFunctions$|^testCompileFile$' %endif # Find the NOSETEST binary or use false if not present NOSETESTS2=`ls /usr/bin/nosetests-2.* || ls /usr/bin/nosetests || which false ` PYTHONPATH=%{buildroot}/%{python2_sitearch}/ "$NOSETESTS2" -v "$EXCLUDE" # Run potentially ignored tests separately so we can at least see the results PYTHONPATH=%{buildroot}/%{python2_sitearch}/ "$NOSETESTS2" -v ./tests.py:TestYara.testModuleData \ ./tests.py:TestYara.testEntrypoint ./tests.py:TestYara.testIn ./tests.py:TestYara.testIntegerFunctions || true # ============================================================================== # 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} EXCLUDE='--exclude=^testCompare$|^testModuleData$' # Yara is not prepared to run on s390 - more tests failing on s390 # http://s390.koji.fedoraproject.org/kojifiles/work/tasks/9135/2399135/build.log # https://github.com/VirusTotal/yara-python/issues/25 # 3.6.3 - testCompileFile started failing - https://kojipkgs.fedoraproject.org//work/tasks/9619/20589619/build.log # https://github.com/VirusTotal/yara-python/issues/54 %ifarch s390 s390x %{power64} EXCLUDE='--exclude=^testCompare$|^testModuleData$|^testEntrypoint$|^testIn$|^testIntegerFunctions$|^testCompileFile$' %endif # Find the NOSETEST binary or use false if not present NOSETESTS3=`ls /usr/bin/nosetests-3.* || which false ` PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v "$EXCLUDE" # Run potentially ignored tests separately so we can at least see the results PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v ./tests.py:TestYara.testCompare \ ./tests.py:TestYara.testModuleData ./tests.py:TestYara.testEntrypoint \ ./tests.py:TestYara.testIn ./tests.py:TestYara.testIntegerFunctions || 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 * Wed Nov 15 2017 Michal Ambroz - 3.7.0-1 - bump to yara 3.7.0 release version (#1511921) * Thu Aug 03 2017 Fedora Release Engineering - 3.6.3-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild * Thu Jul 27 2017 Fedora Release Engineering - 3.6.3-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild * Mon Jul 17 2017 Michal Ambroz - 3.6.3-2 - fix bogus dates in the changelog - omit failing testCompileFile test for s390/ppc64 * Mon Jul 17 2017 Michal Ambroz - 3.6.3-1 - bump to upstream 3.6.3 release version * Sat Feb 11 2017 Fedora Release Engineering - 3.5.0-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild * Mon Dec 19 2016 Miro Hrončok - 3.5.0-9 - Rebuild for Python 3.6 * Wed Nov 23 2016 Dan Horák - 3.5.0-8 - fix the arch lists * Tue Aug 16 2016 Michal Ambroz - 3.5.0-7 - adding test exclusions also for armv7hl and ppc64le * Tue Aug 16 2016 Michal Ambroz - 3.5.0-6 - additionally testEntrypoint testIn testIntegerFunctions failing on s390/ppc64 - exclude those tests for build of s390/ppc64 * Tue Aug 16 2016 Michal Ambroz - 3.5.0-5 - testModuleData is failing on arm platform even for python 2.7 - exclude this test for build of arm * Fri Aug 12 2016 Michal Ambroz - 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 - 3.5.0-3 - change python3 naming to allow epel7 python34 packages * Thu Aug 04 2016 Michal Ambroz - 3.5.0-2 - cosmetics * Thu Aug 04 2016 Michal Ambroz - 3.5.0-1 - with yara 3.5.0 the python yara binding is separate library