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

Fix default path fallack when core.sources:download_cache is not set #15109

Merged
Merged
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: 1 addition & 1 deletion conans/client/downloaders/caching_file_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _caching_download(self, urls, file_path,
something is found.
"""
# We are going to use the download_urls definition for backups
download_cache_folder = download_cache_folder or HomePaths(self.conan_api.cache_folder).default_sources_backup_folder
download_cache_folder = download_cache_folder or HomePaths(self._cache.cache_folder).default_sources_backup_folder
# regular local shared download cache, not using Conan backup sources servers
backups_urls = backups_urls or ["origin"]
if download_cache_folder and not os.path.isabs(download_cache_folder):
Expand Down
10 changes: 10 additions & 0 deletions conans/test/integration/cache/backup_sources_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@ def source(self):
assert f"Sources for {self.file_server.fake_url}/internet/myfile.txt found in remote backup" in self.client.out
assert f"File {self.file_server.fake_url}/mycompanystorage/mycompanyfile.txt not found in {self.file_server.fake_url}/backups/" in self.client.out

# Ensure defaults backup folder works if it's not set in global.conf
# (The rest is needed to exercise the rest of the code)
self.client.save(
{"global.conf": f"core.sources:download_urls=['{self.file_server.fake_url}/backups/', 'origin']\n"
f"core.sources:exclude_urls=['{self.file_server.fake_url}/mycompanystorage/', '{self.file_server.fake_url}/mycompanystorage2/']"},
path=self.client.cache.cache_folder)
self.client.run("source .")
assert f"Sources for {self.file_server.fake_url}/internet/myfile.txt found in remote backup" in self.client.out
assert f"File {self.file_server.fake_url}/mycompanystorage/mycompanyfile.txt not found in {self.file_server.fake_url}/backups/" in self.client.out

def test_download_origin_first(self):
http_server_base_folder_internet = os.path.join(self.file_server.store, "internet")

Expand Down