From 7551666a807f2be12b5790c5d32376fd434c96ab Mon Sep 17 00:00:00 2001 From: Jelle Raaijmakers Date: Wed, 5 Jul 2023 14:04:26 +0200 Subject: [PATCH] Ports: Do not perform slow `curl` check if download already exists Even if the file was already downloaded, we were trying to perform a relatively slow HTTPS-call. --- Ports/.port_include.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Ports/.port_include.sh b/Ports/.port_include.sh index 8c574bcdb1..68f17b6621 100755 --- a/Ports/.port_include.sh +++ b/Ports/.port_include.sh @@ -299,6 +299,11 @@ do_download_file() { local filename="$2" local accept_existing="${3:-true}" + if $accept_existing && [ -f "$filename" ]; then + echo "$filename already exists" + return + fi + echo "Downloading URL: ${url}" # FIXME: Serenity's curl port does not support https, even with openssl installed. @@ -306,15 +311,10 @@ do_download_file() { url=$(echo "$url" | sed "s/^https:\/\//http:\/\//") fi - # download files - if $accept_existing && [ -f "$filename" ]; then - echo "$filename already exists" + if which curl; then + run_nocd curl ${curlopts:-} "$url" -L -o "$filename" else - if which curl; then - run_nocd curl ${curlopts:-} "$url" -L -o "$filename" - else - run_nocd pro "$url" > "$filename" - fi + run_nocd pro "$url" > "$filename" fi }