Michal Ambroz c70147
Name:           python-yara
rpmbuild 394453
Version:        4.0.2
d392bb
%global         baserelease     2
Michal Ambroz c70147
Summary:        Python binding for the YARA pattern matching tool
Michal Ambroz c70147
License:        ASL 2.0
Michal Ambroz c70147
URL:            http://github.com/VirusTotal/yara-python/
Michal Ambroz c70147
#               http://VirusTotal.github.io/yara/
Michal Ambroz 756bb1
#               https://github.com/VirusTotal/yara-python/releases
Michal Ambroz c70147
5c2f4e
%global         srcname         yara
5c2f4e
%global         gituser         VirusTotal
5c2f4e
%global         gitname         %{srcname}-python
rpmbuild 926f10
%global         commit          63ac2417a918692be6d5bd659fbfd39564396ec3
rpmbuild 926f10
%global         gitdate         20190222
5c2f4e
%global         shortcommit     %(c=%{commit}; echo ${c:0:7})
5c2f4e
rpmbuild c1ce4c
rpmbuild c1ce4c
%global         common_description %{expand:
rpmbuild c1ce4c
Python binding for the YARA pattern matching tool.
rpmbuild c1ce4c
YARA is a tool aimed at (but not limited to) helping malware researchers to
rpmbuild c1ce4c
identify and classify malware samples. With YARA you can create descriptions
rpmbuild c1ce4c
of malware families (or whatever you want to describe) based on textual or
rpmbuild c1ce4c
binary patterns. Each description, a.k.a rule, consists of a set of strings
rpmbuild c1ce4c
and a Boolean expression which determine its logic.}
rpmbuild c1ce4c
rpmbuild c1ce4c
# Do the check during build
5c2f4e
%if 0%{?fedora} || ( 0%{?rhel} && 0%{?rhel} >= 7 )
Michal Ambroz 29b527
%global         with_check      1
5c2f4e
%endif
5c2f4e
rpmbuild c1ce4c
%if ( 0%{?fedora} && 0%{?fedora} >= 30 ) || ( 0%{?rhel} && 0%{?rhel} >= 8 )
rpmbuild c1ce4c
                # by default build without the python2 support on systems f30+ or rhel8+
rpmbuild c1ce4c
%bcond_with     python2 
rpmbuild c1ce4c
%else
rpmbuild c1ce4c
                # build with the python2 support on system up to f29 and/or rhel7
