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

Check system requirements if the package is in the local cache #3616

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions conans/client/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,8 @@ def _handle_node_cache(self, node, package_id, keep_build, processed_package_ref
self._registry.set_ref(conan_ref, node.binary_remote.name)
elif node.binary == BINARY_CACHE:
output.success('Already installed!')
_handle_system_requirements(conan_file, package_ref, self._client_cache,
Copy link
Member

Choose a reason for hiding this comment

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

This shouldn't be done here. System requirements are installed:

  • On download of packages
  • On build

Sucessive installations shouldn't install them again, and it can make installing the deps graph very slow for already cached deps.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it won't install them again if the system reqs folder is already there. But it nicely covers the case where the user wants to force the install by removing the folder.

Copy link
Member

Choose a reason for hiding this comment

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

It seems a very corner case for me, to cover the case where someone enters the conan cache and removes there manually some folder. The problem I see is that this could increase an order of magnitude the otherwise no-op "conan install" command when the dependencies are already installed in the cache.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could agree with that. If it causes some minimal issue then we should avoid it. Then we should go to the issue, to comment that this is not a valid possibility and close it.

self._out)
log_package_got_from_local_cache(package_ref)
self._recorder.package_fetched_from_cache(package_ref)
clean_dirty(package_folder)
Expand Down
18 changes: 18 additions & 0 deletions conans/test/integration/system_reqs_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ def system_requirements(self):

class SystemReqsTest(unittest.TestCase):

def force_system_reqs_rerun_test(self):
client = TestClient()
files = {'conanfile.py': base_conanfile.replace("%GLOBAL%", "")}
client.save(files)
client.run("create . user/channel")
self.assertIn("*+Running system requirements+*", client.user_io.out)
client.run("install Test/0.1@user/channel")
self.assertNotIn("*+Running system requirements+*", client.user_io.out)
ref = ConanFileReference.loads("Test/0.1@user/channel")
pfs = client.client_cache.packages(ref)
pid = os.listdir(pfs)[0]
reqs_file = client.client_cache.system_reqs_package(PackageReference(ref, pid))
os.unlink(reqs_file)

client.run("install Test/0.1@user/channel")
self.assertIn("*+Running system requirements+*", client.user_io.out)
self.assertTrue(os.path.exists(reqs_file))

def local_system_requirements_test(self):
client = TestClient()
files = {'conanfile.py': base_conanfile.replace("%GLOBAL%", "")}
Expand Down