Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Omit build requirements when all packages are downloaded from a remote? #17596

Open
1 task done
jay-fenton opened this issue Jan 18, 2025 · 0 comments
Open
1 task done

Comments

@jay-fenton
Copy link

What is your question?

Hello,

I am migrating from Conan 1 to Conan 2, and trying to improve package management based on the Devops guides in the Conan 2 documentation. The goal is to manage building a small set of 3rd party packages using a custom set of profiles, emulating conancenter. I am running into an issue with build requirements causing installation to fail. Any advice is appreciated.

I have CI process(es) that use a copy of conan-center-index as an offline remote and, given a set of custom profiles, generate locks, build packages, promote from online test to release remotes, etc. To upload packages built using the conan-center-index recipes to an online remote, I iterate the requires section of the lockfile, and upload only the requirements. The goal is to build and archive every 3rd party package/dependency for every profile, so that any consumer will be able to pull prebuilt binaries. In the case where new profiles or package versions are needed, changes are made to the CI system, kicking off automated package creation/publishing so that developers never need to locally build 3rd party packages.

As an example, when I use this system to build libtiff/dependencies, archive the packages, then install a simple conanfile using the CI remote:

from conan import ConanFile

class Example(ConanFile):
    settings = "os", "compiler", "build_type", "arch"
    generators = "CMakeDeps"

    def requirements(self):
        self.requires('libtiff/4.7.0')

The install fails with
ERROR: Package 'cmake/[>=3.18 <4]' not resolved: Version range '>=3.18 <4' from requirement 'cmake/[>=3.18 <4]' required by 'libtiff/4.7.0' could not be resolved. The CMake dependency is part of the build_requirements(self) method in the conan-center-index recipe. I was under the impression it would not be necessary to satisfy the build requirements if the required packages were already built (and those build requirements were not present in the lockfile). I did not run into this in the various workflows in the CI project, because generally the offline remote and online remote are enabled at the same time to try and reduce extraneous rebuilds, etc. I see in the CI logs that even when all packages exist in the remote and are downloaded, the CMake dependency is still resolved and comes from the offline conan-center-index remote.

Is there an option to or pattern used to install packages and skip dealing with build requirements when the build will not need to occur (because the entire graph of requirements is downloaded)? If not, is the path forward here just to upload all build products, not just the requires group from the lockfile?

Thanks for the help!

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant