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

[develop2] Improving system_requirements #12912

Merged

Conversation

memsharded
Copy link
Member

@memsharded memsharded commented Jan 17, 2023

Changelog: Fix: Improving system_requirements.

Allow collecting the system_requires of the graph:

  • In create and install commands
  • In graph info commands, without installing anything
  • Added new collect mode for system-requires
  • Decouple the installation of system_requires (doing it first) from the installation of the graph packages.

Close #5959

@memsharded memsharded added this to the 2.0.0-beta9 milestone Jan 17, 2023
if self._mode == self.mode_collect:
return

if check or self._mode == self.mode_check:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@czoido I am not sure if this was a bug or on-purpose, but apt was not running checks for mode=="check"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say it is on-purpouse as it was conceived, mode==check is the default mode and means that it won't install anything but it will check packages at most if you set that as an argument in the install method or call directly to the check method, but does not mean that it will force the check even if you set the check argument to False.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it has a problem, apt-get is not doing even a check, but always returning the install() packages list, because the override has different default: def install(self, packages, update=False, check=False, recommends=False):

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finally did:

  • mode=check always does a check, raise if packages not found. Can be done in graph info too
  • mode=report do nothing except collect and report the system_requires. Do not check, do not raise.

@@ -156,6 +156,8 @@ def graph_info(conan_api, parser, subparser, *args):
conan_api.graph.analyze_binaries(deps_graph, args.build, remotes=remotes, update=args.update,
lockfile=lockfile)
print_graph_packages(deps_graph)
if profile_host.conf.get("tools.system.package_manager:mode") == "collect":
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first usage of such a conf in our code, getting it directly from profile instead of conanfile, but I don't see a strong reason to not allow it in our codebase.

@memsharded memsharded marked this pull request as ready for review January 18, 2023 12:31
@czoido czoido merged commit b7c012d into conan-io:develop2 Jan 19, 2023
@memsharded memsharded deleted the feature/develop2_system_requirements branch January 19, 2023 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants