Re: [OE-core] [PATCH 2/2] package.bbclass: manage external sources for debug source file packaging
From: Richard Purdie <hidden>
Date: 2021-06-27 21:58:44
On Wed, 2021-06-23 at 15:06 +0200, Frederic Martinsons wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Frederic Martinsons <redacted> --- meta/classes/package.bbclass | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index cf30f33f3d..38e9065f25 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass@@ -560,13 +560,20 @@ def copydebugsources(debugsrcdir, sources, d):strip = d.getVar("STRIP") objcopy = d.getVar("OBJCOPY") workdir = d.getVar("WORKDIR") - workparentdir = os.path.dirname(os.path.dirname(workdir)) + externalsrc = d.getVar('EXTERNALSRC') + if externalsrc: + workparentdir = os.path.dirname(externalsrc) + else: + workparentdir = os.path.dirname(os.path.dirname(workdir)) + workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir) # If build path exists in sourcefile, it means toolchain did not use # -fdebug-prefix-map to compile if checkbuildpath(sourcefile, d): localsrc_prefix = workparentdir + "/" + elif externalsrc: + localsrc_prefix = os.path.join("/usr/src/debug/", workbasedir) + "/" else: localsrc_prefix = "/usr/src/debug/"
Having to change package.bbbclass to work around whatever externalsrc is doing feels rather wrong. This looks/feels like we're adding hacks on top of hacks and is going to end up with an unmaintainable mess. I'd note there are also no test cases monitoring whether this is working or regressing. The patch doesn't have a commit message and explaining anything about the problem being solved either. I don't doubt there is one but I don't think this patch is right or ready to go in... Cheers, Richard