rpmbuild c1ce4c
%bcond_without  python2 
rpmbuild c1ce4c
%endif
rpmbuild c1ce4c
rpmbuild c1ce4c
rpmbuild 9d2e23
# Build source is versioned github release=1 or unversioned git commit=0
Michal Ambroz c70147
%global         build_release    1
5c2f4e
Michal Ambroz c70147
%if 0%{?build_release}  > 0
rpmbuild 9d2e23
Release:        %{baserelease}%{?dist}
8aeabc
Source0:        https://github.com/%{gituser}/%{gitname}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Michal Ambroz c70147
%else
rpmbuild 9d2e23
Release:        %{baserelease}.%{gitdate}git%{shortcommit}%{?dist}
Michal Ambroz c70147
Source0:        https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
rpmbuild 17939b
%endif
5c2f4e
5c2f4e
BuildRequires:  gcc
5c2f4e
BuildRequires:  pkgconfig(yara)
5c2f4e
BuildRequires:  libtool
rpmbuild c1ce4c
BuildRequires:  yara-devel >= %{version}
Michal Ambroz c70147
# html doc generation
rpmbuild 39fc62
BuildRequires:  /usr/bin/sphinx-build
5c2f4e
5c2f4e
BuildRequires:  python%{python3_pkgversion}-devel
5c2f4e
BuildRequires:  python%{python3_pkgversion}-nose
5c2f4e
BuildRequires:  python%{python3_pkgversion}-setuptools
5c2f4e
5c2f4e
rpmbuild c1ce4c
%if 0%{?with_python2}  > 0
rpmbuild c1ce4c
BuildRequires:  python2
rpmbuild c1ce4c
BuildRequires:  python2-devel
rpmbuild c1ce4c
BuildRequires:  python2-setuptools
rpmbuild c1ce4c
%endif
rpmbuild c1ce4c
5c2f4e
5c2f4e
%description
rpmbuild c1ce4c
%{common_description}
5c2f4e
5c2f4e
5c2f4e
Michal Ambroz c70147
#====================================================================
5c2f4e
%package -n python%{python3_pkgversion}-%{srcname}
5c2f4e
Summary:        Python3 binding for the YARA pattern matching tool
5c2f4e
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
5c2f4e
5c2f4e
5c2f4e
5c2f4e
%description -n python%{python3_pkgversion}-%{srcname}
rpmbuild c1ce4c
%{common_description}
5c2f4e
rpmbuild c1ce4c
%if 0%{?with_python2}  > 0
rpmbuild c1ce4c
%package -n python2-%{srcname}
rpmbuild c1ce4c
Summary:        Python2 binding for the YARA pattern matching tool
rpmbuild c1ce4c
%{?python_provide:%python_provide python2-%{srcname}}
rpmbuild c1ce4c
rpmbuild c1ce4c
rpmbuild c1ce4c
%description -n python2-%{srcname}
rpmbuild c1ce4c
%{common_description}
rpmbuild c1ce4c
%endif
Michal Ambroz c70147
Michal Ambroz c70147
#====================================================================
5c2f4e
%prep
Michal Ambroz c70147
%if 0%{?build_release} > 0
Michal Ambroz c70147
# Build from git release version
8aeabc
%autosetup -n %{gitname}-%{version}
5c2f4e
Michal Ambroz c70147
%else
Michal Ambroz c70147
# Build from git commit
Michal Ambroz c70147
%autosetup -n %{gitname}-%{commit}
rpmbuild 17939b
%endif
5c2f4e
Michal Ambroz c70147
Michal Ambroz c70147
Michal Ambroz c70147
#====================================================================
5c2f4e
%build
rpmbuild c1ce4c
%if 0%{?with_python2}  > 0
rpmbuild c1ce4c
%py2_build "--dynamic-linking"
rpmbuild c1ce4c
%endif
rpmbuild c1ce4c
5c2f4e
%py3_build "--dynamic-linking"
5c2f4e
5c2f4e
5c2f4e
Michal Ambroz c70147
#====================================================================
5c2f4e
%install
rpmbuild c1ce4c
%if 0%{?with_python2}  > 0
rpmbuild c1ce4c
%py2_install
rpmbuild c1ce4c
%endif
rpmbuild c1ce4c
5c2f4e
%py3_install
5c2f4e
5c2f4e
Michal Ambroz c70147
#====================================================================
5c2f4e
%check
Michal Ambroz 29b527
%if 0%{?with_check}
h3x2b ec5538
# ==============================================================================
rpmbuild 926f10
# Tests for python3 used to always fail on testModuleData testcase
rpmbuild 926f10
# Tests for python3 used to randomly fail on testCompare testcase
rpmbuild 926f10
# reported to upstream - https://github.com/VirusTotal/yara-python/issues/21
Michal Ambroz 2f45b0
# temporarily run the failing tests but ignore the results for those 2
rpmbuild 926f10
# EXCLUDE='--exclude=^testCompare$|^testModuleData$'
rpmbuild 09ce81
# seems to be fixed in 3.9.0
rpmbuild 926f10
EXCLUDE='--exclude=^nothing$'
h3x2b ec5538
Michal Ambroz 6e8f36
# Yara is not prepared to run on s390 - more tests failing on s390
Michal Ambroz 6e8f36
#         http://s390.koji.fedoraproject.org/kojifiles/work/tasks/9135/2399135/build.log
Michal Ambroz 6e8f36
#         https://github.com/VirusTotal/yara-python/issues/25
Michal Ambroz 6e8f36
# 3.6.3 - testCompileFile started failing - https://kojipkgs.fedoraproject.org//work/tasks/9619/20589619/build.log
Michal Ambroz 6e8f36
#         https://github.com/VirusTotal/yara-python/issues/54
rpmbuild 09ce81
# seems to be fixed in 3.9.0
rpmbuild a8a00a
%ifarch s390 s390x %{power64}
rpmbuild 09ce81
# EXCLUDE='--exclude=^testCompare$|^testModuleData$|^testEntrypoint$|^testIn$|^testIntegerFunctions$|^testCompileFile$'
rpmbuild 09ce81
EXCLUDE='--exclude=^nothing$'
rpmbuild 09ce81
%endif
rpmbuild 09ce81
rpmbuild 09ce81
# 3.9.0 - testModuleData is always failing for architecture armv7hl
rpmbuild 09ce81
%ifarch armv7hl
rpmbuild 09ce81
EXCLUDE='--exclude=^testModuleData$'
h3x2b ec5538
%endif
h3x2b ec5538
rpmbuild 09ce81
Michal Ambroz 2f45b0
# Find the NOSETEST binary or use false if not present
5c2f4e
NOSETESTS3=`ls /usr/bin/nosetests-3.* || which false `
h3x2b ec5538
PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v "$EXCLUDE"
h3x2b ec5538
Michal Ambroz 2f45b0
# Run potentially ignored tests separately so we can at least see the results
h3x2b ec5538
PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v ./tests.py:TestYara.testCompare \
h3x2b ec5538
    ./tests.py:TestYara.testModuleData ./tests.py:TestYara.testEntrypoint \
