some clean up
remove naked provide for Fedora 29 and later
switch to Python 3 for pyreadelf for Fedora 29 and later
This commit is contained in:
Terje Røsten 2018-06-17 14:45:15 +02:00
parent e8bc8cb9b5
commit 25ae9af04d
3 changed files with 84 additions and 134 deletions

View File

@ -1,5 +1,5 @@
diff --git a/elftools/common/construct_utils.py b/elftools/common/construct_utils.py
index 53caa97..41c2815 100644
index 8ace30e..321ab51 100644
--- a/elftools/common/construct_utils.py
+++ b/elftools/common/construct_utils.py
@@ -6,7 +6,7 @@
@ -12,7 +12,7 @@ index 53caa97..41c2815 100644
class RepeatUntilExcluding(Subconstruct):
diff --git a/elftools/common/utils.py b/elftools/common/utils.py
index 7bd1d5b..8b2400b 100644
index d8acefa..f6d017c 100644
--- a/elftools/common/utils.py
+++ b/elftools/common/utils.py
@@ -9,7 +9,7 @@
@ -25,7 +25,7 @@ index 7bd1d5b..8b2400b 100644
def bytelist2string(bytelist):
diff --git a/elftools/dwarf/enums.py b/elftools/dwarf/enums.py
index 6508764..a474d32 100644
index 9140f91..17f5c74 100644
--- a/elftools/dwarf/enums.py
+++ b/elftools/dwarf/enums.py
@@ -6,7 +6,7 @@
@ -34,11 +34,11 @@ index 6508764..a474d32 100644
#-------------------------------------------------------------------------------
-from ..construct import Pass
+from construct import Pass
from ..common.py3compat import iteritems
ENUM_DW_TAG = dict(
diff --git a/elftools/dwarf/structs.py b/elftools/dwarf/structs.py
index 39e4815..c50a874 100644
index e25dc84..cfc4a85 100644
--- a/elftools/dwarf/structs.py
+++ b/elftools/dwarf/structs.py
@@ -7,7 +7,7 @@
@ -50,21 +50,8 @@ index 39e4815..c50a874 100644
UBInt8, UBInt16, UBInt32, UBInt64, ULInt8, ULInt16, ULInt32, ULInt64,
SBInt8, SBInt16, SBInt32, SBInt64, SLInt8, SLInt16, SLInt32, SLInt64,
Adapter, Struct, ConstructError, If, RepeatUntil, Field, Rename, Enum,
diff --git a/elftools/elf/elffile.py b/elftools/elf/elffile.py
index 458273f..a4d62bd 100644
--- a/elftools/elf/elffile.py
+++ b/elftools/elf/elffile.py
@@ -9,7 +9,7 @@
from ..common.py3compat import BytesIO
from ..common.exceptions import ELFError
from ..common.utils import struct_parse, elf_assert
-from ..construct import ConstructError
+from construct import ConstructError
from .structs import ELFStructs
from .sections import (
Section, StringTableSection, SymbolTableSection,
diff --git a/elftools/elf/enums.py b/elftools/elf/enums.py
index deb9f35..7b778c7 100644
index dbeb20e..5767d41 100644
--- a/elftools/elf/enums.py
+++ b/elftools/elf/enums.py
@@ -6,7 +6,7 @@
@ -89,21 +76,21 @@ index 4a4473f..d4f4b75 100644
from ..common.utils import struct_parse, elf_assert
from .sections import Section, Symbol
diff --git a/elftools/elf/sections.py b/elftools/elf/sections.py
index ce62450..99b6613 100644
--- a/elftools/elf/sections.py
+++ b/elftools/elf/sections.py
@@ -6,7 +6,7 @@
# Eli Bendersky (eliben@gmail.com)
# This code is in the public domain
diff --git a/elftools/elf/notes.py b/elftools/elf/notes.py
index b3a41d6..526135c 100644
--- a/elftools/elf/notes.py
+++ b/elftools/elf/notes.py
@@ -8,7 +8,7 @@
#-------------------------------------------------------------------------------
from ..common.py3compat import bytes2str
from ..common.utils import struct_parse, roundup
-from ..construct import CString
+from construct import CString
from ..common.utils import struct_parse, elf_assert, parse_cstring_from_stream
def iter_notes(elffile, offset, size):
diff --git a/elftools/elf/segments.py b/elftools/elf/segments.py
index bc54da2..dfb3a14 100644
index c1c0279..8464248 100644
--- a/elftools/elf/segments.py
+++ b/elftools/elf/segments.py
@@ -6,7 +6,7 @@
@ -114,9 +101,9 @@ index bc54da2..dfb3a14 100644
+from construct import CString
from ..common.utils import struct_parse
from .constants import SH_FLAGS
from .notes import iter_notes
diff --git a/elftools/elf/structs.py b/elftools/elf/structs.py
index 0862400..51b1715 100644
index d2404ab..2570b4f 100644
--- a/elftools/elf/structs.py
+++ b/elftools/elf/structs.py
@@ -7,7 +7,7 @@
@ -128,11 +115,9 @@ index 0862400..51b1715 100644
UBInt8, UBInt16, UBInt32, UBInt64,
ULInt8, ULInt16, ULInt32, ULInt64,
SBInt32, SLInt32, SBInt64, SLInt64,
diff --git a/setup.py b/setup.py
index a105774..d8cd590 100644
--- a/setup.py
+++ b/setup.py
@@ -41,7 +41,6 @@ setup(
--- a/setup.py~ 2016-08-05 05:18:18.000000000 +0200
+++ b/setup.py 2018-06-17 13:51:23.961881845 +0200
@@ -41,7 +41,6 @@
'elftools.elf',
'elftools.common',
'elftools.dwarf',

View File

@ -1,111 +1,70 @@
%if 0%{?fedora} || 0%{?rhel} >= 8
%global __python_sitelib %{python2_sitelib}
%if 0%{?fedora} > 28 || 0%{?rhel} >= 8
%global py2readelf py2readelf
%global py3readelf pyreadelf
%else
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%global __python_sitelib %{python_sitelib}
%{?__python2:%global __python2 %{__python}}
%global py2readelf pyreadelf
%global py3readelf py3readelf
%endif
%global debug_package %{nil}
%global commitdate 20130619
%global commit a1d968102e82fea06692c367849bc25418780f77
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: pyelftools
Version: 0.22
Release: 0.16.git%{commitdate}.%{shortcommit}%{?dist}
Summary: Pure-Python library for parsing and analyzing ELF files
Name: pyelftools
Version: 0.24
Release: 1%{?dist}
License: Public Domain
URL: https://github.com/eliben/%{name}
# We 'll use git snapshots, because upstream keeps master-branch
# in a usable, working state. See:
# https://github.com/eliben/pyelftools/wiki/Hacking-guide#contributing
Source0: %{url}/archive/%{commit}/%{name}-%{version}.git%{commitdate}.%{shortcommit}.tar.gz
Patch0: pyelftools-0.22-construct.patch
URL: https://github.com/eliben/pyelftools
Source0: https://files.pythonhosted.org/packages/source/p/pyelftools/pyelftools-%{version}.tar.gz
Patch0: pyelftools-0.24-construct.patch
BuildRequires: python2-devel
BuildRequires: python2-setuptools
BuildRequires: python2-construct
%if 0%{?fedora} || 0%{?rhel} >= 8
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-construct
%endif
BuildArch: noarch
%description
Pure-Python library for parsing and analyzing ELF files
%global _description \
Pure-Python library for parsing and analyzing ELF files\
and DWARF debugging information.
%description %_description
%package -n python2-%{name}
Summary: %{summary}
Requires: python2-construct
%{?python_provide:%python_provide python2-%{name}}
# Remove before F30
%if 0%{?fedora} < 29
Provides: %{name} = %{version}-%{release}
%description -n python2-%{name}
Pure-Python library for parsing and analyzing ELF files
and DWARF debugging information.
%endif
%description -n python2-%{name} %_description
%if 0%{?fedora} || 0%{?rhel} >= 8
%package -n python3-%{name}
Summary: %{summary}
Requires: python3-construct
%{?python_provide:%python_provide python3-%{name}}
%description -n python3-%{name}
Pure-Python library for parsing and analyzing ELF files
and DWARF debugging information.
%description -n python3-%{name} %_description
%endif
%prep
%setup -qn %{name}-%{commit}
%setup -q
%patch0 -p1
# remove bundled construct lib
rm -rf elftools/construct
# python3-package
%if 0%{?fedora} || 0%{?rhel} >= 8
rm -rf %{py3dir}
cp -a . %{py3dir}
# fix hashbang
sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/python3|' %{py3dir}/scripts/readelf.py
%endif
sed -i -e 's|#!/usr/bin/env python|#!/usr/bin/python2|' scripts/readelf.py
%build
%{__python2} setup.py build
%{py2_build}
%if 0%{?fedora} || 0%{?rhel} >= 8
pushd %{py3dir}
%{__python3} setup.py build
%{py3_build}
%endif
%install
%{__python2} setup.py install -O1 --skip-build --root %{buildroot}
mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/pyreadelf
%{py2_install}
mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/%{py2readelf}
%if 0%{?fedora} || 0%{?rhel} >= 8
pushd %{py3dir}
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/py3readelf
%{py3_install}
mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/%{py3readelf}
%endif
%check
%{__python2} test/run_all_unittests.py
%{__python2} test/run_examples_test.py
@ -117,27 +76,33 @@ mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/py3readelf
%if 0%{?fedora} || 0%{?rhel} >= 8
%{__python3} test/run_all_unittests.py
%{__python3} test/run_examples_test.py
# tests may fail because of differences in output-formatting
# from binutils' readelf. See:
# https://github.com/eliben/pyelftools/wiki/Hacking-guide#tests
# ditto
%{__python3} test/run_readelf_tests.py || :
%endif
%files -n python2-%{name}
%doc CHANGES LICENSE README* TODO
%{__python_sitelib}/*elftools*
%{_bindir}/pyreadelf
%license LICENSE
%doc CHANGES
%{_bindir}/%{py2readelf}
%{python2_sitelib}/elftools
%{python2_sitelib}/pyelftools-*.egg-info
%if 0%{?fedora} || 0%{?rhel} >= 8
%files -n python3-%{name}
%doc CHANGES LICENSE README* TODO
%{python3_sitelib}/*elftools*
%{_bindir}/py3readelf
%license LICENSE
%doc CHANGES
%{_bindir}/%{py3readelf}
%{python3_sitelib}/elftools
%{python3_sitelib}/pyelftools-*.egg-info
%endif
%changelog
* Sun Jun 17 2018 Terje Rosten <terje.rosten@ntnu.no> - 0.24-1
- 0.24
- some clean up
- remove naked provide for Fedora 29 and later
- switch to Python 3 for pyreadelf for Fedora 29 and later
* Wed Feb 21 2018 Iryna Shcherbina <ishcherb@redhat.com> - 0.22-0.16.git20130619.a1d9681
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

View File

@ -1 +1 @@
78ed0325b4e81bd5c530b7695853be6c pyelftools-0.22.git20130619.a1d9681.tar.gz
SHA512 (pyelftools-0.24.tar.gz) = 5169617f9a8446ffc21dfc44ee185a388c8945a0296bdc6752483b0756888dccb10e3ee88e529d101cf31a4595de924b5c95f5459d5ee4448f57c0c4f2c56887