[coreboot-gerrit] Patch set updated for coreboot: buildgcc: try curl if wget is not present

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Tue Jan 10 14:43:16 CET 2017


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18048

-gerrit

commit 53faf27d74d52d49b7b4f39839ed271eca69fd3a
Author: Patrick Georgi <pgeorgi at chromium.org>
Date:   Sat Jan 7 09:28:43 2017 +0100

    buildgcc: try curl if wget is not present
    
    There are systems that come with curl but not wget (eg macOS) and they
    now have to install one less additional dependency.
    
    Also fix some cosmetic issues in console output and require valid
    certificates on https downloads.
    
    Change-Id: Idc2ce892fbb6629aebfe1ae2a95dcef4d5d93aca
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
---
 util/crossgcc/buildgcc | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc
index 0dfca26..1cefcd5 100755
--- a/util/crossgcc/buildgcc
+++ b/util/crossgcc/buildgcc
@@ -130,9 +130,9 @@ please_install()
 	*) solution="using your OS packaging system" ;;
 	esac
 
-	printf "${RED}ERROR:${red} Missing tool: Please install \'$1\'. (eg $solution)${NC}\n" >&2
+	printf "${RED}ERROR:${red} Missing tool: Please install '$1'. (eg $solution)${NC}\n" >&2
 	if [ -n "$2" ]; then
-		printf "${RED}ERROR:${red}               or install \'$2\'.${NC}\n" >&2
+		printf "${RED}ERROR:${red}               or install '$2'.${NC}\n" >&2
 	fi
 }
 
@@ -282,15 +282,6 @@ compute_sum() {
 	printf "(checksum created. ${RED}Note. Please upload sum/$1.cksum if the corresponding archive is upgraded.)${NC}"
 }
 
-download_showing_percentage() {
-	url=$1
-	printf " ..${red}  0%%"
-	wget --no-check-certificate $url 2>&1 | while read line; do
-		echo $line | grep -o "[0-9]\+%" | awk '{printf("\b\b\b\b%4s", $1)}'
-	done
-	printf "${NC}"
-}
-
 download() {
 	package=$1
 	archive="$(eval echo \$$package"_ARCHIVE")"
@@ -299,7 +290,7 @@ download() {
 	printf " * $FILE "
 
 	if test -f tarballs/$FILE && check_sum $FILE ; then
-		printf "(cached)"
+		echo "(cached)"
 	else
 		printf "(downloading from $archive)"
 		rm -f tarballs/$FILE
@@ -310,10 +301,9 @@ download() {
 	fi
 
 	if [ ! -f tarballs/$FILE ]; then
-		printf "\n${RED}Failed to download $FILE.${NC}\n"
+		printf "${RED}Failed to download $FILE.${NC}\n"
 		exit 1
 	fi
-	printf "\n"
 }
 
 unpack_and_patch() {
@@ -891,9 +881,25 @@ searchtool flex flex > /dev/null
 searchtool g++ "Free Software Foundation" nofail > /dev/null || \
 searchtool clang "clang version" nofail > /dev/null || \
 searchtool clang "LLVM" "" "g++" > /dev/null
-searchtool wget > /dev/null
 searchtool bzip2 "bzip2," > /dev/null
 
+if searchtool wget "GNU" nofail > /dev/null; then
+	download_showing_percentage() {
+		url=$1
+		printf " ..${red}  0%%"
+		wget $url 2>&1 | while read line; do
+			echo $line | grep -o "[0-9]\+%" | awk '{printf("\b\b\b\b%4s", $1)}'
+		done
+		echo "${NC}"
+	}
+elif searchtool curl "^curl " > /dev/null; then
+	download_showing_percentage() {
+		url=$1
+		echo
+		curl -#OL $url
+	}
+fi
+
 check_for_library "-lz" "zlib (zlib1g-dev or zlib-devel)"
 
 CC=cc



More information about the coreboot-gerrit mailing list