rpmbuild 09ce81
    ./tests.py:TestYara.testIn ./tests.py:TestYara.testIntegerFunctions  \
rpmbuild 09ce81
    ./tests.py:TestYara.testCompileFile || true
5c2f4e
rpmbuild 17939b
# with_check
rpmbuild 17939b
%endif
5c2f4e
Michal Ambroz c70147
Michal Ambroz c70147
#====================================================================
5c2f4e
%files -n python%{python3_pkgversion}-%{srcname}
5c2f4e
%license LICENSE
5c2f4e
%doc README.rst
5c2f4e
%{python3_sitearch}/%{srcname}*
5c2f4e
rpmbuild c1ce4c
%if 0%{?with_python2}  > 0
rpmbuild c1ce4c
%files -n python2-%{srcname}
rpmbuild c1ce4c
%license LICENSE
rpmbuild c1ce4c
%doc README.rst
rpmbuild c1ce4c
%{python2_sitearch}/%{srcname}*
rpmbuild c1ce4c
%endif
Michal Ambroz c70147
Michal Ambroz c70147
#====================================================================
5c2f4e
%changelog
d392bb
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.2-2
d392bb
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
d392bb
rpmbuild 394453
* Thu Jul 16 2020 Michal Ambroz <rebus at, seznam.cz> - 4.0.2-1
rpmbuild 394453
- bump to version 4.0.2
rpmbuild 394453
rpmbuild e7a73a
* Fri Jun 06 2020 Michal Ambroz <rebus at, seznam.cz> - 4.0.1-1
rpmbuild e7a73a
- bump to version 4.0.1
rpmbuild e7a73a
63f4bc
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 4.0.0-2
63f4bc
- Rebuilt for Python 3.9
63f4bc
rpmbuild 17939b
* Tue May 12 2020 Michal Ambroz <rebus at, seznam.cz> - 4.0.0-1
rpmbuild 17939b
- bump to version 4.0.0
rpmbuild 17939b
72b147
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.11.0-3
72b147
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
72b147
rpmbuild 9d2e23
* Mon Oct 14 2019 Michal Ambroz <rebus at, seznam.cz> - 3.11.0-2
rpmbuild 9d2e23
- fix the release number
rpmbuild 9d2e23
rpmbuild c1ce4c
* Mon Oct 14 2019 Michal Ambroz <rebus at, seznam.cz> - 3.11.0-1
rpmbuild c1ce4c
- bump to 3.11.0, omit py2 for f30+ and epel8+
rpmbuild c1ce4c
d8f085
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.9.0-2.2
d8f085
- Rebuilt for Python 3.8
d8f085
e57d76
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.9.0-2.1
e57d76
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
e57d76
rpmbuild 39fc62
* Fri Mar 22 2019 Michal Ambroz <rebus at, seznam.cz> - 3.9.0-2
rpmbuild 39fc62
- change dependency to sphinx based on the /usr/bin/sphinx-build
rpmbuild 39fc62
rpmbuild 926f10
* Mon Mar 18 2019 Michal Ambroz <rebus at, seznam.cz> - 3.9.0-1
rpmbuild 926f10
- bump to 3.9.0
rpmbuild 926f10
79c373
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.8.1-3.2
79c373
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
79c373
18f492
* Fri Oct 12 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.8.1-3
18f492
- Python2 binary package has been removed
18f492
  See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
