Skip to content

[question] Usage of self.run in the package_info method does not use environment #16978

Closed
@rohel01

Description

@rohel01

What is your question?

Hello,

I am cross-building my applications using a Yocto SDK. To better integrate this build process into conan, I created a small generator which automatically registers a script to setup the Yocto SDK environment before build.

This works surprisingly well for building and creating Conan packages since most build tools (cmake, meson, pkg-config...) are now provided by the Yocto SDK.

Lately, I tried to optimize the implementation of the package_info method for stub Conan packages already provided by Yocto. Since most Yocto packages are provided with pc files, I tried to reuse that information when building the cpp_info metadata

    def package_info(self):
        pkg_config = PkgConfig(self, self.name)
        pkg_config.fill_cpp_info(self.cpp_info, is_system=True)

The PkgConfig class internally uses conanfile.run but it seems environments are not activated as I expected: the Yocto SDK is not activated so cpp_info is filled with information from the wrong target.

Do you know how I can achieved the desired outcome? Looking at the PkgConfig class implementation again, I see I could override the "tools.gnu:pkg_config" property to point to the Yocto SDK binary. But I would be duplicating information, which I wanted to avoid in the first place.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions