Skip to contentSkip to conversation

package.bbclass: replace rpm/debugedit with dwarfsrcfiles

PATCH In review Alexander Kanavin 2 participants 3 messages Nov 10, 2017 – Nov 13, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package.bbclass: replace rpm/debugedit with dwarfsrcfiles

Debugedit provided by rpm 4.14 is rewriting binaries in-place, and was found to produce broken output at least for grub:
http://lists.openembedded.org/pipermail/openembedded-core/2017-November/143989.html

A replacement utility was suggested via private mail:
https://lists.fedorahosted.org/archives/list/[email protected]/message/VZP4G5N2ELYZEDAB3QYLXYHDGX4WMCUF/

---
 meta/classes/package.bbclass                       |  26 ++++-
 .../dwarfsrcfiles/dwarfsrcfiles.bb                 |  22 ++++
 .../dwarfsrcfiles/files/dwarfsrcfiles.c            | 111 +++++++++++++++++++++
 3 files changed, 154 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-devtools/dwarfsrcfiles/dwarfsrcfiles.bb
 create mode 100644 meta/recipes-devtools/dwarfsrcfiles/files/dwarfsrcfiles.c
meta/classes/package.bbclass +21 -5
index 2053d46395a..dd1cfa379b0 100644
@@ -52,7 +52,8 @@ LOCALE_SECTION ?= ''
 ALL_MULTILIB_PACKAGE_ARCHS = "${@all_multilib_tune_values(d, 'PACKAGE_ARCHS')}"
 
 # rpm is used for the per-file dependency identification
-PACKAGE_DEPENDS += "rpm-native"
+# dwarfsrcfiles is used to determine the list of debug source files
+PACKAGE_DEPENDS += "rpm-native dwarfsrcfiles-native"
 
 
 # If your postinstall can execute at rootfs creation time rather than on
@@ -334,6 +335,16 @@ def checkbuildpath(file, d):
 
     return False
 
+def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output):
+    debugfiles = {}
+
+    for line in dwarfsrcfiles_output.splitlines():
+        if line.startswith("\t"):
+            debugfiles[os.path.normpath(line.split()[0])] = ""
+
+    return debugfiles.keys()
+
+
 def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
     # Function to split a single file into two components, one is the stripped
     # target system binary, the other contains any debugging information. The
@@ -345,7 +356,6 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
 
     dvar = d.getVar('PKGD')
     objcopy = d.getVar("OBJCOPY")
-    debugedit = d.expand("${STAGING_LIBDIR_NATIVE}/rpm/debugedit")
 
     # We ignore kernel modules, we don't generate debug info files.
     if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
@@ -359,10 +369,17 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
 
     # We need to extract the debug src information here...
     if debugsrcdir:
-        cmd = "'%s' -i -l '%s' '%s'" % (debugedit, sourcefile, file)
+        cmd = "'dwarfsrcfiles' '%s'" % (file)
         (retval, output) = oe.utils.getstatusoutput(cmd)
         if retval:
-            bb.fatal("debugedit failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
+            bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
+
+        debugsources = parse_debugsources_from_dwarfsrcfiles_output(output)
+        # filenames are null-separated - this is an artefact of the previous use
+        # of rpm's debugedit, which was writing them out that way, and the code elsewhere
+        # is still assuming that.
+        debuglistoutput = '\0'.join(debugsources) + '\0'
+        open(sourcefile, 'a').write(debuglistoutput)
 
     bb.utils.mkdirhier(os.path.dirname(debugfile))
 
@@ -393,7 +410,6 @@ def copydebugsources(debugsrcdir, d):
         dvar = d.getVar('PKGD')
         strip = d.getVar("STRIP")
         objcopy = d.getVar("OBJCOPY")
-        debugedit = d.expand("${STAGING_LIBDIR_NATIVE}/rpm/bin/debugedit")
         workdir = d.getVar("WORKDIR")
         workparentdir = os.path.dirname(os.path.dirname(workdir))
         workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir)
meta/recipes-devtools/dwarfsrcfiles/dwarfsrcfiles.bb new file +22 -0
new file mode 100644
index 00000000000..c59a006edae
@@ -0,0 +1,22 @@
+SUMMARY = "A small utility for printing debig source file locations embedded in binaries"
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://../dwarfsrcfiles.c;md5=31483894e453a77acbb67847565f1b5c;beginline=1;endline=8"
+
+SRC_URI = "file://dwarfsrcfiles.c"
+BBCLASSEXTEND = "native"
+DEPENDS = "elfutils"
+DEPENDS_append_libc-musl = " argp-standalone"
+
+do_compile () {
+	${CC} ${CFLAGS} ${LDFLAGS} -o dwarfsrcfiles ../dwarfsrcfiles.c -lelf -ldw
+}
+
+do_compile_libc-musl () {
+	${CC} ${CFLAGS} ${LDFLAGS} -o dwarfsrcfiles ../dwarfsrcfiles.c -lelf -ldw -largp 
+}
+
+do_install () {
+	install -d ${D}${bindir}
+	install -t ${D}${bindir} dwarfsrcfiles
+}
+
meta/recipes-devtools/dwarfsrcfiles/files/dwarfsrcfiles.c new file +111 -0

111 lines not on this page · raw message

Signature · 1 line
2.14.2
#1 lore raw

PATCH 2/2 rpm: update to 4.14.0

Previously oe-core had a development snapshot of rpm, it's better to update to something more stable.

Removed patches:
0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch (upstream is using pkg-config) 0001-When-nice-value-cannot-be-reset-issue-a-notice-inste.patch (functionality has been moved to a plugin, we disable plugins for rpm-native) 0012-Use-conditional-to-access-_docdir-in-macros.in.patch (merged upstream)

Changed patches:
0001-Fix-build-with-musl-C-library.patch
(one previous musl issue has been resolved upstream; another has been added)

Rest of the patches are trivial rebases.

---
 ...N_ABI-when-searching-for-python-libraries.patch | 30 ----------
 ...code-lib-rpm-as-the-installation-path-for.patch | 20 +++----
 .../files/0001-Fix-build-with-musl-C-library.patch | 66 +++++++---------------
 ...alue-cannot-be-reset-issue-a-notice-inste.patch | 31 ----------
 ...c-remove-static-local-variables-from-buil.patch | 54 +++++++++---------
 ...ire-that-ELF-binaries-are-executable-to-b.patch | 11 ++--
 ...onditional-to-access-_docdir-in-macros.in.patch | 36 ------------
 .../0013-Add-a-new-option-alldeps-to-rpmdeps.patch | 17 +++---
 .../rpm/{rpm_git.bb => rpm_4.14.0.bb}              |  9 +--
 9 files changed, 75 insertions(+), 199 deletions(-)
 delete mode 100644 meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch
 delete mode 100644 meta/recipes-devtools/rpm/files/0001-When-nice-value-cannot-be-reset-issue-a-notice-inste.patch
 delete mode 100644 meta/recipes-devtools/rpm/files/0012-Use-conditional-to-access-_docdir-in-macros.in.patch
 rename meta/recipes-devtools/rpm/{rpm_git.bb => rpm_4.14.0.bb} (92%)
