[pyelftools/f18: 2/2] Intial import (#829676)

Björn Esser besser82 at fedoraproject.org
Sat Aug 17 10:27:26 UTC 2013


commit 8b33398520ca6fd8aa72ef72bf266cb2c0de8eac
Author: Björn Esser <bjoern.esser at gmail.com>
Date:   Fri Aug 16 20:14:27 2013 +0200

    Intial import (#829676)

 .gitignore                      |    4 +
 README                          |    2 -
 pyelftools-0.22-construct.patch |  142 +++++++++++++++++++++++++++++++++++++
 pyelftools.spec                 |  148 +++++++++++++++++++++++++++++++++++++++
 sources                         |    1 +
 5 files changed, 295 insertions(+), 2 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..4a406bf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*~
+*.rpm
+*.tar*
+results_*/
diff --git a/pyelftools-0.22-construct.patch b/pyelftools-0.22-construct.patch
new file mode 100644
index 0000000..9611c1f
--- /dev/null
+++ b/pyelftools-0.22-construct.patch
@@ -0,0 +1,142 @@
+diff --git a/elftools/common/construct_utils.py b/elftools/common/construct_utils.py
+index 53caa97..41c2815 100644
+--- a/elftools/common/construct_utils.py
++++ b/elftools/common/construct_utils.py
+@@ -6,7 +6,7 @@
+ # Eli Bendersky (eliben at gmail.com)
+ # This code is in the public domain
+ #-------------------------------------------------------------------------------
+-from ..construct import Subconstruct, ConstructError, ArrayError
++from construct import Subconstruct, ConstructError, ArrayError
+ 
+ 
+ class RepeatUntilExcluding(Subconstruct):
+diff --git a/elftools/common/utils.py b/elftools/common/utils.py
+index 7bd1d5b..8b2400b 100644
+--- a/elftools/common/utils.py
++++ b/elftools/common/utils.py
+@@ -9,7 +9,7 @@
+ from contextlib import contextmanager
+ from .exceptions import ELFParseError, ELFError, DWARFError
+ from .py3compat import int2byte
+-from ..construct import ConstructError
++from construct import ConstructError
+ 
+ 
+ def bytelist2string(bytelist):
+diff --git a/elftools/dwarf/enums.py b/elftools/dwarf/enums.py
+index 6508764..a474d32 100644
+--- a/elftools/dwarf/enums.py
++++ b/elftools/dwarf/enums.py
+@@ -6,7 +6,7 @@
+ # Eli Bendersky (eliben at gmail.com)
+ # This code is in the public domain
+ #-------------------------------------------------------------------------------
+-from ..construct import Pass
++from construct import Pass
+ 
+ 
+ ENUM_DW_TAG = dict(
+diff --git a/elftools/dwarf/structs.py b/elftools/dwarf/structs.py
+index 39e4815..c50a874 100644
+--- a/elftools/dwarf/structs.py
++++ b/elftools/dwarf/structs.py
+@@ -7,7 +7,7 @@
+ # Eli Bendersky (eliben at gmail.com)
+ # This code is in the public domain
+ #-------------------------------------------------------------------------------
+-from ..construct import (
++from construct import (
+     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
+--- a/elftools/elf/enums.py
++++ b/elftools/elf/enums.py
+@@ -6,7 +6,7 @@
+ # Eli Bendersky (eliben at gmail.com)
+ # This code is in the public domain
+ #-------------------------------------------------------------------------------
+-from ..construct import Pass
++from construct import Pass
+ 
+ 
+ # e_ident[EI_CLASS] in the ELF header
+diff --git a/elftools/elf/gnuversions.py b/elftools/elf/gnuversions.py
+index 4a4473f..d4f4b75 100644
+--- a/elftools/elf/gnuversions.py
++++ b/elftools/elf/gnuversions.py
+@@ -6,7 +6,7 @@
+ # Yann Rouillard (yann at pleiades.fr.eu.org)
+ # This code is in the public domain
+ #------------------------------------------------------------------------------
+-from ..construct import CString
++from construct import CString
+ 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 at gmail.com)
+ # This code is in the public domain
+ #-------------------------------------------------------------------------------
+-from ..construct import CString
++from construct import CString
+ from ..common.utils import struct_parse, elf_assert, parse_cstring_from_stream
+ 
+ 
+diff --git a/elftools/elf/segments.py b/elftools/elf/segments.py
+index bc54da2..dfb3a14 100644
+--- a/elftools/elf/segments.py
++++ b/elftools/elf/segments.py
+@@ -6,7 +6,7 @@
+ # Eli Bendersky (eliben at gmail.com)
+ # This code is in the public domain
+ #-------------------------------------------------------------------------------
+-from ..construct import CString
++from construct import CString
+ from ..common.utils import struct_parse
+ from .constants import SH_FLAGS
+ 
+diff --git a/elftools/elf/structs.py b/elftools/elf/structs.py
+index 0862400..51b1715 100644
+--- a/elftools/elf/structs.py
++++ b/elftools/elf/structs.py
+@@ -7,7 +7,7 @@
+ # Eli Bendersky (eliben at gmail.com)
+ # This code is in the public domain
+ #-------------------------------------------------------------------------------
+-from ..construct import (
++from construct import (
+     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(
+         'elftools.elf',
+         'elftools.common',
+         'elftools.dwarf',
+-        'elftools.construct', 'elftools.construct.lib',
+         ],
+ 
+     scripts=['scripts/readelf.py']
diff --git a/pyelftools.spec b/pyelftools.spec
new file mode 100644
index 0000000..4353099
--- /dev/null
+++ b/pyelftools.spec
@@ -0,0 +1,148 @@
+%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.1.git%{commitdate}.%{shortcommit}%{?dist}
+Summary:	Pure-Python library for parsing and analyzing ELF files
+
+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
+
+BuildRequires:	python2-devel
+BuildRequires:	python-setuptools
+BuildRequires:	python-construct
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+BuildRequires:	python3-devel
+BuildRequires:	python3-setuptools
+BuildRequires:	python3-construct
+%endif
+
+%description
+Pure-Python library for parsing and analyzing ELF files
+and DWARF debugging information.
+
+
+%package -n python-%{name}
+Summary:	Pure-Python library for parsing and analyzing ELF files
+
+BuildArch:	noarch
+Requires:	python-construct
+Provides:	%{name} = %{version}-%{release}
+
+%description -n python-%{name}
+Pure-Python library for parsing and analyzing ELF files
+and DWARF debugging information.
+
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+%package -n python3-%{name}
+Summary:	Pure-Python library for parsing and analyzing ELF files
+
+BuildArch:	noarch
+Requires:	python3-construct
+
+%description -n python3-%{name}
+Pure-Python library for parsing and analyzing ELF files
+and DWARF debugging information.
+%endif
+
+
+%prep
+%setup -qn %{name}-%{commit}
+%patch0 -p1
+
+# remove bundled construct lib
+rm -rf elftools/construct
+
+# python3-package
+%if 0%{?fedora} || 0%{?rhel} >= 7
+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
+%{__python} setup.py build
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+pushd %{py3dir}
+%{__python3} setup.py build
+%endif
+
+
+%install
+%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/pyreadelf
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+pushd %{py3dir}
+%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
+mv %{buildroot}/usr/bin/readelf.py %{buildroot}/usr/bin/py3readelf
+%endif
+
+
+%check
+%{__python} test/run_all_unittests.py
+%{__python} 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
+%{__python} test/run_readelf_tests.py || :
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+%{__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
+%{__python3} test/run_readelf_tests.py || :
+%endif
+
+
+%files -n python-%{name}
+%doc CHANGES LICENSE README* TODO
+%{python_sitelib}/*elftools*
+%{_bindir}/pyreadelf
+
+%if 0%{?fedora} || 0%{?rhel} >= 7
+%files -n python3-%{name}
+%doc CHANGES LICENSE README* TODO
+%{python3_sitelib}/*elftools*
+%{_bindir}/py3readelf
+%endif
+
+
+%changelog
+* Fri Aug 16 2013 Björn Esser <bjoern.esser at gmail.com> - 0.22-0.1.git20130619.a1d9681
+- update to latest pre-release git snapshot
+- add python3-package
+- build on all arches to get some conclusion from testsuite,
+  but create noarch pkgs
+
+* Sat Jun 08 2013 Terje Rosten <terje.rosten at ntnu.no> - 0.21-2
+- Remove bundled construct lib
+
+* Thu May 09 2013 Terje Rosten <terje.rosten at ntnu.no> - 0.21-1
+- 0.21
+- Run test
+- Updated source url
+- Drop defattr
+
+* Wed Jun 06 2012 Kushal Das <kushal at fedoraproject.org> 0.20-1
+- Intial package (#829676)
diff --git a/sources b/sources
index e69de29..16a4e7f 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+78ed0325b4e81bd5c530b7695853be6c  pyelftools-0.22.git20130619.a1d9681.tar.gz


More information about the scm-commits mailing list