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

Sketch to show that populating download cache on conan upload is possible #15223

Draft
wants to merge 6 commits into
base: develop2
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Minor cleanup to simplify diff
  • Loading branch information
AbrilRBS committed Dec 6, 2023
commit 6f9bc96fbe5218ce1b6bcc5f95fb8f9b7e17ebc9
1 change: 0 additions & 1 deletion conan/cli/commands/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from conan.cli import make_abs_path
from conan.cli.command import conan_command, OnceArgument
from conan.cli.commands.list import print_list_json, print_serial
from conans.client.downloaders.download_cache import DownloadCache
from conans.client.userio import UserInput
from conan.errors import ConanException

Expand Down
4 changes: 2 additions & 2 deletions conans/client/cmd/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ def _local_cache_file(self, pref, cache_file, remote):
if cache_file not in approved_files:
return
_download_cache = self._app.global_conf.get("core.download:download_cache")
if True or _download_cache and os.path.isabs(_download_cache):
if _download_cache and os.path.isabs(_download_cache):
url = self._app.remote_manager._auth_manager._get_rest_client(remote)._get_api().router.package_file(pref, cache_file)
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
cached_path = DownloadCache(_download_cache).cached_path(url)
AbrilRBS marked this conversation as resolved.
Show resolved Hide resolved
self._output.info(f"Caching future {url} to local cache '{cached_path}'")
self._output.info(f"Caching {cache_file} to local cache '{cached_path}' - was uploaded to {url}")


def compress_files(files, name, dest_dir, compresslevel=None, ref=None):
Expand Down
2 changes: 2 additions & 0 deletions conans/test/integration/command/upload/upload_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ def test_upload_unmodified_package(self):
client.run("create . --user=frodo --channel=stable")
client.run("upload hello0/1.2.1@frodo/stable -r default")

assert "Caching conan_package.tgz to local cache" in client.out

client2 = TestClient(servers=client.servers, inputs=["admin", "password"])
client2.save({"conanfile.py": conanfile,
"hello.cpp": ""})
Expand Down