meta/recipes-devtools/rpm/files/0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch deleted +0 -30
deleted file mode 100644
index b809332f217..00000000000
@@ -1,30 +0,0 @@
-From 36cf0ff26ece53e529e8b4f2d2f09acd8794b055 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <[email protected]>
-Date: Fri, 24 Mar 2017 15:35:47 +0200
-Subject: [PATCH] Add PYTHON_ABI when searching for python libraries.
-
-It has a value of 'm' when using Python3, and so without it
-configure will not find the libraries.
-
-Upstream-Status: Inappropriate [oe-core specific]
-Signed-off-by: Alexander Kanavin <[email protected]>
----
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/configure.ac b/configure.ac
-index 9c58467c1..a506ec819 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -642,7 +642,7 @@ AS_IF([test "$enable_python" = yes],[
-       ])
-     CPPFLAGS="$save_CPPFLAGS"
-     save_LIBS="$LIBS"
--    AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION} python],[
-+    AC_SEARCH_LIBS([Py_Main],[python${PYTHON_VERSION}${PYTHON_ABI} python],[
-       WITH_PYTHON_LIB="$ac_res"
-     ],[AC_MSG_ERROR([missing python library])
-     ])
--- 
-2.11.0
-
meta/recipes-devtools/rpm/files/0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch +10 -10
index 1f61acaf431..d7b1145bc5b 100644
@@ -1,10 +1,10 @@
-From d82691b8d58201dd03e30585daacd8ffd1556ae2 Mon Sep 17 00:00:00 2001
+From 2b1a3f900f15034943fc41661eaab41bcc0d4d84 Mon Sep 17 00:00:00 2001
 From: Alexander Kanavin <[email protected]>
 Date: Mon, 27 Feb 2017 09:43:30 +0200
-Subject: [PATCH] Do not hardcode "lib/rpm" as the installation path for
+Subject: [PATCH 06/15] Do not hardcode "lib/rpm" as the installation path for
  default configuration and macros.
 
-Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/263]
+Upstream-Status: Denied [https://github.com/rpm-software-management/rpm/pull/263]
 Signed-off-by: Alexander Kanavin <[email protected]>
 
 ---
@@ -14,10 +14,10 @@ Signed-off-by: Alexander Kanavin <[email protected]>
  3 files changed, 4 insertions(+), 4 deletions(-)
 
 diff --git a/configure.ac b/configure.ac
-index 4f3be8770..92ffd3d68 100644
+index 373d69484..c04a2e8d1 100644
 --- a/configure.ac
 +++ b/configure.ac
-@@ -875,7 +875,7 @@ else
+@@ -1038,7 +1038,7 @@ else
      usrprefix=$prefix
  fi
  
@@ -27,10 +27,10 @@ index 4f3be8770..92ffd3d68 100644
  
  AC_SUBST(OBJDUMP)
 diff --git a/macros.in b/macros.in
-index c6d5a6b03..84ae25275 100644
+index 3f8dbba61..da4812540 100644
 --- a/macros.in
 +++ b/macros.in
-@@ -877,7 +877,7 @@ package or when debugging this package.\
+@@ -954,7 +954,7 @@ package or when debugging this package.\
  %_sharedstatedir	%{_prefix}/com
  %_localstatedir		%{_prefix}/var
  %_lib			lib
@@ -40,7 +40,7 @@ index c6d5a6b03..84ae25275 100644
  %_infodir		%{_datadir}/info
  %_mandir		%{_datadir}/man
 diff --git a/rpm.am b/rpm.am
-index 1f43ad8a0..6854ff6ba 100644
+index f0df0202f..37205a5eb 100644
 --- a/rpm.am
 +++ b/rpm.am
 @@ -1,10 +1,10 @@
@@ -55,7 +55,7 @@ index 1f43ad8a0..6854ff6ba 100644
 +rpmconfigdir = $(libdir)/rpm
  
  # Libtool version (current-revision-age) for all our libraries
- rpm_version_info = 7:0:0
+ rpm_version_info = 8:0:0
 -- 
-2.11.0
+2.14.2
 
meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch +20 -46

91 lines not on this page · raw message

meta/recipes-devtools/rpm/files/0001-When-nice-value-cannot-be-reset-issue-a-notice-inste.patch deleted +0 -31
deleted file mode 100644
index 9648cac7c9b..00000000000
@@ -1,31 +0,0 @@
-From d42ece6fa15b98d7f9221b90b85b78631df2c0a0 Mon Sep 17 00:00:00 2001
-From: Alexander Kanavin <[email protected]>
-Date: Tue, 14 Feb 2017 13:51:19 +0200
-Subject: [PATCH] When nice value cannot be reset, issue a notice instead of a
- warning
-
-Otherwise build logs on the autobuilder get very clutter, as it
-doesn't allow the nice value to be reset for some reason.
-
-Upstream-Status: Inappropriate [oe specific]
-Signed-off-by: Alexander Kanavin <[email protected]>
----
- lib/rpmscript.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/lib/rpmscript.c b/lib/rpmscript.c
-index 5e1e99906..3975aead8 100644
---- a/lib/rpmscript.c
-+++ b/lib/rpmscript.c
-@@ -347,7 +347,7 @@ static rpmRC runExtScript(rpmPlugins plugins, ARGV_const_t prefixes,
-         int ret;
-         ret = setpriority(PRIO_PROCESS, 0, 0);
-         if (ret == -1) {
--            rpmlog(RPMLOG_WARNING, _("Unable to reset nice value: %s"),
-+            rpmlog(RPMLOG_NOTICE, _("Unable to reset nice value: %s\n"),
-                 strerror(errno));
-         }
- 
--- 
-2.11.0
-
meta/recipes-devtools/rpm/files/0004-build-pack.c-remove-static-local-variables-from-buil.patch +28 -26

188 lines not on this page · raw message

meta/recipes-devtools/rpm/files/0011-Do-not-require-that-ELF-binaries-are-executable-to-b.patch +6 -5
index c910a478eea..4ac5c38f063 100644
@@ -1,7 +1,7 @@
-From d65d6e8760afbd7f70b22a1f3297a037bc475fea Mon Sep 17 00:00:00 2001
+From 5141d50d7b3d3c209a22c53deedb4ceef014401d Mon Sep 17 00:00:00 2001
 From: Peter Kjellerstedt <[email protected]>
 Date: Mon, 15 May 2017 10:21:08 +0200
-Subject: [PATCH 11/13] Do not require that ELF binaries are executable to be
+Subject: [PATCH 09/15] Do not require that ELF binaries are executable to be
  identifiable
 
 There is nothing that requires, e.g., a DSO to be executable, but it
@@ -14,19 +14,20 @@ or not.
 
 Upstream-Status: Inappropriate
 Signed-off-by: Peter Kjellerstedt <[email protected]>
+
 ---
  fileattrs/elf.attr | 1 -
  1 file changed, 1 deletion(-)
 
 diff --git a/fileattrs/elf.attr b/fileattrs/elf.attr
-index 595b33e09..bac52649d 100644
+index 5805dd0ee..3516f309d 100644
 --- a/fileattrs/elf.attr
 +++ b/fileattrs/elf.attr
 @@ -1,4 +1,3 @@
  %__elf_provides		%{_rpmconfigdir}/elfdeps --provides %{?__filter_GLIBC_PRIVATE:--filter-private}
  %__elf_requires		%{_rpmconfigdir}/elfdeps --requires %{?__filter_GLIBC_PRIVATE:--filter-private}
- %__elf_magic		^(setuid )?(setgid )?(sticky )?ELF (32|64)-bit.*$
+ %__elf_magic		^(setuid,? )?(setgid,? )?(sticky )?ELF (32|64)-bit.*$
 -%__elf_flags		exeonly
 -- 
-2.12.0
+2.14.2
 
meta/recipes-devtools/rpm/files/0012-Use-conditional-to-access-_docdir-in-macros.in.patch deleted +0 -36
deleted file mode 100644
index 996da90d43d..00000000000
@@ -1,36 +0,0 @@
-From 77808db4036dc4a012c47aca36255549ed764a6a Mon Sep 17 00:00:00 2001
-From: Peter Kjellerstedt <[email protected]>
-Date: Tue, 16 May 2017 10:58:18 +0200
-Subject: [PATCH 12/13] Use conditional to access %{_docdir} in macros.in
-
-This avoids the following warning:
-
-warning: Ignoring invalid regex %{_docdir}
-
-when runing `rpmdeps -R <file>`, since %{_docdir} is only defined when
-parsing a spec file (in parseSpec()).
-
-Upstream-Status: Accepted [https://github.com/rpm-software-management/rpm/pull/216]
-Signed-off-by: Peter Kjellerstedt <[email protected]>
----
- macros.in | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/macros.in b/macros.in
-index 84ae25275..cca67a500 100644
---- a/macros.in
-+++ b/macros.in
-@@ -200,8 +200,8 @@ package or when debugging this package.\
- # Their purpouse is to set up global filtering for all packages. If you need
- # to set up specific filtering for your package use %__requires_exclude_from
- # and %__provides_exclude_from instead.
--%__global_requires_exclude_from		%{_docdir}
--%__global_provides_exclude_from		%{_docdir}
-+%__global_requires_exclude_from		%{?_docdir:%{_docdir}}
-+%__global_provides_exclude_from		%{?_docdir:%{_docdir}}
- 
- #	The path to the gzip executable (legacy, use %{__gzip} instead).
- %_gzipbin		%{__gzip}
--- 
-2.12.0
-
meta/recipes-devtools/rpm/files/0013-Add-a-new-option-alldeps-to-rpmdeps.patch +9 -8
index faaf62960c1..d84e8b54d8d 100644
@@ -1,7 +1,7 @@
-From 3bf20a6116ae3e1a5a3a6907bee7e881b17efb2f Mon Sep 17 00:00:00 2001
+From ef9f8c17c3e5c35d3b55db9ca76b0fa0d6336421 Mon Sep 17 00:00:00 2001
 From: Peter Kjellerstedt <[email protected]>
 Date: Mon, 15 May 2017 11:23:26 +0200
-Subject: [PATCH 13/13] Add a new option --alldeps to rpmdeps
+Subject: [PATCH 10/15] Add a new option --alldeps to rpmdeps
 
 This will send the output from rpmfcPrint() to stdout. This is an
 alternative to using the --rpmfcdebug option, which will send the same
@@ -12,6 +12,7 @@ output options, e.g., --requires, without affecting their output.
 
 Upstream-Status: Submitted [https://github.com/rpm-software-management/rpm/pull/220]
 Signed-off-by: Peter Kjellerstedt <[email protected]>
+
 ---
  build/rpmfc.c   | 27 ++++++++++++++-------------
  build/rpmfc.h   |  1 -
@@ -19,10 +20,10 @@ Signed-off-by: Peter Kjellerstedt <[email protected]>
  3 files changed, 39 insertions(+), 33 deletions(-)
 
 diff --git a/build/rpmfc.c b/build/rpmfc.c
-index c8e2f876a..44f1cdc9a 100644
+index b8aea76d0..d04ffb297 100644
 --- a/build/rpmfc.c
 +++ b/build/rpmfc.c
-@@ -732,7 +732,6 @@ static rpm_color_t rpmfcColor(const char * fmstr)
+@@ -692,7 +692,6 @@ static rpm_color_t rpmfcColor(const char * fmstr)
  
  void rpmfcPrint(const char * msg, rpmfc fc, FILE * fp)
  {
@@ -30,7 +31,7 @@ index c8e2f876a..44f1cdc9a 100644
      int ndx;
      int dx;
      int fx;
-@@ -744,21 +743,23 @@ void rpmfcPrint(const char * msg, rpmfc fc, FILE * fp)
+@@ -704,21 +703,23 @@ void rpmfcPrint(const char * msg, rpmfc fc, FILE * fp)
  
      if (fc)
      for (fx = 0; fx < fc->nfiles; fx++) {
@@ -79,7 +80,7 @@ index dae8ea5b1..3d87b31cf 100644
   * @param fc		file classifier
   * @param fp		output file handle (NULL for stderr)
 diff --git a/tools/rpmdeps.c b/tools/rpmdeps.c
-index a414b6343..f260a38c4 100644
+index 419befce1..f260a38c4 100644
 --- a/tools/rpmdeps.c
 +++ b/tools/rpmdeps.c
 @@ -23,6 +23,8 @@ static int print_conflicts;
@@ -105,7 +106,7 @@ index a414b6343..f260a38c4 100644
  	goto exit;
  
 -    if (_rpmfc_debug)
--	rpmfcPrint(buf, fc, NULL);
+-	rpmfcPrint(NULL, fc, NULL);
 -
 -    if (print_provides)
 -	rpmdsPrint(NULL, rpmfcProvides(fc), stdout);
@@ -148,5 +149,5 @@ index a414b6343..f260a38c4 100644
      ec = 0;
  
 -- 
-2.12.0
+2.14.2
 
meta/recipes-devtools/rpm/rpm_4.14.0.bb renamed from meta/recipes-devtools/rpm/rpm_git.bb +2 -7
similarity index 92%
rename from meta/recipes-devtools/rpm/rpm_git.bb
rename to meta/recipes-devtools/rpm/rpm_4.14.0.bb
index 7866314ad4b..e4e9c3e6341 100644
@@ -24,19 +24,16 @@ HOMEPAGE = "http://www.rpm.org"
 LICENSE = "GPL-2.0"
 LIC_FILES_CHKSUM = "file://COPYING;md5=f5259151d26ff18e78023450a5ac8d96"
 
-SRC_URI = "git://github.com/rpm-software-management/rpm \
+SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.14.x \
            file://0001-Do-not-add-an-unsatisfiable-dependency-when-building.patch \
            file://0001-Do-not-read-config-files-from-HOME.patch \
            file://0001-When-cross-installing-execute-package-scriptlets-wit.patch \
            file://0001-Do-not-reset-the-PATH-environment-variable-before-ru.patch \
            file://0002-Add-support-for-prefixing-etc-from-RPM_ETCCONFIGDIR-.patch \
-           file://0001-When-nice-value-cannot-be-reset-issue-a-notice-inste.patch \
            file://0001-Do-not-hardcode-lib-rpm-as-the-installation-path-for.patch \
            file://0001-Fix-build-with-musl-C-library.patch \
            file://0001-Add-a-color-setting-for-mips64_n32-binaries.patch \
-           file://0001-Add-PYTHON_ABI-when-searching-for-python-libraries.patch \
            file://0011-Do-not-require-that-ELF-binaries-are-executable-to-b.patch \
-           file://0012-Use-conditional-to-access-_docdir-in-macros.in.patch \
            file://0013-Add-a-new-option-alldeps-to-rpmdeps.patch \
            file://0001-Split-binary-package-building-into-a-separate-functi.patch \
            file://0002-Run-binary-package-creation-via-thread-pools.patch \
@@ -44,11 +41,9 @@ SRC_URI = "git://github.com/rpm-software-management/rpm \
            file://0004-build-pack.c-remove-static-local-variables-from-buil.patch \
            file://0001-perl-disable-auto-reqs.patch \
            "
-UPSTREAM_VERSION_UNKNOWN = "1"
 
-PV = "4.13.90+git${SRCPV}"
 PE = "1"
-SRCREV = "a8e51b3bb05c6acb1d9b2e3d34f859ddda1677be"
+SRCREV = "da3720f62e57648fb1dc2a632744d38866139971"
 
 S = "${WORKDIR}/git"
 
Signature · 1 line
2.14.2
#2 lore raw
In reply to Alexander Kanavin

I just had a build with these patches fail:

ERROR: libice-1_1.0.9-r0 do_package: Error executing a python function in exec_python_func() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>

     0001:
 *** 0002:package_do_filedeps(d)
     0003:
File: '/home/ross/Yocto/poky/meta/classes/package.bbclass', lineno: 1500,
function: package_do_filedeps
     1496:            continue
     1497:        for files in chunks(pkgfiles[pkg], 100):
     1498:            pkglist.append((pkg, files, rpmdeps, pkgdest))
     1499:
 *** 1500:    processed = oe.utils.multiprocess_exec( pkglist,
oe.package.filedeprunner)
     1501:
     1502:    provides_files = {}
     1503:    requires_files = {}
     1504:

File: '/home/ross/Yocto/poky/meta/lib/oe/utils.py', lineno: 240, function:
multiprocess_exec
0236: mapresult = pool.map_async(function, commands,
error_callback=failures)

     0237:
     0238:        pool.close()
     0239:        pool.join()
 *** 0240:        results = mapresult.get()
     0241:    except KeyboardInterrupt:
     0242:        pool.terminate()
     0243:        pool.join()
     0244:        raise

File: '/usr/lib/python3.5/multiprocessing/pool.py', lineno: 608, function:
get
0604: raise TimeoutError
0605: if self._success:
0606: return self._value
0607: else:
*** 0608: raise self._value
0609:
0610: def _set(self, i, obj):
0611: self._success, self._value = obj
0612: if self._callback and self._success:
Exception: FileNotFoundError: [Errno 2] No such file or directory:
'/data/poky-tmp/master/build/work/corei7-64-poky-linux/libice/1_1.0.9-r0/recipe-sysroot-native/usr/lib/rpm/rpmdeps'

ERROR: libice-1_1.0.9-r0 do_package: Function failed: package_do_filedeps
ERROR: Logfile of failure stored in:
/data/poky-tmp/master/build/work/corei7-64-poky-linux/libice/1_1.0.9-r0/temp/log.do_package.4349
ERROR: Task (/home/ross/Yocto/poky/meta/recipes-graphics/xorg-lib/libice_1.0.9.bb:do_package) failed with exit code '1'

Quoted 260 lines · Alexander Kanavin

Debugedit provided by rpm 4.14 is rewriting binaries in-place, and was found to produce broken output at least for grub:
http://lists.openembedded.org/pipermail/openembedded-core/
2017-November/143989.html

A replacement utility was suggested via private mail:
https://lists.fedorahosted.org/archives/list/elfutils-
[email protected]/message/VZP4G5N2ELYZEDAB3QYLXYHDGX4WMCUF/

---
 meta/classes/package.bbclass                       |  26 ++++-
 .../dwarfsrcfiles/dwarfsrcfiles.bb                 |  22 ++++
 .../dwarfsrcfiles/files/dwarfsrcfiles.c            | 111
+++++++++++++++++++++
 3 files changed, 154 insertions(+), 5 deletions(-)
 create mode 100644 meta/recipes-devtools/dwarfsrcfiles/dwarfsrcfiles.bb
 create mode 100644 meta/recipes-devtools/dwarfsrcfiles/files/

dwarfsrcfiles.c

meta/classes/package.bbclass +0 -0
index 2053d46395a..dd1cfa379b0 100644
@@ -52,7 +52,8 @@ LOCALE_SECTION ?= ''
 ALL_MULTILIB_PACKAGE_ARCHS = "${@all_multilib_tune_values(d,

'PACKAGE_ARCHS')}"

 # rpm is used for the per-file dependency identification
meta/classes/package.bbclass +12 -1
-PACKAGE_DEPENDS += "rpm-native"
+# dwarfsrcfiles is used to determine the list of debug source files
+PACKAGE_DEPENDS += "rpm-native dwarfsrcfiles-native"
 
 
 # If your postinstall can execute at rootfs creation time rather than on
@@ -334,6 +335,16 @@ def checkbuildpath(file, d):
 
     return False
 
+def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output):
+    debugfiles = {}
+
+    for line in dwarfsrcfiles_output.splitlines():
+        if line.startswith("\t"):
+            debugfiles[os.path.normpath(line.split()[0])] = ""
+
+    return debugfiles.keys()
+
+
 def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
     # Function to split a single file into two components, one is the

stripped

     # target system binary, the other contains any debugging information.
The
meta/classes/package.bbclass +0 -0
@@ -345,7 +356,6 @@ def splitdebuginfo(file, debugfile, debugsrcdir,

sourcefile, d):

dvar = d.getVar('PKGD')
objcopy = d.getVar("OBJCOPY")

meta/classes/package.bbclass +0 -1
-    debugedit = d.expand("${STAGING_LIBDIR_NATIVE}/rpm/debugedit")
 
     # We ignore kernel modules, we don't generate debug info files.
     if file.find("/lib/modules/") != -1 and file.endswith(".ko"):
@@ -359,10 +369,17 @@ def splitdebuginfo(file, debugfile, debugsrcdir,

sourcefile, d):

# We need to extract the debug src information here... if debugsrcdir:

meta/classes/package.bbclass +1 -2
-        cmd = "'%s' -i -l '%s' '%s'" % (debugedit, sourcefile, file)
+        cmd = "'dwarfsrcfiles' '%s'" % (file)
         (retval, output) = oe.utils.getstatusoutput(cmd)
         if retval:
-            bb.fatal("debugedit failed with exit code %s (cmd was %s)%s"

% (retval, cmd, ":\n%s" % output if output else ""))
+ bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was
%s)%s" % (retval, cmd, ":\n%s" % output if output else ""))

meta/classes/package.bbclass +2 -0
+
+        debugsources = parse_debugsources_from_

dwarfsrcfiles_output(output)
+ # filenames are null-separated - this is an artefact of the
previous use
+ # of rpm's debugedit, which was writing them out that way, and
the code elsewhere

meta/classes/package.bbclass +3 -1
+        # is still assuming that.
+        debuglistoutput = '\0'.join(debugsources) + '\0'
+        open(sourcefile, 'a').write(debuglistoutput)
 
     bb.utils.mkdirhier(os.path.dirname(debugfile))
@@ -393,7 +410,6 @@ def copydebugsources(debugsrcdir, d):
         dvar = d.getVar('PKGD')
         strip = d.getVar("STRIP")
         objcopy = d.getVar("OBJCOPY")
-        debugedit = d.expand("${STAGING_LIBDIR_
 NATIVE}/rpm/bin/debugedit")
         workdir = d.getVar("WORKDIR")
         workparentdir = os.path.dirname(os.path.dirname(workdir))

workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" +
os.path.basename(workdir)

meta/recipes-devtools/dwarfsrcfiles/dwarfsrcfiles.bb new file +1 -0
new file mode 100644
index 00000000000..c59a006edae
@@ -0,0 +1,22 @@
+SUMMARY = "A small utility for printing debig source file locations

embedded in binaries"

meta/recipes-devtools/dwarfsrcfiles/dwarfsrcfiles.bb new file +2 -0
+LICENSE = "GPLv2+"
+LIC_FILES_CHKSUM = "file://../dwarfsrcfiles.c;md5=

31483894e453a77acbb67847565f1b5c;beginline=1;endline=8"

meta/recipes-devtools/dwarfsrcfiles/dwarfsrcfiles.bb new file +19 -2
+
+SRC_URI = "file://dwarfsrcfiles.c"
+BBCLASSEXTEND = "native"
+DEPENDS = "elfutils"
+DEPENDS_append_libc-musl = " argp-standalone"
+
+do_compile () {
+       ${CC} ${CFLAGS} ${LDFLAGS} -o dwarfsrcfiles ../dwarfsrcfiles.c
-lelf -ldw
+}
+
+do_compile_libc-musl () {
+       ${CC} ${CFLAGS} ${LDFLAGS} -o dwarfsrcfiles ../dwarfsrcfiles.c
-lelf -ldw -largp
+}
+
+do_install () {
+       install -d ${D}${bindir}
+       install -t ${D}${bindir} dwarfsrcfiles
+}
+
meta/recipes-devtools/dwarfsrcfiles/files/dwarfsrcfiles.c new file +1 -0
new file mode 100644
index 00000000000..af7af524ebe
@@ -0,0 +1,111 @@
+// dwarfsrcfiles.c - Get source files associated with the dwarf in a elf

file.

meta/recipes-devtools/dwarfsrcfiles/files/dwarfsrcfiles.c new file +110 -1
+// gcc -Wall -g -O2 -lelf -ldw -o dwarfsrcfiles dwarfsrcfiles.c
+//
+// Copyright (C) 2011, Mark Wielaard <[email protected]>
+//
+// This file is free software.  You can redistribute it and/or modify
+// it under the terms of the GNU General Public License (GPL); either
+// version 2, or (at your option) any later version.
+
+#include <argp.h>
+#include <stdio.h>
+
+#include <dwarf.h>
+#include <elfutils/libdw.h>
+#include <elfutils/libdwfl.h>
+
+static int
+process_cu (Dwarf_Die *cu_die)
+{
+  Dwarf_Attribute attr;
+  const char *name;
+  const char *dir = NULL;
+
+  Dwarf_Files *files;
+  size_t n;
+  int i;
+
+  if (dwarf_tag (cu_die) != DW_TAG_compile_unit)
+    {
+      fprintf (stderr, "DIE isn't a compile unit");
+      return -1;
+    }
+
+  if (dwarf_attr (cu_die, DW_AT_name, &attr) == NULL)
+    {
+      fprintf(stderr, "CU doesn't have a DW_AT_name");
+      return -1;
+    }
+
+  name = dwarf_formstring (&attr);
+  if (name == NULL)
+    {
+      fprintf(stderr, "Couldn't get DW_AT_name as string, %s",
+            dwarf_errmsg (-1));
+      return -1;
+    }
+
+  if (dwarf_attr (cu_die, DW_AT_comp_dir, &attr) != NULL)
+    {
+      dir = dwarf_formstring (&attr);
+      if (dir == NULL)
+       {
+         fprintf(stderr, "Couldn't get DW_AT_comp_die as string, %s",
+                dwarf_errmsg (-1));
+         return -1;
+       }
+    }
+
+  if (dir == NULL)
+    printf ("%s\n", name);
+  else
+    printf ("%s/%s\n", dir, name);
+
+  if (dwarf_getsrcfiles (cu_die, &files, &n) != 0)
+    {
+      fprintf(stderr, "Couldn't get CU file table, %s",
+            dwarf_errmsg (-1));
+      return -1;
+    }
+
+  for (i = 1; i < n; i++)
+    {
+      const char *file = dwarf_filesrc (files, i, NULL, NULL);
+      if (dir != NULL && file[0] != '/')
+       printf ("\t%s/%s\n", dir, file);
+      else
+       printf ("\t%s\n", file);
+    }
+
+  return 0;
+}
+
+int
+main (int argc, char **argv)
+{
+  char* args[3];
+  int res = 0;
+  Dwfl *dwfl;
+  Dwarf_Addr bias;
+
+  if (argc != 2)
+    fprintf(stderr, "Usage %s <file>", argv[0]);
+
+  // Pretend "dwarfsrcfiles -e <file>" was given, so we can use standard
+  // dwfl argp parser to open the file for us and get our Dwfl. Useful
+  // in case argument is an ET_REL file (like kernel modules). libdwfl
+  // will fix up relocations for us.
+  args[0] = argv[0];
+  args[1] = "-e";
+  args[2] = argv[1];
+
+  argp_parse (dwfl_standard_argp (), 3, args, 0, NULL, &dwfl);
+
+  Dwarf_Die *cu = NULL;
+  while ((cu = dwfl_nextcu (dwfl, cu, &bias)) != NULL)
+    res |= process_cu (cu);
+
+  dwfl_end (dwfl);
+
+  return res;
+}
--

2.14.2

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core