Michal Ambroz c701474
Name:           python-yara
1d719ef
Version:        4.1.3
e2acea4
%global         baserelease     2
Michal Ambroz c701474
Summary:        Python binding for the YARA pattern matching tool
Michal Ambroz c701474
License:        ASL 2.0
Michal Ambroz c701474
URL:            http://github.com/VirusTotal/yara-python/
f49a31e
VCS:            http://github.com/VirusTotal/yara-python/
Michal Ambroz c701474
#               http://VirusTotal.github.io/yara/
Michal Ambroz 756bb1b
#               https://github.com/VirusTotal/yara-python/releases
Michal Ambroz c701474
f49a31e
# By default build from a release tarball.
f49a31e
# If you want to rebuild from a unversioned commit from git do that with 
f49a31e
# rpmbuild --rebuild python-yara.src.dpm --without release
f49a31e
%bcond_without  release
f49a31e
5c2f4e4
%global         srcname         yara
5c2f4e4
%global         gituser         VirusTotal
5c2f4e4
%global         gitname         %{srcname}-python
f49a31e
%global         commit          dc838e211e45442d219012099aaa63efa812c4be
f49a31e
%global         gitdate         20210427
5c2f4e4
%global         shortcommit     %(c=%{commit}; echo ${c:0:7})
5c2f4e4
rpmbuild c1ce4c2
rpmbuild c1ce4c2
%global         common_description %{expand:
rpmbuild c1ce4c2
Python binding for the YARA pattern matching tool.
rpmbuild c1ce4c2
YARA is a tool aimed at (but not limited to) helping malware researchers to
rpmbuild c1ce4c2
identify and classify malware samples. With YARA you can create descriptions
rpmbuild c1ce4c2
of malware families (or whatever you want to describe) based on textual or
rpmbuild c1ce4c2
binary patterns. Each description, a.k.a rule, consists of a set of strings
rpmbuild c1ce4c2
and a Boolean expression which determine its logic.}
rpmbuild c1ce4c2
rpmbuild c1ce4c2
# Do the check during build
5c2f4e4
%if 0%{?fedora} || ( 0%{?rhel} && 0%{?rhel} >= 7 )
Michal Ambroz 29b5279
%global         with_check      1
5c2f4e4
%endif
5c2f4e4
rpmbuild c1ce4c2
%if ( 0%{?fedora} && 0%{?fedora} >= 30 ) || ( 0%{?rhel} && 0%{?rhel} >= 8 )
rpmbuild c1ce4c2
                # by default build without the python2 support on systems f30+ or rhel8+
f49a31e
%bcond_with     python2
rpmbuild c1ce4c2
%else
rpmbuild c1ce4c2
                # build with the python2 support on system up to f29 and/or rhel7
