nix-channels: Also download nix-cache-info

This commit is contained in:
dramforever 2020-01-13 20:18:02 +08:00 committed by GitHub
parent cbd2e9f802
commit 7a75219065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -261,6 +261,8 @@ def clone_channels():
def update_channels(channels): def update_channels(channels):
logging.info(f'- Updating binary cache') logging.info(f'- Updating binary cache')
has_cache_info = False
for channel in channels: for channel in channels:
logging.info(f' - {channel}') logging.info(f' - {channel}')
@ -268,6 +270,18 @@ def update_channels(channels):
upstream_binary_cache = (chan_path_update / '.original-binary-cache-url').read_text() upstream_binary_cache = (chan_path_update / '.original-binary-cache-url').read_text()
# All the channels should have https://cache.nixos.org as binary cache
# URL. We download nix-cache-info here (once per sync) to avoid
# hard-coding it, and in case it changes.
if not has_cache_info:
info_file = 'nix-cache-info'
logging.info(f' - Downloading {info_file}')
download(
f'{upstream_binary_cache}/{info_file}',
working_dir / STORE_DIR / info_file
)
has_cache_info = True
with lzma.open(str(chan_path_update / 'store-paths.xz')) as f: with lzma.open(str(chan_path_update / 'store-paths.xz')) as f:
paths = [ path.rstrip() for path in f ] paths = [ path.rstrip() for path in f ]