mirror of
https://github.com/truenas/scale-build.git
synced 2026-02-14 23:18:59 +00:00
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.
This commit is contained in:
@@ -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}')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user