buildgcc: Show the progress when downloading
Grep the output of wget, showing only the percentage. Leave the final "100%" unerased. Checking return code of wget is removed. Change-Id: I4559e88d541738a594dce92e23589992f234cb9b Signed-off-by: Zheng Bao <zheng.bao@amd.com> Signed-off-by: Zheng Bao <fishbaozi@gmail.com> Reviewed-on: http://review.coreboot.org/11520 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
parent
bda38eece8
commit
282dd95143
|
@ -187,6 +187,16 @@ compute_sum() {
|
||||||
printf "(checksum created. ${RED}Note. Please upload sum/$1.cksum if the corresponding archive is upgraded.)${NC}"
|
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
|
||||||
|
printf "${red}"
|
||||||
|
echo $line | grep -o "[0-9]\+%" | awk '{printf("\b\b\b\b%4s", $1)}'
|
||||||
|
printf "${NC}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
package=$1
|
package=$1
|
||||||
archive="$(eval echo \$$package"_ARCHIVE")"
|
archive="$(eval echo \$$package"_ARCHIVE")"
|
||||||
|
@ -200,14 +210,13 @@ download() {
|
||||||
printf "(downloading from $archive)"
|
printf "(downloading from $archive)"
|
||||||
rm -f tarballs/$FILE
|
rm -f tarballs/$FILE
|
||||||
cd tarballs
|
cd tarballs
|
||||||
wget --no-check-certificate -q $archive
|
download_showing_percentage $archive
|
||||||
wgetret=$?
|
|
||||||
cd ..
|
cd ..
|
||||||
compute_sum $FILE
|
compute_sum $FILE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f tarballs/$FILE ]; then
|
if [ ! -f tarballs/$FILE ]; then
|
||||||
printf "\n${RED}Failed to download $FILE. Wget returns $wgetret. See 'man wget'.${NC}\n"
|
printf "\n${RED}Failed to download $FILE.${NC}\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
printf "\n"
|
printf "\n"
|
||||||
|
|
Loading…
Reference in New Issue