From 1d99cf8448c9f2c4473d137db4c6e275271ca877 Mon Sep 17 00:00:00 2001 From: sonicaj Date: Tue, 23 Sep 2025 13:57:29 +0500 Subject: [PATCH] Remove curl dependency (#928) This commit adds changes to remove curl dependency from builder as we already have requests which can handle taht part. Currently some of our builders are broken because of the missing dependency - making changes so we do not have curl as a dependency directly of scale-build itself. --- scale_build/image/update.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/scale_build/image/update.py b/scale_build/image/update.py index 2c26060..fe221fb 100644 --- a/scale_build/image/update.py +++ b/scale_build/image/update.py @@ -3,6 +3,7 @@ import itertools import logging import os import platform +import requests import shutil import stat import tempfile @@ -198,17 +199,18 @@ def download_and_install_deb_package(package_name, download_url, deb_filename, p logger.info(f'Downloading {package_name} from {download_url}') - # Download the package using curl - download_cmd = [ - 'curl', - '-L', # Follow redirects - '-o', deb_path, - download_url - ] - + # Download the package using requests try: - run(download_cmd) - except Exception as e: + response = requests.get(download_url, stream=True, timeout=60, allow_redirects=True) + response.raise_for_status() + + # Write the content to file in chunks to handle large files efficiently + with open(deb_path, 'wb') as f: + for chunk in response.iter_content(chunk_size=8192): + if chunk: # Filter out keep-alive chunks + f.write(chunk) + + except requests.exceptions.RequestException as e: logger.error(f'Failed to download {package_name}: {e}') raise RuntimeError(f'Failed to download {package_name} from {download_url}: {e}')