diff --git a/python-yara.spec b/python-yara.spec index 26256fd..fca886b 100644 --- a/python-yara.spec +++ b/python-yara.spec @@ -1,14 +1,25 @@ +Name: python-yara +Version: 3.7.0 +Summary: Python binding for the YARA pattern matching tool +Group: Development/Libraries +License: ASL 2.0 +URL: http://github.com/VirusTotal/yara-python/ +# http://VirusTotal.github.io/yara/ + + %global srcname yara %global gituser VirusTotal %global gitname %{srcname}-python -# Release 3.7.0 - 2017-11-10 %global commit 71138553e7cfe7f96e7822898dd8331f3eacef4e +%global gitdate 20171110 %global shortcommit %(c=%{commit}; echo ${c:0:7}) +# Build also the python3 package %if 0%{?fedora} || ( 0%{?rhel} && 0%{?rhel} >= 7 ) -%global with_python3 1 +%global with_python3 1 %endif +# Introduce the python macros on older platforms if needed %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())")} @@ -22,19 +33,16 @@ %{!?py3_install: %global py3_install %{__python3} setup.py install -O1 --skip-build --root %{buildroot}} %endif +# Build source is github release=1 or git commit=0 +%global build_release 1 -Name: python-%{srcname} -Version: 3.7.0 -Release: 3%{?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 +%if 0%{?build_release} > 0 +Release: 4%{?dist} Source0: https://github.com/%{gituser}/%{gitname}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz - +%else +Release: 0.1.%{gitdate}git%{shortcommit}%{?dist} +Source0: https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz +%endif #Build_release BuildRequires: gcc BuildRequires: pkgconfig(yara) @@ -45,6 +53,8 @@ BuildRequires: python2-devel BuildRequires: python2-libs BuildRequires: python2-nose BuildRequires: python2-setuptools +# html doc generation +BuildRequires: python2-sphinx %if 0%{?with_python3} BuildRequires: python%{python3_pkgversion}-devel @@ -53,8 +63,6 @@ BuildRequires: python%{python3_pkgversion}-nose BuildRequires: python%{python3_pkgversion}-setuptools %endif # if with_python3 -# html doc generation -BuildRequires: python2-sphinx %description @@ -67,6 +75,7 @@ and a Boolean expression which determine its logic. +#==================================================================== %package -n python2-%{srcname} Summary: Python2 binding for the YARA pattern matching tool Group: Development/Libraries @@ -93,11 +102,21 @@ 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} +%if 0%{?build_release} > 0 +# Build from git release version %autosetup -n %{gitname}-%{version} +%else +# Build from git commit +%autosetup -n %{gitname}-%{commit} +%endif #build_release + + +#==================================================================== %build %py2_build "--dynamic-linking" @@ -107,6 +126,7 @@ powerful features from Python scripts. +#==================================================================== %install %py2_install @@ -115,8 +135,8 @@ powerful features from Python scripts. %endif # with_python3 +#==================================================================== %check -# ============================================================================== #python2 EXCLUDE="" @@ -170,6 +190,8 @@ PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v ./tests.py:TestYar %endif # with_python3 + +#==================================================================== %files -n python2-%{srcname} %license LICENSE %doc README.rst @@ -183,7 +205,12 @@ PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v ./tests.py:TestYar %endif # with_python3 + +#==================================================================== %changelog +* Thu Mar 15 2018 Michal Ambroz - 3.7.0-4 +- rebuild with yara 3.7.1 for supported platforms + * Wed Feb 28 2018 Iryna Shcherbina - 3.7.0-3 - Update Python 2 dependency declarations to new packaging standards (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)