On Mon, 2026-10-26 at 09:55 +0100, Enguerrand de Ribaucourt via
lists.openembedded.org wrote:
> With devtool modify, Cargo sources can live outside WORKDIR, so the
> standard Rust remaps leave the workspace path in DWARF and package QA
> rejects the debug package. Append a workspace-specific remap to
> RUST_DEBUG_REMAP in a managed bbappend section so repeated ide-sdk
> runs
> restore and reparse it.
> 
> AI-Generated: Uses GitHub Copilot
> Signed-off-by: Enguerrand de Ribaucourt
> <[email protected]>
> ---
>  scripts/lib/devtool/ide_sdk.py | 38 ++++++++++++++++++++++++++++----
> ------
>  1 file changed, 28 insertions(+), 10 deletions(-)
> 
> diff --git a/scripts/lib/devtool/ide_sdk.py
> b/scripts/lib/devtool/ide_sdk.py
> index f22a98cedf..9fd95f0a63 100755
> --- a/scripts/lib/devtool/ide_sdk.py
> +++ b/scripts/lib/devtool/ide_sdk.py
> @@ -823,6 +823,7 @@ class RecipeModified:
>      VALID_BASH_ENV_NAME_CHARS = re.compile(r"^[a-zA-Z0-9_]*$")
>  
>      MARKER = '# devtool ide-sdk: clangd toolchain support'
> +    CARGO_REMAP_MARKER = '# devtool ide-sdk: Cargo source debug
> remap'
>  
>      # PROVIDES of recipes that are deployed via do_deploy (e.g. to
>      # DEPLOY_DIR_IMAGE) rather than installed into the rootfs, so
> adding them
> @@ -943,13 +944,14 @@ class RecipeModified:
>                  content = f.read()
>              originals[name] = content
>              stripped = cls._strip_marker_section(content,
> cls.MARKER)
> +            stripped = cls._strip_marker_section(stripped,
> cls.CARGO_REMAP_MARKER)
>              if stripped != content:
>                  with open(bbappend, 'w') as f:
>                      f.write(stripped)
>          return originals
>  
>      def update_bbappend(self):
> -        """Add DEPENDS on clang-native when clangd is used as only
> the IntelliSense engine"""
> +        """Add workspace-only IDE dependencies and Cargo debug path
> remaps."""
>          wants_clang_native = (
>              self.build_tool.is_c_cpp
>              and self.ide_sdk_intellisense == 'clangd'
> @@ -962,28 +964,44 @@ class RecipeModified:
>          else:
>              parsed_content = ''
>  
> -        if not wants_clang_native:
> +        new_sections = []
> +        if wants_clang_native:
> +            new_sections.append(
> +                self.MARKER + '\nDEPENDS:append = " clang-
> native"\n')
> +        if self.build_tool is BuildTool.CARGO:
> +            new_sections.append(
> +                self.CARGO_REMAP_MARKER
> +                + '\nRUST_DEBUG_REMAP:append = " '
> +                '--remap-path-prefix=${S}=${TARGET_DBGSRC_DIR}"\n')
> +
> +        if not new_sections:
>              if self.MARKER in original_content:
>                  logger.info(
>                      "Removed clangd toolchain support from %s: no
> longer needed", self.bbappend)
>              return False
>  
> -        new_section = self.MARKER + '\nDEPENDS:append = " clang-
> native"\n'
>          new_content = parsed_content
> -        if new_content and not new_content.endswith('\n'):
> -            new_content += '\n'
> -        new_content += new_section
> +        for section in new_sections:
> +            if new_content and not new_content.endswith('\n'):
> +                new_content += '\n'
> +            new_content += section
>  
> -        if new_content == original_content:
> +        # Managed sections were stripped before parsing, so compare
> against
> +        # what BitBake parsed rather than the saved pre-strip
> contents.
> +        if new_content == parsed_content:
>              return False
>  
>          appends_dir = os.path.dirname(self.bbappend)
>          os.makedirs(appends_dir, exist_ok=True)
>          with open(self.bbappend, 'w') as f:
>              f.write(new_content)
> -        logger.info(
> -            "Updated %s: added DEPENDS on clang-native, needed to
> stage clangd "
> -            "for IDE_SDK_INTELLISENSE=\"clangd\"", self.bbappend)
> +        if wants_clang_native:
> +            logger.info(
> +                "Updated %s: added DEPENDS on clang-native, needed
> to stage clangd "
> +                "for IDE_SDK_INTELLISENSE=\"clangd\"",
> self.bbappend)
> +        if self.build_tool is BuildTool.CARGO:
> +            logger.info(
> +                "Updated %s: remapped Cargo external sources for
> debug info", self.bbappend)
>          return True

update_bbappend() compares new_content == parsed_content, but
new_content is parsed_content plus the new section, so they never
match. The function now always returns True when it generates a
section. Every run rewrites the bbappend and forces a reparse, and this
regresses existing clangd users, who got False when nothing changed.

Regards,
Adrian

>  
>      def initialize(self, config, workspace, tinfoil):
> 
> 
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#248854): 
https://lists.openembedded.org/g/openembedded-core/message/248854
Mute This Topic: https://lists.openembedded.org/mt/121938795/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to