diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2024-03-24 00:26:25 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2024-03-24 02:16:04 +0530 |
commit | bb1e5e7f7a7c1732a42e0a24553cc6063d7f44a3 (patch) | |
tree | 823692c008d48612d0d9da257d4cd558539ec698 | |
parent | b2ca3a156e01360db31b3afb887f7a34369a7b7a (diff) |
cerbero: Improve ergonomics for cache download outside of CI
Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1423>
-rw-r--r-- | cerbero/commands/cache.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/cerbero/commands/cache.py b/cerbero/commands/cache.py index 8e9ab348..0cae283d 100644 --- a/cerbero/commands/cache.py +++ b/cerbero/commands/cache.py @@ -174,17 +174,18 @@ class FetchCache(BaseCache): return None async def fetch_dep(self, config, dep, namespace): + is_ci = 'CI' in os.environ try: dep_path = os.path.join(config.home_dir, os.path.basename(dep['url'])) m.action(f'Downloading deps cache {dep["url"]}') - await shell.download(dep['url'], dep_path, overwrite=True) - if dep['checksum'] == self.checksum(dep_path): - m.action(f'Unpacking deps cache {dep_path}') - await shell.unpack(dep_path, config.home_dir) - else: + await shell.download(dep['url'], dep_path, overwrite=is_ci) + if dep['checksum'] != self.checksum(dep_path): m.warning('Corrupted dependency file, ignoring.') - m.action('Unpack complete, deleting artifact') - os.remove(dep_path) + m.action(f'Unpacking deps cache {dep_path}') + await shell.unpack(dep_path, config.home_dir) + if is_ci: + m.action('Unpack complete, deleting artifact') + os.remove(dep_path) # We need to relocate pc files that weren't generated by meson and # python programs installed with pip because the shebang set by the |