18f492
Michal Ambroz 67dc56
* Mon Aug 27 2018 Michal Ambroz <rebus at, seznam.cz> - 3.8.1-2
Michal Ambroz 67dc56
- rebuild with yara 3.8.1 override
Michal Ambroz 67dc56
Michal Ambroz 756bb1
* Mon Aug 27 2018 Michal Ambroz <rebus at, seznam.cz> - 3.8.1-1
Michal Ambroz 756bb1
- bump to 3.8.1
Michal Ambroz 756bb1
ddc42a
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-7
ddc42a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
ddc42a
6e65c3
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.7.0-6
6e65c3
- Rebuilt for Python 3.7
6e65c3
Michal Ambroz 27fde4
* Fri Mar 16 2018 Michal Ambroz <rebus at, seznam.cz> - 3.7.0-5
Michal Ambroz 29b527
- fix dependencies for building the epel7/epel6 packages
Michal Ambroz 29b527
Michal Ambroz c70147
* Thu Mar 15 2018 Michal Ambroz <rebus at, seznam.cz> - 3.7.0-4
Michal Ambroz c70147
- rebuild with yara 3.7.1 for supported platforms
Michal Ambroz 27fde4
- fix dependencies for building the epel packages
Michal Ambroz c70147
c4912b
* Wed Feb 28 2018 Iryna Shcherbina <ishcherb@redhat.com> - 3.7.0-3
c4912b
- Update Python 2 dependency declarations to new packaging standards
c4912b
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
c4912b
7666c2
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-2
7666c2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
7666c2
Michal Ambroz 2f45b0
* Wed Nov 15 2017 Michal Ambroz <rebus at, seznam.cz> - 3.7.0-1
Michal Ambroz 2f45b0
- bump to yara 3.7.0 release version (#1511921)
Michal Ambroz 2f45b0
92ef00
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.3-4
92ef00
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
92ef00
612613
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.3-3
612613
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
612613
4dee5a
* Mon Jul 17 2017 Michal Ambroz <rebus at, seznam.cz> - 3.6.3-2
4dee5a
- fix bogus dates in the changelog
Michal Ambroz 6e8f36
- omit failing testCompileFile test for s390/ppc64
4dee5a
8aeabc
* Mon Jul 17 2017 Michal Ambroz <rebus at, seznam.cz> - 3.6.3-1
8aeabc
- bump to upstream 3.6.3 release version
8aeabc
fe4c5d
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.0-10
fe4c5d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
fe4c5d
b901d2
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.5.0-9
b901d2
- Rebuild for Python 3.6
b901d2
040dcc
* Wed Nov 23 2016 Dan Horák <dan[at]danny.cz> - 3.5.0-8
040dcc
- fix the arch lists
040dcc
4dee5a
* Tue Aug 16 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-7
rpmbuild f57433
- adding test exclusions also for armv7hl and ppc64le
h3x2b 3afb8f
4dee5a
* Tue Aug 16 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-6
h3x2b ec5538
- additionally testEntrypoint testIn testIntegerFunctions failing on s390/ppc64
h3x2b ec5538
- exclude those tests for build of s390/ppc64
h3x2b ec5538
4dee5a
* Tue Aug 16 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-5
381b1b
- testModuleData is failing on arm platform even for python 2.7
h3x2b ec5538
- exclude this test for build of arm
381b1b
5c2f4e
* Fri Aug 12 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-4
5c2f4e
- remove unnecessary ldconfig
5c2f4e
- count with the python3 test values except the 2 known for failing
5c2f4e
5c2f4e
* Thu Aug 11 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-3
5c2f4e
- change python3 naming to allow epel7 python34 packages
5c2f4e
5c2f4e
* Thu Aug 04 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-2
5c2f4e
- cosmetics
5c2f4e
5c2f4e
* Thu Aug 04 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-1
5c2f4e
- with yara 3.5.0 the python yara binding is separate library