|
rpmbuild |
8f2afeb |
Name: python-oletools
|
|
|
dc1442d |
Version: 0.56
|
|
|
11f93f2 |
Release: 3%{?dist}
|
|
rpmbuild |
8f2afeb |
Summary: Tools to analyze Microsoft OLE2 files
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
7d4a18a |
# oletools/*.py: BSD
|
|
rpmbuild |
7d4a18a |
# oletools/olevba*.py: BSD and MIT
|
|
rpmbuild |
7d4a18a |
# oletools/thirdparty/xxxswf/*.py: No license specified
|
|
rpmbuild |
7d4a18a |
# oletools/thirdparty/xglob/*.py: BSD
|
|
rpmbuild |
7d4a18a |
# oletools/thirdparty/tablestream/*.py: BSD
|
|
rpmbuild |
7d4a18a |
# oletools/thirdparty/zipfile27/*.py: Python
|
|
rpmbuild |
7d4a18a |
# oletools/thirdparty/msoffcrypto/*.py: MIT
|
|
rpmbuild |
7d4a18a |
License: BSD and MIT and Python
|
|
rpmbuild |
7d4a18a |
URL: https://www.decalage.info/python/oletools
|
|
rpmbuild |
7d4a18a |
# https://github.com/decalage2/oletools/releases
|
|
rpmbuild |
7d4a18a |
# https://github.com/nolze/msoffcrypto-tool/releases
|
|
rpmbuild |
7d4a18a |
|
|
rpmbuild |
afd6c14 |
%global srcname oletools
|
|
|
f72c176 |
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
afd6c14 |
# Build with python3 package by default
|
|
rpmbuild |
afd6c14 |
%bcond_without python3
|
|
rpmbuild |
afd6c14 |
|
|
rpmbuild |
afd6c14 |
# Build without python2 package for newer releases f32+ and rhel8+
|
|
rpmbuild |
afd6c14 |
# Use python3 executables by default on releases f32+ and rhel8+
|
|
rpmbuild |
afd6c14 |
%if (0%{?fedora} && 0%{?fedora} >= 32 ) || ( 0%{?rhel} && 0%{?rhel} >= 8 )
|
|
rpmbuild |
afd6c14 |
%bcond_with python2
|
|
rpmbuild |
afd6c14 |
%bcond_without python3_default
|
|
rpmbuild |
afd6c14 |
%else
|
|
rpmbuild |
afd6c14 |
%bcond_without python2
|
|
rpmbuild |
afd6c14 |
%bcond_with python3_default
|
|
rpmbuild |
afd6c14 |
%endif
|
|
rpmbuild |
afd6c14 |
|
|
rpmbuild |
8f2afeb |
# Bundles taken from oletools-0.54.2b/oletools/thirdparty
|
|
rpmbuild |
afd6c14 |
%global _provides \
|
|
rpmbuild |
8f2afeb |
Provides: bundled(oledump) = 0.0.5 \
|
|
rpmbuild |
8f2afeb |
Provides: bundled(tablestream) = 0.09 \
|
|
rpmbuild |
8f2afeb |
Provides: bundled(xglob) = 0.07 \
|
|
rpmbuild |
cf07fae |
Provides: bundled(xxxswf) = 0.1
|
|
rpmbuild |
afd6c14 |
|
|
rpmbuild |
afd6c14 |
|
|
rpmbuild |
afd6c14 |
%global _description %{expand:
|
|
rpmbuild |
afd6c14 |
The python-oletools is a package of python tools from Philippe Lagadec
|
|
rpmbuild |
afd6c14 |
to analyze Microsoft OLE2 files (also called Structured Storage,
|
|
rpmbuild |
afd6c14 |
Compound File Binary Format or Compound Document File Format),
|
|
rpmbuild |
afd6c14 |
such as Microsoft Office documents or Outlook messages, mainly for
|
|
rpmbuild |
afd6c14 |
malware analysis, forensics and debugging.
|
|
rpmbuild |
afd6c14 |
It is based on the olefile parser.
|
|
|
f72c176 |
See http://www.decalage.info/python/oletools for more info.
|
|
rpmbuild |
afd6c14 |
}
|
|
|
f72c176 |
|
|
rpmbuild |
7d4a18a |
Source0: https://github.com/decalage2/oletools/archive/v%{version}/%{srcname}-%{version}.tar.gz
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
cf07fae |
# For now bundle the msoffcrypto-tool for python2 - new requirement for the oletools not used by anything else
|
|
rpmbuild |
cf07fae |
# but in Fedora we have only the python3 package for it
|
|
|
dc1442d |
Source1: https://github.com/nolze/msoffcrypto-tool/archive/v4.11.0/msoffcrypto-tool-4.11.0.tar.gz
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
8f2afeb |
# Remove the bundled libraries from the build. Use the system libraries instead
|
|
rpmbuild |
7d4a18a |
Patch0: %{name}-01-thirdparty.patch
|
|
|
f72c176 |
|
|
rpmbuild |
cf07fae |
%if 0%{?with_python2}
|
|
rpmbuild |
8f2afeb |
# Bundle msoffcrypto instead of using one from pip
|
|
rpmbuild |
7d4a18a |
Patch1: %{name}-02-msoffcrypto.patch
|
|
|
f72c176 |
%endif
|
|
|
f72c176 |
|
|
rpmbuild |
cf07fae |
BuildArch: noarch
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python3}
|
|
rpmbuild |
8f2afeb |
BuildRequires: python%{python3_pkgversion}-devel
|
|
|
93eca48 |
BuildRequires: python%{python3_pkgversion}-setuptools
|
|
|
f72c176 |
BuildRequires: python%{python3_pkgversion}-colorclass
|
|
rpmbuild |
8f2afeb |
BuildRequires: python%{python3_pkgversion}-easygui
|
|
rpmbuild |
8f2afeb |
BuildRequires: python%{python3_pkgversion}-olefile
|
|
rpmbuild |
8f2afeb |
BuildRequires: python%{python3_pkgversion}-pyparsing
|
|
rpmbuild |
afd6c14 |
BuildRequires: python%{python3_pkgversion}-pymilter
|
|
rpmbuild |
8f2afeb |
BuildRequires: python%{python3_pkgversion}-prettytable
|
|
rpmbuild |
afd6c14 |
BuildRequires: python%{python3_pkgversion}-cryptography
|
|
rpmbuild |
cf07fae |
BuildRequires: python%{python3_pkgversion}-msoffcrypto
|
|
|
dc1442d |
BuildRequires: python%{python3_pkgversion}-pcodedmp
|
|
|
2cd337c |
%endif
|
|
|
2cd337c |
|
|
rpmbuild |
afd6c14 |
# python2-pymilter at F28+, python-pymilter at EPEL 7
|
|
rpmbuild |
afd6c14 |
# python2-pyparsing and python3-pyparsing at Fedora, pyparsing at RHEL 7
|
|
rpmbuild |
afd6c14 |
# python2-easygui only at F28+ and EPEL7+
|
|
rpmbuild |
afd6c14 |
# python2-prettytable and python3-prettytable at Fedora, python-prettytable at EPEL 7
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2}
|
|
rpmbuild |
8f2afeb |
BuildRequires: python2-devel
|
|
|
93eca48 |
BuildRequires: python2-setuptools
|
|
rpmbuild |
8f2afeb |
BuildRequires: python2-colorclass
|
|
rpmbuild |
8f2afeb |
BuildRequires: python2-easygui
|
|
|
f72c176 |
BuildRequires: python2-olefile
|
|
rpmbuild |
afd6c14 |
BuildRequires: python2-cryptography
|
|
|
dc1442d |
BuildRequires: python2-pcodedmp
|
|
rpmbuild |
8f2afeb |
%endif
|
|
|
f72c176 |
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2} && 0%{?fedora}
|
|
rpmbuild |
8f2afeb |
BuildRequires: python2-pymilter
|
|
rpmbuild |
8f2afeb |
BuildRequires: python2-pyparsing
|
|
|
f72c176 |
BuildRequires: python2-prettytable
|
|
|
f72c176 |
%endif
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
8f2afeb |
# python2 packages for EPEL 7
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2} && 0%{?rhel}
|
|
rpmbuild |
8f2afeb |
BuildRequires: pyparsing
|
|
rpmbuild |
8f2afeb |
BuildRequires: python-prettytable
|
|
rpmbuild |
cf07fae |
BuildRequires: python-pymilter
|
|
|
2cd337c |
%endif
|
|
|
f72c176 |
|
|
rpmbuild |
afd6c14 |
%description %{_description}
|
|
|
f72c176 |
|
|
|
f72c176 |
|
|
rpmbuild |
cf07fae |
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2}
|
|
|
f72c176 |
%package -n python2-%{srcname}
|
|
|
f72c176 |
Summary: %{summary}
|
|
|
f72c176 |
%{?python_provide:%python_provide python2-%{srcname}}
|
|
|
f72c176 |
%{_provides}
|
|
|
f72c176 |
|
|
rpmbuild |
cf07fae |
Requires: python2-olefile
|
|
rpmbuild |
cf07fae |
Requires: python2-colorclass
|
|
|
dc1442d |
Requires: python2-easygui
|
|
|
f72c176 |
|
|
rpmbuild |
cf07fae |
# python2-pymilter only at F28+, python-pymilter at EPEL 7
|
|
|
f72c176 |
# python2-pyparsing at Fedora, pyparsing at RHEL 7
|
|
rpmbuild |
cf07fae |
# python2-prettytable only at Fedora 28+, python-prettytable at EPEL 7
|
|
|
f72c176 |
%if 0%{?fedora}
|
|
|
f72c176 |
Requires: python2-pyparsing
|
|
rpmbuild |
cf07fae |
Requires: python2-prettytable
|
|
rpmbuild |
cf07fae |
Requires: python2-pymilter
|
|
|
f72c176 |
%else
|
|
|
f72c176 |
Requires: pyparsing
|
|
rpmbuild |
cf07fae |
Requires: python-prettytable
|
|
rpmbuild |
cf07fae |
Requires: python-pymilter
|
|
|
dc1442d |
Requires: python2-pcodedmp
|
|
|
2cd337c |
%endif
|
|
|
2cd337c |
|
|
rpmbuild |
afd6c14 |
# Used by msoffcrypto
|
|
rpmbuild |
afd6c14 |
Requires: python2-cryptography
|
|
|
dc1442d |
Provides: bundled(msoffcrypto-tool) = 4.11.0
|
|
rpmbuild |
afd6c14 |
|
|
|
f72c176 |
%description -n python2-%{srcname} %{_description}
|
|
|
f72c176 |
|
|
|
f72c176 |
Python2 version.
|
|
rpmbuild |
8f2afeb |
%endif
|
|
|
f72c176 |
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python3}
|
|
|
f72c176 |
%package -n python%{python3_pkgversion}-%{srcname}
|
|
|
f72c176 |
Summary: %{summary}
|
|
|
f72c176 |
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
|
|
|
f72c176 |
%{_provides}
|
|
|
f72c176 |
|
|
rpmbuild |
afd6c14 |
Requires: python%{python3_pkgversion}-pymilter
|
|
|
f72c176 |
Requires: python%{python3_pkgversion}-pyparsing
|
|
|
f72c176 |
Requires: python%{python3_pkgversion}-colorclass
|
|
|
f72c176 |
Requires: python%{python3_pkgversion}-easygui
|
|
|
f72c176 |
Requires: python%{python3_pkgversion}-olefile
|
|
|
f72c176 |
Requires: python%{python3_pkgversion}-prettytable
|
|
rpmbuild |
afd6c14 |
Requires: python%{python3_pkgversion}-cryptography
|
|
rpmbuild |
cf07fae |
Requires: python%{python3_pkgversion}-msoffcrypto
|
|
|
dc1442d |
Requires: python%{python3_pkgversion}-pcodedmp
|
|
|
f72c176 |
|
|
|
f72c176 |
%description -n python%{python3_pkgversion}-%{srcname} %{_description}
|
|
rpmbuild |
8f2afeb |
Python3 version.
|
|
|
f72c176 |
|
|
|
f72c176 |
%endif
|
|
|
f72c176 |
|
|
|
f72c176 |
|
|
|
f72c176 |
%package -n python-%{srcname}-doc
|
|
|
f72c176 |
Summary: Documentation files for %{name}
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2}
|
|
|
f72c176 |
%{?python_provide:%python_provide python2-%{srcname}-doc}
|
|
rpmbuild |
8f2afeb |
%endif
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python3}
|
|
|
f72c176 |
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}-doc}
|
|
|
f72c176 |
%endif
|
|
|
f72c176 |
|
|
|
f72c176 |
%description -n python-%{srcname}-doc %{_description}
|
|
|
f72c176 |
|
|
|
f72c176 |
|
|
|
f72c176 |
%prep
|
|
rpmbuild |
7d4a18a |
%autosetup -p 1 -n %{srcname}-%{version}
|
|
|
f72c176 |
|
|
rpmbuild |
8f2afeb |
# Use globally installed python modules instead of bundled ones
|
|
|
f72c176 |
for i in colorclass easygui olefile prettytable pyparsing; do
|
|
|
f72c176 |
rm -rf "oletools/thirdparty/${i}"
|
|
|
f72c176 |
done
|
|
|
f72c176 |
|
|
|
f72c176 |
sed -i -e '
|
|
|
f72c176 |
s|from oletools.thirdparty import olefile|import olefile|;
|
|
|
f72c176 |
s|from oletools.thirdparty.olefile import olefile|from olefile import olefile|;
|
|
|
f72c176 |
s|from oletools.thirdparty.prettytable import prettytable|import prettytable|;
|
|
|
f72c176 |
s|from oletools.thirdparty.pyparsing.pyparsing import|from pyparsing import|;
|
|
|
f72c176 |
s|from thirdparty.pyparsing.pyparsing import|from pyparsing import|;
|
|
|
f72c176 |
s|from .thirdparty import olefile|import olefile|;
|
|
|
f72c176 |
s|from oletools.thirdparty.easygui import easygui|import easygui|;
|
|
|
f72c176 |
' */*.py
|
|
|
f72c176 |
|
|
rpmbuild |
cf07fae |
%if 0%{?with_python2}
|
|
rpmbuild |
cf07fae |
# for now bundle msoffcrypto-tool for python2
|
|
rpmbuild |
8f2afeb |
tar xvf %{SOURCE1}
|
|
|
dc1442d |
mv msoffcrypto-tool-4.11.0/msoffcrypto oletools/thirdparty/
|
|
|
dc1442d |
cp msoffcrypto-tool-4.11.0/LICENSE.txt oletools/thirdparty/msoffcrypto/LICENSE.txt
|
|
rpmbuild |
8f2afeb |
sed -i -e 's|import msoffcrypto| from oletools.thirdparty import msoffcrypto|;' oletools/crypto.py
|
|
rpmbuild |
cf07fae |
%endif
|
|
|
f72c176 |
|
|
|
11f93f2 |
%if 0%{?with_python2} && 0%{?rhel} <= 7
|
|
|
11f93f2 |
# on rhel7 weaken the pyparse requirements
|
|
|
11f93f2 |
sed -i -e 's|pyparsing>=2\.1\.0,<3|pyparsing|' requirements.txt setup.py
|
|
rpmbuild |
aa9b5c9 |
%endif
|
|
rpmbuild |
aa9b5c9 |
|
|
rpmbuild |
aa9b5c9 |
|
|
|
f72c176 |
%build
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2}
|
|
rpmbuild |
8f2afeb |
%py2_build
|
|
rpmbuild |
8f2afeb |
%endif
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python3}
|
|
|
f72c176 |
%py3_build
|
|
|
f72c176 |
%endif
|
|
|
f72c176 |
|
|
rpmbuild |
aa9b5c9 |
|
|
|
f72c176 |
%install
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2}
|
|
rpmbuild |
8f2afeb |
# Install python2 files
|
|
rpmbuild |
8f2afeb |
%py2_install
|
|
|
f72c176 |
|
|
rpmbuild |
8f2afeb |
# Move executables to python2 versioned names
|
|
|
f72c176 |
pushd %{buildroot}%{_bindir}
|
|
rpmbuild |
8f2afeb |
main=$(%{__python2} -c "import sys; sys.stdout.write('{0.major}'.format(sys.version_info))") # e.g. 2
|
|
rpmbuild |
8f2afeb |
full=$(%{__python2} -c "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))") # e.g. 2.7
|
|
|
f72c176 |
|
|
rpmbuild |
8f2afeb |
for i in ezhexviewer msodde mraptor olebrowse oledir olefile oleid olemap olemeta oleobj oletimes olevba pyxswf rtfobj; do
|
|
|
2cd337c |
mv -f "${i}" "${i}-${full}"
|
|
|
2cd337c |
ln -s "${i}-${full}" "${i}-${main}"
|
|
rpmbuild |
8f2afeb |
|
|
|
f72c176 |
done
|
|
|
f72c176 |
popd
|
|
|
f72c176 |
|
|
|
f72c176 |
# Remove '\r' line ending and shebang from non-executable python libraries
|
|
rpmbuild |
7d4a18a |
for file in %{buildroot}%{python2_sitelib}/%{srcname}/{.,*,*/*}/*.py; do
|
|
|
f72c176 |
sed -e '1{\@^#![[:space:]]*/usr/bin/env python@d}' -e 's|\r$||' "${file}" > "${file}.new"
|
|
|
f72c176 |
touch -c -r "${file}" "${file}.new"
|
|
|
f72c176 |
mv -f "${file}.new" "${file}"
|
|
|
f72c176 |
done
|
|
rpmbuild |
8f2afeb |
# Remove files that should either go to %%doc or to %%license
|
|
rpmbuild |
8f2afeb |
rm -rf %{buildroot}%{python2_sitelib}/%{srcname}/{doc,LICENSE.txt,README.*}
|
|
rpmbuild |
8f2afeb |
rm -f %{buildroot}%{python2_sitelib}/%{srcname}/thirdparty/xglob/LICENSE.txt
|
|
rpmbuild |
8f2afeb |
rm -f %{buildroot}%{python2_sitelib}/%{srcname}/thirdparty/xxxswf/LICENSE.txt
|
|
rpmbuild |
8f2afeb |
rm -f %{buildroot}%{python2_sitelib}/%{srcname}/thirdparty/msoffcrypto/LICENSE.txt
|
|
|
f72c176 |
%endif
|
|
|
f72c176 |
|
|
rpmbuild |
8f2afeb |
# Old pyparsing in RHEL 7 -> replace pyparsing.infixNotation by pyparsing.operatorPrecedence
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2} && 0%{?rhel} && 0%{?rhel} < 8
|
|
rpmbuild |
8f2afeb |
sed -e 's|infixNotation|operatorPrecedence|g' -i %{buildroot}%{python2_sitelib}/%{srcname}/olevba.py
|
|
rpmbuild |
8f2afeb |
%endif
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python3}
|
|
rpmbuild |
8f2afeb |
# Install python3 files
|
|
rpmbuild |
8f2afeb |
%py3_install
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
8f2afeb |
# Move executables to python3 versioned names
|
|
|
f72c176 |
pushd %{buildroot}%{_bindir}
|
|
rpmbuild |
8f2afeb |
main=$(%{__python3} -c "import sys; sys.stdout.write('{0.major}'.format(sys.version_info))") # e.g. 3
|
|
rpmbuild |
8f2afeb |
full=$(%{__python3} -c "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))") # e.g. 3.4
|
|
|
f72c176 |
|
|
|
dc1442d |
# mraptor3 and olevba3 are deprecated, mraptor or olevba should be used instead
|
|
|
dc1442d |
rm -f mraptor3 olevba3
|
|
rpmbuild |
cf07fae |
|
|
rpmbuild |
8f2afeb |
for i in ezhexviewer msodde mraptor olebrowse oledir olefile oleid olemap olemeta oleobj oletimes olevba pyxswf rtfobj; do
|
|
|
2cd337c |
mv -f "${i}" "${i}-${full}"
|
|
|
2cd337c |
ln -s "${i}-${full}" "${i}-${main}"
|
|
|
f72c176 |
done
|
|
|
f72c176 |
popd
|
|
|
f72c176 |
|
|
|
f72c176 |
# Remove '\r' line ending and shebang from non-executable python libraries
|
|
rpmbuild |
7d4a18a |
for file in %{buildroot}%{python3_sitelib}/%{srcname}/{.,*,*/*}/*.py; do
|
|
|
f72c176 |
sed -e '1{\@^#![[:space:]]*/usr/bin/env python@d}' -e 's|\r$||' "${file}" > "${file}.new"
|
|
|
f72c176 |
touch -c -r "${file}" "${file}.new"
|
|
|
f72c176 |
mv -f "${file}.new" "${file}"
|
|
|
f72c176 |
done
|
|
rpmbuild |
cf07fae |
|
|
rpmbuild |
cf07fae |
%if 0%{?with_python2}
|
|
rpmbuild |
cf07fae |
# Remove the msoffcrypto bundling for python3 and use the system package instead
|
|
rpmbuild |
cf07fae |
sed -i -e 's|from oletools.thirdparty import msoffcrypto|import msoffcrypto|;' %{buildroot}%{python3_sitelib}/%{srcname}/crypto.py
|
|
rpmbuild |
cf07fae |
rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/thirdparty/msoffcrypto
|
|
rpmbuild |
5b3116e |
%else
|
|
rpmbuild |
5b3116e |
rm -f %{buildroot}%{python3_sitelib}/%{srcname}/thirdparty/msoffcrypto/LICENSE.txt
|
|
rpmbuild |
cf07fae |
%endif
|
|
rpmbuild |
cf07fae |
|
|
|
f72c176 |
# Remove files that should either go to %%doc or to %%license
|
|
rpmbuild |
8f2afeb |
rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/{doc,LICENSE.txt,README.*}
|
|
rpmbuild |
8f2afeb |
rm -f %{buildroot}%{python3_sitelib}/%{srcname}/thirdparty/xglob/LICENSE.txt
|
|
rpmbuild |
8f2afeb |
rm -f %{buildroot}%{python3_sitelib}/%{srcname}/thirdparty/xxxswf/LICENSE.txt
|
|
rpmbuild |
8f2afeb |
%endif
|
|
rpmbuild |
8f2afeb |
|
|
rpmbuild |
8f2afeb |
# Create trivial name symlinks to the default executables of preffered python version
|
|
|
dc1442d |
# For example in FC31 exists python3 package, but puthon2 is the preferred one
|
|
rpmbuild |
8f2afeb |
pushd %{buildroot}%{_bindir}
|
|
rpmbuild |
8f2afeb |
for i in ezhexviewer msodde mraptor olebrowse oledir olefile oleid olemap olemeta oleobj oletimes olevba pyxswf rtfobj; do
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python3_default}
|
|
rpmbuild |
8f2afeb |
full=$(%{__python3} -c "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))") # e.g. 3.4
|
|
rpmbuild |
8f2afeb |
%else
|
|
rpmbuild |
8f2afeb |
# For now the 2.7 is the default version, python3 support is experimental
|
|
rpmbuild |
8f2afeb |
full=$(%{__python2} -c "import sys; sys.stdout.write('{0.major}.{0.minor}'.format(sys.version_info))") # e.g. 2.7
|
|
rpmbuild |
8f2afeb |
%endif
|
|
rpmbuild |
8f2afeb |
ln -s "${i}-${full}" "${i}"
|
|
rpmbuild |
8f2afeb |
done
|
|
rpmbuild |
8f2afeb |
popd
|
|
rpmbuild |
8f2afeb |
|
|
|
f72c176 |
|
|
|
f72c176 |
# Prepare licenses from bundled code for later %%license usage
|
|
|
f72c176 |
mv -f %{srcname}/thirdparty/xglob/LICENSE.txt xglob-LICENSE.txt
|
|
|
f72c176 |
mv -f %{srcname}/thirdparty/xxxswf/LICENSE.txt xxxswf-LICENSE.txt
|
|
rpmbuild |
6fb4c53 |
%if 0%{?with_python2}
|
|
rpmbuild |
8f2afeb |
mv -f %{srcname}/thirdparty/msoffcrypto/LICENSE.txt msoffcrypto-LICENSE.txt
|
|
rpmbuild |
6fb4c53 |
%endif
|
|
|
f72c176 |
|
|
rpmbuild |
cf07fae |
|
|
|
f72c176 |
%check
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2}
|
|
rpmbuild |
afd6c14 |
|
|
rpmbuild |
afd6c14 |
# On Fedora the oleobj test fails with python2 and version 0.54.2b.
|
|
rpmbuild |
afd6c14 |
# Run the test, but pass it for now.
|
|
rpmbuild |
afd6c14 |
# https://github.com/decalage2/oletools/issues/503
|
|
rpmbuild |
afd6c14 |
%if 0%{?fedora}
|
|
rpmbuild |
aa9b5c9 |
PYTHONIOENCODING=utf8 %{__python2} setup.py test || true
|
|
rpmbuild |
afd6c14 |
%endif
|
|
rpmbuild |
afd6c14 |
|
|
rpmbuild |
aa9b5c9 |
%if 0%{?rhel}
|
|
rpmbuild |
afd6c14 |
# On RHEL7 the tests fail due to version incompatibilities with unit tests
|
|
rpmbuild |
afd6c14 |
%{__python2} setup.py test || true
|
|
rpmbuild |
afd6c14 |
%endif
|
|
rpmbuild |
afd6c14 |
|
|
|
11f93f2 |
# Simple self-test: If it fails, package won't work after installation
|
|
|
11f93f2 |
PYTHONPATH=%{buildroot}%{python2_sitelib} %{buildroot}%{_bindir}/olevba-2 --code cheatsheet/oletools_cheatsheet.docx
|
|
|
11f93f2 |
PYTHONPATH=%{buildroot}%{python2_sitelib} %{buildroot}%{_bindir}/mraptor-2 cheatsheet/oletools_cheatsheet.docx
|
|
|
11f93f2 |
|
|
rpmbuild |
afd6c14 |
%endif
|
|
rpmbuild |
afd6c14 |
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python3}
|
|
rpmbuild |
afd6c14 |
|
|
rpmbuild |
aa9b5c9 |
%if 0%{?fedora}
|
|
rpmbuild |
aa9b5c9 |
# FC31 - ooxml.py fails
|
|
rpmbuild |
afd6c14 |
# https://github.com/decalage2/oletools/issues/504
|
|
|
f72c176 |
%{__python3} setup.py test || true
|
|
|
f72c176 |
%endif
|
|
|
f72c176 |
|
|
rpmbuild |
aa9b5c9 |
# RHEL7 - tests should pass OK when executed manually, but fail on ascii encoding
|
|
rpmbuild |
aa9b5c9 |
# https://kojipkgs.fedoraproject.org//work/tasks/1422/38871422/build.log
|
|
rpmbuild |
aa9b5c9 |
# RHEL8 - absence of dependency pyparsing>=2.2.0, pyparsing on RHEL8 is 2.1.10-7.el8
|
|
rpmbuild |
cf07fae |
%if 0%{?rhel}
|
|
rpmbuild |
aa9b5c9 |
%{__python3} setup.py test || true
|
|
rpmbuild |
aa9b5c9 |
%endif
|
|
rpmbuild |
aa9b5c9 |
|
|
|
11f93f2 |
# Simple self-test: If it fails, package won't work after installation
|
|
|
11f93f2 |
PYTHONPATH=%{buildroot}%{python3_sitelib} %{buildroot}%{_bindir}/olevba-3 --code cheatsheet/oletools_cheatsheet.docx
|
|
|
11f93f2 |
PYTHONPATH=%{buildroot}%{python3_sitelib} %{buildroot}%{_bindir}/mraptor-3 cheatsheet/oletools_cheatsheet.docx
|
|
|
11f93f2 |
|
|
rpmbuild |
afd6c14 |
%endif
|
|
rpmbuild |
afd6c14 |
|
|
|
f72c176 |
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2}
|
|
|
f72c176 |
# Note that there is no %%files section for the unversioned python module if we are building for several python runtimes
|
|
|
f72c176 |
%files -n python2-%{srcname}
|
|
rpmbuild |
7d4a18a |
%license %{srcname}/LICENSE.txt xglob-LICENSE.txt xxxswf-LICENSE.txt msoffcrypto-LICENSE.txt
|
|
|
f72c176 |
%doc README.md
|
|
|
f72c176 |
%{python2_sitelib}/*
|
|
|
f72c176 |
%{_bindir}/ezhexviewer-2*
|
|
rpmbuild |
8f2afeb |
%{_bindir}/mraptor-2*
|
|
rpmbuild |
8f2afeb |
%{_bindir}/msodde-2*
|
|
|
f72c176 |
%{_bindir}/olebrowse-2*
|
|
|
f72c176 |
%{_bindir}/oledir-2*
|
|
|
f72c176 |
%{_bindir}/oleid-2*
|
|
rpmbuild |
8f2afeb |
%{_bindir}/olefile-2*
|
|
|
f72c176 |
%{_bindir}/olemap-2*
|
|
|
f72c176 |
%{_bindir}/olemeta-2*
|
|
|
f72c176 |
%{_bindir}/oleobj-2*
|
|
|
f72c176 |
%{_bindir}/oletimes-2*
|
|
|
f72c176 |
%{_bindir}/olevba-2*
|
|
|
f72c176 |
%{_bindir}/pyxswf-2*
|
|
|
f72c176 |
%{_bindir}/rtfobj-2*
|
|
rpmbuild |
8f2afeb |
%endif
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python2} && ! 0%{?with_python3_default}
|
|
|
f72c176 |
%{_bindir}/ezhexviewer
|
|
rpmbuild |
8f2afeb |
%{_bindir}/mraptor
|
|
rpmbuild |
8f2afeb |
%{_bindir}/msodde
|
|
|
f72c176 |
%{_bindir}/olebrowse
|
|
|
f72c176 |
%{_bindir}/oledir
|
|
|
f72c176 |
%{_bindir}/oleid
|
|
rpmbuild |
8f2afeb |
%{_bindir}/olefile
|
|
|
f72c176 |
%{_bindir}/olemap
|
|
|
f72c176 |
%{_bindir}/olemeta
|
|
|
f72c176 |
%{_bindir}/oleobj
|
|
|
f72c176 |
%{_bindir}/oletimes
|
|
|
f72c176 |
%{_bindir}/olevba
|
|
|
f72c176 |
%{_bindir}/pyxswf
|
|
|
f72c176 |
%{_bindir}/rtfobj
|
|
rpmbuild |
8f2afeb |
%endif
|
|
|
f72c176 |
|
|
rpmbuild |
afd6c14 |
%if 0%{?with_python3}
|
|
|
f72c176 |
%files -n python%{python3_pkgversion}-%{srcname}
|
|
rpmbuild |
7d4a18a |
%license %{srcname}/LICENSE.txt xglob-LICENSE.txt xxxswf-LICENSE.txt
|
|
|
f72c176 |
%doc README.md
|
|
|
f72c176 |
%{python3_sitelib}/*
|
|
|
f72c176 |
%{_bindir}/ezhexviewer-3*
|
|
rpmbuild |
8f2afeb |
%{_bindir}/msodde-3*
|
|
|
f72c176 |
%{_bindir}/olebrowse-3*
|
|
|
f72c176 |
%{_bindir}/oledir-3*
|
|
|
f72c176 |
%{_bindir}/oleid-3*
|
|
rpmbuild |
8f2afeb |
%{_bindir}/olefile-3*
|
|
|
f72c176 |
%{_bindir}/olemap-3*
|
|
|
f72c176 |
%{_bindir}/olemeta-3*
|
|
|
f72c176 |
%{_bindir}/oleobj-3*
|
|
|
f72c176 |
%{_bindir}/oletimes-3*
|
|
|
2cd337c |
# ModuleNotFoundError: No module named 'cStringIO'
|
|
rpmbuild |
8f2afeb |
%{_bindir}/olevba-3*
|
|
|
2cd337c |
# ModuleNotFoundError: No module named 'cStringIO'
|
|
rpmbuild |
8f2afeb |
%{_bindir}/mraptor-3*
|
|
|
f72c176 |
%{_bindir}/pyxswf-3*
|
|
|
f72c176 |
%{_bindir}/rtfobj-3*
|
|
|
f72c176 |
%endif
|
|
rpmbuild |
8f2afeb |
%if 0%{?with_python3} && 0%{?with_python3_default}
|
|
rpmbuild |
8f2afeb |
%{_bindir}/ezhexviewer
|
|
rpmbuild |
8f2afeb |
%{_bindir}/mraptor
|
|
rpmbuild |
8f2afeb |
%{_bindir}/msodde
|
|
rpmbuild |
8f2afeb |
%{_bindir}/olebrowse
|
|
rpmbuild |
8f2afeb |
%{_bindir}/oledir
|
|
rpmbuild |
8f2afeb |
%{_bindir}/oleid
|
|
rpmbuild |
8f2afeb |
%{_bindir}/olefile
|
|
rpmbuild |
8f2afeb |
%{_bindir}/olemap
|
|
rpmbuild |
8f2afeb |
%{_bindir}/olemeta
|
|
rpmbuild |
8f2afeb |
%{_bindir}/oleobj
|
|
rpmbuild |
8f2afeb |
%{_bindir}/oletimes
|
|
rpmbuild |
8f2afeb |
%{_bindir}/olevba
|
|
rpmbuild |
8f2afeb |
%{_bindir}/pyxswf
|
|
rpmbuild |
8f2afeb |
%{_bindir}/rtfobj
|
|
rpmbuild |
8f2afeb |
%endif
|
|
|
f72c176 |
|
|
|
f72c176 |
|
|
|
f72c176 |
%files -n python-%{srcname}-doc
|
|
|
f72c176 |
%doc %{srcname}/doc/*
|
|
|
f72c176 |
%doc cheatsheet
|
|
|
f72c176 |
|
|
|
f72c176 |
|
|
|
f72c176 |
%changelog
|
|
|
11f93f2 |
* Tue Feb 02 2021 Robert Scheck <robert@fedoraproject.org> - 0.56-3
|
|
|
11f93f2 |
- Weak Python 2.7 pyparsing requirement for EPEL 7 correctly
|
|
|
11f93f2 |
- Add simple self-test mechanism to detect future weaking mistakes
|
|
|
11f93f2 |
|
|
|
13e5bc9 |
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.56-2
|
|
|
13e5bc9 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
|
|
|
13e5bc9 |
|
|
|
dc1442d |
* Tue Jan 05 2021 Robert Scheck <robert@fedoraproject.org> - 0.56-1
|
|
|
dc1442d |
- Upgrade to 0.56 (#1885099)
|
|
|
dc1442d |
|
|
|
3e5a3f3 |
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.55-5
|
|
|
3e5a3f3 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
|
|
|
3e5a3f3 |
|
|
|
93eca48 |
* Mon Jun 29 2020 Robert Scheck <robert@fedoraproject.org> 0.55-4
|
|
|
93eca48 |
- Require python-setuptools during build-time explicitly
|
|
|
93eca48 |
|
|
|
a6a0919 |
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.55-3
|
|
|
a6a0919 |
- Rebuilt for Python 3.9
|
|
|
a6a0919 |
|
|
|
65760cc |
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.55-2
|
|
|
65760cc |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
|
|
|
65760cc |
|
|
rpmbuild |
7d4a18a |
* Wed Dec 04 2019 Michal Ambroz <rebus AT_ seznam.cz> - 0.55-1
|
|
rpmbuild |
7d4a18a |
- bump to bugfix release 0.55
|
|
rpmbuild |
7d4a18a |
|
|
rpmbuild |
cf07fae |
* Sun Nov 10 2019 Michal Ambroz <rebus AT_ seznam.cz> - 0.54.2-2
|
|
rpmbuild |
cf07fae |
- use the msoffcrypto bundling only for python2 subpackage
|
|
rpmbuild |
cf07fae |
- use python3-msoffcrypto for python3 package
|
|
rpmbuild |
cf07fae |
|
|
rpmbuild |
8f2afeb |
* Fri Nov 08 2019 Michal Ambroz <rebus AT_ seznam.cz> - 0.54.2-1
|
|
rpmbuild |
8f2afeb |
- bump to release 0.54.2
|
|
rpmbuild |
8f2afeb |
- stop building the python2 for fc32+ epel8+
|
|
rpmbuild |
afd6c14 |
- add missing msoffcrypto python module
|
|
rpmbuild |
afd6c14 |
- fix python36 dependencies for EPEL7
|
|
rpmbuild |
8f2afeb |
|
|
|
c7c9fb6 |
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 0.51-10
|
|
|
c7c9fb6 |
- Rebuilt for Python 3.8.0rc1 (#1748018)
|
|
|
c7c9fb6 |
|
|
|
cbc229e |
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.51-9
|
|
|
cbc229e |
- Rebuilt for Python 3.8
|
|
|
cbc229e |
|
|
|
91abb9a |
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.51-8
|
|
|
91abb9a |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
|
|
|
91abb9a |
|
|
|
8c4edd8 |
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.51-7
|
|
|
8c4edd8 |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
|
|
|
8c4edd8 |
|
|
|
4de47dc |
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.51-6
|
|
|
4de47dc |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
|
|
|
4de47dc |
|
|
|
3597402 |
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.51-5
|
|
|
3597402 |
- Rebuilt for Python 3.7
|
|
|
3597402 |
|
|
|
1c0539d |
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.51-4
|
|
|
1c0539d |
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
|
|
|
1c0539d |
|
|
|
f72c176 |
* Mon Oct 23 2017 Robert Scheck <robert@fedoraproject.org> 0.51-3
|
|
|
f72c176 |
- Correct line endings and remove shebang from non-executable
|
|
|
f72c176 |
python libraries (#1505374 #c5)
|
|
|
f72c176 |
- Clarify python3 related scripts in %%description (#1505374 #c4)
|
|
|
f72c176 |
- Correct summary of -doc subpackage (#1505374 #c2)
|
|
|
f72c176 |
|
|
|
f72c176 |
* Thu Oct 05 2017 Robert Scheck <robert@fedoraproject.org> 0.51-2
|
|
|
f72c176 |
- Various spec file enhancements (#1471561)
|
|
|
f72c176 |
- Added spec file conditionals to build for EPEL 7
|
|
|
f72c176 |
|
|
|
f72c176 |
* Thu Jun 22 2017 Michal Ambroz <rebus at, seznam.cz> 0.51-1
|
|
|
f72c176 |
- bump to 0.51 release
|
|
|
f72c176 |
|
|
|
f72c176 |
* Thu Jun 22 2017 Michal Ambroz <rebus at, seznam.cz> 0.51-0.3.dev11.b4b52d22
|
|
|
f72c176 |
- gaps in python3 detected, using python2 as default
|
|
|
f72c176 |
|
|
|
f72c176 |
* Thu Jun 15 2017 Michal Ambroz <rebus at, seznam.cz> 0.51-0.2.dev11.b4b52d22
|
|
|
f72c176 |
- initial version
|