f49a31e
%bcond_without  python2
rpmbuild c1ce4c2
%endif
rpmbuild c1ce4c2
rpmbuild c1ce4c2
5c2f4e4
f49a31e
%if 0%{?with_release}
rpmbuild 9d2e23c
Release:        %{baserelease}%{?dist}
8aeabca
Source0:        https://github.com/%{gituser}/%{gitname}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Michal Ambroz c701474
%else
rpmbuild 9d2e23c
Release:        %{baserelease}.%{gitdate}git%{shortcommit}%{?dist}
Michal Ambroz c701474
Source0:        https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
rpmbuild 17939ba
%endif
5c2f4e4
5c2f4e4
BuildRequires:  gcc
5c2f4e4
BuildRequires:  pkgconfig(yara)
5c2f4e4
BuildRequires:  libtool
rpmbuild c1ce4c2
BuildRequires:  yara-devel >= %{version}
Michal Ambroz c701474
# html doc generation
rpmbuild 39fc626
BuildRequires:  /usr/bin/sphinx-build
5c2f4e4
5c2f4e4
BuildRequires:  python%{python3_pkgversion}-devel
5c2f4e4
BuildRequires:  python%{python3_pkgversion}-nose
5c2f4e4
BuildRequires:  python%{python3_pkgversion}-setuptools
5c2f4e4
5c2f4e4
rpmbuild c1ce4c2
%if 0%{?with_python2}  > 0
rpmbuild c1ce4c2
BuildRequires:  python2
rpmbuild c1ce4c2
BuildRequires:  python2-devel
rpmbuild c1ce4c2
BuildRequires:  python2-setuptools
rpmbuild c1ce4c2
%endif
rpmbuild c1ce4c2
5c2f4e4
5c2f4e4
%description
rpmbuild c1ce4c2
%{common_description}
5c2f4e4
5c2f4e4
5c2f4e4
Michal Ambroz c701474
#====================================================================
5c2f4e4
%package -n python%{python3_pkgversion}-%{srcname}
5c2f4e4
Summary:        Python3 binding for the YARA pattern matching tool
5c2f4e4
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
5c2f4e4
5c2f4e4
5c2f4e4
5c2f4e4
%description -n python%{python3_pkgversion}-%{srcname}
rpmbuild c1ce4c2
%{common_description}
5c2f4e4
rpmbuild c1ce4c2
%if 0%{?with_python2}  > 0
rpmbuild c1ce4c2
%package -n python2-%{srcname}
rpmbuild c1ce4c2
Summary:        Python2 binding for the YARA pattern matching tool
rpmbuild c1ce4c2
%{?python_provide:%python_provide python2-%{srcname}}
rpmbuild c1ce4c2
rpmbuild c1ce4c2
rpmbuild c1ce4c2
%description -n python2-%{srcname}
rpmbuild c1ce4c2
%{common_description}
rpmbuild c1ce4c2
%endif
Michal Ambroz c701474
Michal Ambroz c701474
#====================================================================
5c2f4e4
%prep
f49a31e
%if 0%{?with_release}
Michal Ambroz c701474
# Build from git release version
8aeabca
%autosetup -n %{gitname}-%{version}
5c2f4e4
Michal Ambroz c701474
%else
Michal Ambroz c701474
# Build from git commit
Michal Ambroz c701474
%autosetup -n %{gitname}-%{commit}
rpmbuild 17939ba
%endif
5c2f4e4
Michal Ambroz c701474
Michal Ambroz c701474
Michal Ambroz c701474
#====================================================================
5c2f4e4
%build
rpmbuild c1ce4c2
%if 0%{?with_python2}  > 0
rpmbuild c1ce4c2
%py2_build "--dynamic-linking"
rpmbuild c1ce4c2
%endif
rpmbuild c1ce4c2
5c2f4e4
%py3_build "--dynamic-linking"
5c2f4e4
5c2f4e4
5c2f4e4
Michal Ambroz c701474
#====================================================================
5c2f4e4
%install
rpmbuild c1ce4c2
%if 0%{?with_python2}  > 0
rpmbuild c1ce4c2
%py2_install
rpmbuild c1ce4c2
%endif
rpmbuild c1ce4c2
5c2f4e4
%py3_install
5c2f4e4
5c2f4e4
Michal Ambroz c701474
#====================================================================
5c2f4e4
%check
Michal Ambroz 29b5279
%if 0%{?with_check}
h3x2b ec55389
# ==============================================================================
rpmbuild 926f10e
# Tests for python3 used to always fail on testModuleData testcase
rpmbuild 926f10e
# Tests for python3 used to randomly fail on testCompare testcase
rpmbuild 926f10e
# reported to upstream - https://github.com/VirusTotal/yara-python/issues/21
Michal Ambroz 2f45b09
# temporarily run the failing tests but ignore the results for those 2
rpmbuild 926f10e
# EXCLUDE='--exclude=^testCompare$|^testModuleData$'
rpmbuild 09ce81e
# seems to be fixed in 3.9.0
rpmbuild 926f10e
EXCLUDE='--exclude=^nothing$'
h3x2b ec55389
Michal Ambroz 6e8f367
# Yara is not prepared to run on s390 - more tests failing on s390
Michal Ambroz 6e8f367
#         http://s390.koji.fedoraproject.org/kojifiles/work/tasks/9135/2399135/build.log
Michal Ambroz 6e8f367
#         https://github.com/VirusTotal/yara-python/issues/25
Michal Ambroz 6e8f367
# 3.6.3 - testCompileFile started failing - https://kojipkgs.fedoraproject.org//work/tasks/9619/20589619/build.log
Michal Ambroz 6e8f367
#         https://github.com/VirusTotal/yara-python/issues/54
rpmbuild 09ce81e
# seems to be fixed in 3.9.0
rpmbuild a8a00a4
%ifarch s390 s390x %{power64}
rpmbuild 09ce81e
# EXCLUDE='--exclude=^testCompare$|^testModuleData$|^testEntrypoint$|^testIn$|^testIntegerFunctions$|^testCompileFile$'
rpmbuild 09ce81e
EXCLUDE='--exclude=^nothing$'
rpmbuild 09ce81e
%endif
rpmbuild 09ce81e
rpmbuild 09ce81e
# 3.9.0 - testModuleData is always failing for architecture armv7hl
rpmbuild 09ce81e
%ifarch armv7hl
rpmbuild 09ce81e
EXCLUDE='--exclude=^testModuleData$'
h3x2b ec55389
%endif
h3x2b ec55389
rpmbuild 09ce81e
Michal Ambroz 2f45b09
# Find the NOSETEST binary or use false if not present
5c2f4e4
NOSETESTS3=`ls /usr/bin/nosetests-3.* || which false `
h3x2b ec55389
PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v "$EXCLUDE"
h3x2b ec55389
Michal Ambroz 2f45b09
# Run potentially ignored tests separately so we can at least see the results
h3x2b ec55389
PYTHONPATH=%{buildroot}/%{python3_sitearch}/ "$NOSETESTS3" -v ./tests.py:TestYara.testCompare \
h3x2b ec55389
    ./tests.py:TestYara.testModuleData ./tests.py:TestYara.testEntrypoint \
rpmbuild 09ce81e
    ./tests.py:TestYara.testIn ./tests.py:TestYara.testIntegerFunctions  \
rpmbuild 09ce81e
    ./tests.py:TestYara.testCompileFile || true
5c2f4e4
rpmbuild 17939ba
# with_check
rpmbuild 17939ba
%endif
5c2f4e4
Michal Ambroz c701474
Michal Ambroz c701474
#====================================================================
5c2f4e4
%files -n python%{python3_pkgversion}-%{srcname}
5c2f4e4
%license LICENSE
5c2f4e4
%doc README.rst
5c2f4e4
%{python3_sitearch}/%{srcname}*
5c2f4e4
rpmbuild c1ce4c2
%if 0%{?with_python2}  > 0
rpmbuild c1ce4c2
%files -n python2-%{srcname}
rpmbuild c1ce4c2
%license LICENSE
rpmbuild c1ce4c2
%doc README.rst
rpmbuild c1ce4c2
%{python2_sitearch}/%{srcname}*
rpmbuild c1ce4c2
%endif
Michal Ambroz c701474
Michal Ambroz c701474
#====================================================================
5c2f4e4
%changelog
e2acea4
* Wed Nov 10 2021 Michal Ambroz <rebus at, seznam.cz> - 4.1.3-2
e2acea4
- rebuild due to koji hickup
e2acea4
1d719ef
* Wed Nov 10 2021 Michal Ambroz <rebus at, seznam.cz> - 4.1.3-1
1d719ef
- bump the python-yara as well to 4.1.3
1d719ef
0a0ef76
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.1.0-3
0a0ef76
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
0a0ef76
4f177f8
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 4.1.0-2
4f177f8
- Rebuilt for Python 3.10
4f177f8
f49a31e
* Tue Apr 27 2021 Michal Ambroz <rebus at, seznam.cz> - 4.1.0-1
f49a31e
- bump the python-yara as well to 4.1.0
f49a31e
0d9f7c2
* Tue Apr 27 2021 Michal Ambroz <rebus at, seznam.cz> - 4.0.5-3
0d9f7c2
- rebuild for new version of yara 4.1.0
0d9f7c2
810d01a
* Sun Apr 25 2021 Michal Ambroz <rebus at, seznam.cz> - 4.0.5-2
810d01a
- rebuild for epel
810d01a
167d7d1
* Sat Mar 13 2021 Michal Ambroz <rebus at, seznam.cz> - 4.0.5-1
167d7d1
- bump to version 4.0.5
167d7d1
8e18fa9
* Wed Feb 10 2021 Michal Ambroz <rebus at, seznam.cz> - 4.0.4-1
8e18fa9
- bump to version 4.0.4
8e18fa9
28dc29b
* Thu Feb 04 2021 Michal Ambroz <rebus at, seznam.cz> - 4.0.3-1
28dc29b
- bump to version 4.0.3
28dc29b
2d0a004
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.2-3
2d0a004
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
2d0a004
d392bbc
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.2-2
d392bbc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
d392bbc
rpmbuild 3944532
* Thu Jul 16 2020 Michal Ambroz <rebus at, seznam.cz> - 4.0.2-1
rpmbuild 3944532
- bump to version 4.0.2
rpmbuild 3944532
6bc4826
* Sat Jun 06 2020 Michal Ambroz <rebus at, seznam.cz> - 4.0.1-1
rpmbuild e7a73a5
- bump to version 4.0.1
rpmbuild e7a73a5
63f4bc6
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 4.0.0-2
63f4bc6
- Rebuilt for Python 3.9
63f4bc6
rpmbuild 17939ba
* Tue May 12 2020 Michal Ambroz <rebus at, seznam.cz> - 4.0.0-1
rpmbuild 17939ba
- bump to version 4.0.0
rpmbuild 17939ba
72b1474
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 3.11.0-3
72b1474
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
72b1474
rpmbuild 9d2e23c
* Mon Oct 14 2019 Michal Ambroz <rebus at, seznam.cz> - 3.11.0-2
rpmbuild 9d2e23c
- fix the release number
rpmbuild 9d2e23c
rpmbuild c1ce4c2
* Mon Oct 14 2019 Michal Ambroz <rebus at, seznam.cz> - 3.11.0-1
rpmbuild c1ce4c2
- bump to 3.11.0, omit py2 for f30+ and epel8+
rpmbuild c1ce4c2
d8f0850
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.9.0-2.2
d8f0850
- Rebuilt for Python 3.8
d8f0850
e57d767
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.9.0-2.1
e57d767
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
e57d767
rpmbuild 39fc626
* Fri Mar 22 2019 Michal Ambroz <rebus at, seznam.cz> - 3.9.0-2
rpmbuild 39fc626
- change dependency to sphinx based on the /usr/bin/sphinx-build
rpmbuild 39fc626
rpmbuild 926f10e
* Mon Mar 18 2019 Michal Ambroz <rebus at, seznam.cz> - 3.9.0-1
rpmbuild 926f10e
- bump to 3.9.0
rpmbuild 926f10e
79c3738
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 3.8.1-3.2
79c3738
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
79c3738
18f492b
* Fri Oct 12 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.8.1-3
18f492b
- Python2 binary package has been removed
18f492b
  See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal
18f492b
Michal Ambroz 67dc563
* Mon Aug 27 2018 Michal Ambroz <rebus at, seznam.cz> - 3.8.1-2
Michal Ambroz 67dc563
- rebuild with yara 3.8.1 override
Michal Ambroz 67dc563
Michal Ambroz 756bb1b
* Mon Aug 27 2018 Michal Ambroz <rebus at, seznam.cz> - 3.8.1-1
Michal Ambroz 756bb1b
- bump to 3.8.1
Michal Ambroz 756bb1b
ddc42ac
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-7
ddc42ac
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
ddc42ac
6e65c3c
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.7.0-6
6e65c3c
- Rebuilt for Python 3.7
6e65c3c
Michal Ambroz 27fde41
* Fri Mar 16 2018 Michal Ambroz <rebus at, seznam.cz> - 3.7.0-5
Michal Ambroz 29b5279
- fix dependencies for building the epel7/epel6 packages
Michal Ambroz 29b5279
Michal Ambroz c701474
* Thu Mar 15 2018 Michal Ambroz <rebus at, seznam.cz> - 3.7.0-4
Michal Ambroz c701474
- rebuild with yara 3.7.1 for supported platforms
Michal Ambroz 27fde41
- fix dependencies for building the epel packages
Michal Ambroz c701474
c4912b9
* Wed Feb 28 2018 Iryna Shcherbina <ishcherb@redhat.com> - 3.7.0-3
c4912b9
- Update Python 2 dependency declarations to new packaging standards
c4912b9
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
c4912b9
7666c27
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.7.0-2
7666c27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
7666c27
Michal Ambroz 2f45b09
* Wed Nov 15 2017 Michal Ambroz <rebus at, seznam.cz> - 3.7.0-1
Michal Ambroz 2f45b09
- bump to yara 3.7.0 release version (#1511921)
Michal Ambroz 2f45b09
92ef00e
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.3-4
92ef00e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
92ef00e
612613f
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.6.3-3
612613f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
612613f
4dee5a8
* Mon Jul 17 2017 Michal Ambroz <rebus at, seznam.cz> - 3.6.3-2
4dee5a8
- fix bogus dates in the changelog
Michal Ambroz 6e8f367
- omit failing testCompileFile test for s390/ppc64
4dee5a8
8aeabca
* Mon Jul 17 2017 Michal Ambroz <rebus at, seznam.cz> - 3.6.3-1
8aeabca
- bump to upstream 3.6.3 release version
8aeabca
fe4c5d5
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5.0-10
fe4c5d5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
fe4c5d5
b901d29
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.5.0-9
b901d29
- Rebuild for Python 3.6
b901d29
040dcc1
* Wed Nov 23 2016 Dan Horák <dan[at]danny.cz> - 3.5.0-8
040dcc1
- fix the arch lists
040dcc1
4dee5a8
* Tue Aug 16 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-7
rpmbuild f57433c
- adding test exclusions also for armv7hl and ppc64le
h3x2b 3afb8ff
4dee5a8
* Tue Aug 16 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-6
h3x2b ec55389
- additionally testEntrypoint testIn testIntegerFunctions failing on s390/ppc64
h3x2b ec55389
- exclude those tests for build of s390/ppc64
h3x2b ec55389
4dee5a8
* Tue Aug 16 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-5
381b1bc
- testModuleData is failing on arm platform even for python 2.7
h3x2b ec55389
- exclude this test for build of arm
381b1bc
5c2f4e4
* Fri Aug 12 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-4
5c2f4e4
- remove unnecessary ldconfig
5c2f4e4
- count with the python3 test values except the 2 known for failing
5c2f4e4
5c2f4e4
* Thu Aug 11 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-3
5c2f4e4
- change python3 naming to allow epel7 python34 packages
5c2f4e4
5c2f4e4
* Thu Aug 04 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-2
5c2f4e4
- cosmetics
5c2f4e4
5c2f4e4
* Thu Aug 04 2016 Michal Ambroz <rebus at, seznam.cz> - 3.5.0-1
5c2f4e4
- with yara 3.5.0 the python yara binding is separate library