summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOla x Nilsson <ola.x.nilsson@axis.com>2018-04-19 13:17:30 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-04-20 08:12:17 +0100
commit47651bd6aa0dea1073248e1b0eb4164d92b25d77 (patch)
tree996ecaf40ecd9d96f9a65a8ef07188c5fd3a25a0
parent59b3539e867f55e6aa6094b5a05107ae2563157a (diff)
downloadpoky-47651bd6aa0dea1073248e1b0eb4164d92b25d77.tar.gz
package.bbclass: Include dbgsrc for static libs
The debugsource must be added from the package providing the static lib, because any package using that lib does not have access to the source code. Fixes [YOCTO #12558] (From OE-Core rev: eefa5ba35663fabe1f3f8cf7f1ff126d51240613) Signed-off-by: Ola x Nilsson <olani@axis.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package.bbclass44
1 files changed, 32 insertions, 12 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 79783071bc..fff7cebbe3 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -344,6 +344,20 @@ def parse_debugsources_from_dwarfsrcfiles_output(dwarfsrcfiles_output):
344 344
345 return debugfiles.keys() 345 return debugfiles.keys()
346 346
347def append_source_info(file, sourcefile, d):
348 cmd = "'dwarfsrcfiles' '%s'" % (file)
349 (retval, output) = oe.utils.getstatusoutput(cmd)
350 # 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure
351 if retval != 0 and retval != 255:
352 bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
353
354 debugsources = parse_debugsources_from_dwarfsrcfiles_output(output)
355 # filenames are null-separated - this is an artefact of the previous use
356 # of rpm's debugedit, which was writing them out that way, and the code elsewhere
357 # is still assuming that.
358 debuglistoutput = '\0'.join(debugsources) + '\0'
359 open(sourcefile, 'a').write(debuglistoutput)
360
347 361
348def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d): 362def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
349 # Function to split a single file into two components, one is the stripped 363 # Function to split a single file into two components, one is the stripped
@@ -369,18 +383,7 @@ def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
369 383
370 # We need to extract the debug src information here... 384 # We need to extract the debug src information here...
371 if debugsrcdir: 385 if debugsrcdir:
372 cmd = "'dwarfsrcfiles' '%s'" % (file) 386 append_source_info(file, sourcefile, d)
373 (retval, output) = oe.utils.getstatusoutput(cmd)
374 # 255 means a specific file wasn't fully parsed to get the debug file list, which is not a fatal failure
375 if retval != 0 and retval != 255:
376 bb.fatal("dwarfsrcfiles failed with exit code %s (cmd was %s)%s" % (retval, cmd, ":\n%s" % output if output else ""))
377
378 debugsources = parse_debugsources_from_dwarfsrcfiles_output(output)
379 # filenames are null-separated - this is an artefact of the previous use
380 # of rpm's debugedit, which was writing them out that way, and the code elsewhere
381 # is still assuming that.
382 debuglistoutput = '\0'.join(debugsources) + '\0'
383 open(sourcefile, 'a').write(debuglistoutput)
384 387
385 bb.utils.mkdirhier(os.path.dirname(debugfile)) 388 bb.utils.mkdirhier(os.path.dirname(debugfile))
386 389
@@ -936,6 +939,15 @@ python split_and_strip_files () {
936 type |= 8 939 type |= 8
937 return type 940 return type
938 941
942 def isStaticLib(path):
943 if path.endswith('.a') and not os.path.islink(path):
944 with open(path, 'rb') as fh:
945 # The magic must include the first slash to avoid
946 # matching golang static libraries
947 magic = b'!<arch>\x0a/'
948 start = fh.read(len(magic))
949 return start == magic
950 return False
939 951
940 # 952 #
941 # First lets figure out all of the files we may have to process ... do this only once! 953 # First lets figure out all of the files we may have to process ... do this only once!
@@ -943,6 +955,7 @@ python split_and_strip_files () {
943 elffiles = {} 955 elffiles = {}
944 symlinks = {} 956 symlinks = {}
945 kernmods = [] 957 kernmods = []
958 staticlibs = []
946 inodes = {} 959 inodes = {}
947 libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir")) 960 libdir = os.path.abspath(dvar + os.sep + d.getVar("libdir"))
948 baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir")) 961 baselibdir = os.path.abspath(dvar + os.sep + d.getVar("base_libdir"))
@@ -955,6 +968,9 @@ python split_and_strip_files () {
955 if file.endswith(".ko") and file.find("/lib/modules/") != -1: 968 if file.endswith(".ko") and file.find("/lib/modules/") != -1:
956 kernmods.append(file) 969 kernmods.append(file)
957 continue 970 continue
971 if isStaticLib(file):
972 staticlibs.append(file)
973 continue
958 974
959 # Skip debug files 975 # Skip debug files
960 if debugappend and file.endswith(debugappend): 976 if debugappend and file.endswith(debugappend):
@@ -1033,6 +1049,10 @@ python split_and_strip_files () {
1033 # Only store off the hard link reference if we successfully split! 1049 # Only store off the hard link reference if we successfully split!
1034 splitdebuginfo(file, fpath, debugsrcdir, sourcefile, d) 1050 splitdebuginfo(file, fpath, debugsrcdir, sourcefile, d)
1035 1051
1052 if debugsrcdir:
1053 for file in staticlibs:
1054 append_source_info(file, sourcefile, d)
1055
1036 # Hardlink our debug symbols to the other hardlink copies 1056 # Hardlink our debug symbols to the other hardlink copies
1037 for ref in inodes: 1057 for ref in inodes:
1038 if len(inodes[ref]) == 1: 1058 if len(inodes[ref]) == 1: