[poky] [PULL] package.bbclass: provide debug sources in externalsrc -dbg packages

Peter Kjellerstedt peter.kjellerstedt at axis.com
Thu Apr 19 00:26:59 PDT 2018


> -----Original Message-----
> From: poky-bounces at yoctoproject.org [mailto:poky-
> bounces at yoctoproject.org] On Behalf Of Vignesh Rajendran
> Sent: den 19 april 2018 06:27
> To: poky at yoctoproject.org
> Subject: [poky] [PULL] package.bbclass: provide debug sources in externalsrc -dbg packages
> 
> The recipes which are using externalsrc method doesn't contain the
> debug sources in their -dbg packages.
> 
> Add a handling in copydebugsources function to copy the debugsources for
> externalsrc -dbg packages.
> 
> Signed-off-by: Vignesh Rajendran <vignesh.rajendran at in.bosch.com>
> ---
>  meta/classes/externalsrc.bbclass |  3 +++
>  meta/classes/package.bbclass     | 14 +++++++++++---
>  2 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/meta/classes/externalsrc.bbclass b/meta/classes/externalsrc.bbclass
> index 3f1d396..042f935 100644
> --- a/meta/classes/externalsrc.bbclass
> +++ b/meta/classes/externalsrc.bbclass
> @@ -126,6 +126,9 @@ python () {
>              d.setVar('CONFIGURESTAMPFILE', configstamp)
>              d.setVar('STAMP', '${STAMPS_DIR}/work-shared/${PN}/${EXTENDPE}${PV}-${PR}')
>              d.setVar('STAMPCLEAN', '${STAMPS_DIR}/work-shared/${PN}/*-*')
> +
> +	# set DEBUG_PREFIX_MAP to external source path
> +	d.appendVar("DEBUG_PREFIX_MAP", "-fdebug-prefix-map=${EXTERNALSRC}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}")
>  }
> 
>  python externalsrc_configure_prefunc() {
> diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
> index 504c023..9466a4b 100644
> --- a/meta/classes/package.bbclass
> +++ b/meta/classes/package.bbclass
> @@ -414,6 +414,7 @@ def copydebugsources(debugsrcdir, d):
>          workdir = d.getVar("WORKDIR")
>          workparentdir = os.path.dirname(os.path.dirname(workdir))
>          workbasedir = os.path.basename(os.path.dirname(workdir)) + "/" + os.path.basename(workdir)
> +	externalsrc = d.getVar('EXTERNALSRC', True)

Change the tab to spaces.

> 
>          # If build path exists in sourcefile, it means toolchain did not use
>          # -fdebug-prefix-map to compile
> @@ -438,10 +439,17 @@ def copydebugsources(debugsrcdir, d):
>          processdebugsrc += "fgrep -zw '%s' | "
>          # Remove prefix in the source paths
>          processdebugsrc += "sed 's#%s##g' | "
> -        processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)"
> +        # handle external sources to provide sources in -dbg packages
> +        if externalsrc:
> +            localsrc_prefix = "/usr/src/debug/"
> +            processdebugsrc += "sed 's#%s/##g' | "
> +            processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s/%s' 2>/dev/null)"
> +            cmd = processdebugsrc % (sourcefile, workbasedir, localsrc_prefix, workbasedir, externalsrc, dvar, debugsrcdir, workbasedir)
> +        else:
> +            processdebugsrc += "(cd '%s' ; cpio -pd0mlL --no-preserve-owner '%s%s' 2>/dev/null)"
> +            cmd = processdebugsrc % (sourcefile, workbasedir, localsrc_prefix, workparentdir, dvar, debugsrcdir)
> 
> -        cmd = processdebugsrc % (sourcefile, workbasedir, localsrc_prefix, workparentdir, dvar, debugsrcdir)
> -        (retval, output) = oe.utils.getstatusoutput(cmd)
> +	(retval, output) = oe.utils.getstatusoutput(cmd)

Change the tab to spaces.

>          # Can "fail" if internal headers/transient sources are attempted
>          #if retval:
>          #    bb.fatal("debug source copy failed with exit code %s (cmd was %s)" % (retval, cmd))
> --
> 2.7.4

//Peter



More information about the poky mailing list