Zheng Bao (zheng.bao@amd.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4511
-gerrit
commit dd603c4ac1a739cb7af31668fcbfadc924fe4d93 Author: zbao fishbaozi@gmail.com Date: Thu Apr 30 01:39:57 2015 +0800
crossgcc: Re-download the archive if it is incomplete
If the buildgcc is interrupt by Ctrl-C, probably part of an archive is downloaded. If we run buildgcc again, the incomplete archive would be considered as cached file and skipped.
We check file hashes to see if the file is complete. If test is failed, we need to delete the partially-downloaded file and download it again.
sha1sum is quite different among the distributions. Only Linux, Cygwin, Darwin have been tested.
Discuss: Do we need to use option -c of wget to continue downloading?
Change-Id: Ibb1aa25a0374f774e1e643fe5e698de7bf7cc418 Signed-off-by: Zheng Bao zheng.bao@amd.com Signed-off-by: Zheng Bao fishbaozi@gmail.com --- util/crossgcc/buildgcc | 41 +++++++++++++++++++++- .../crossgcc/sum/acpica-unix-20150204.tar.gz.cksum | 1 + util/crossgcc/sum/binutils-2.25.tar.bz2.cksum | 1 + util/crossgcc/sum/gcc-4.9.2.tar.bz2.cksum | 1 + util/crossgcc/sum/gmp-6.0.0a.tar.bz2.cksum | 1 + util/crossgcc/sum/libelf-0.8.13.tar.gz.cksum | 1 + util/crossgcc/sum/mpc-1.0.3.tar.gz.cksum | 1 + util/crossgcc/sum/mpfr-3.1.2.tar.bz2.cksum | 1 + 8 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/util/crossgcc/buildgcc b/util/crossgcc/buildgcc index ae581b9..879aef3 100755 --- a/util/crossgcc/buildgcc +++ b/util/crossgcc/buildgcc @@ -125,6 +125,26 @@ searchtool() fi fi fi + if [ "`echo $1 | cut -b -3`" = "sha" ]; then + if [ $UNAME = "FreeBSD" ]; then + if test -x "`which shasum 2>/dev/null`"; then + echo shasum -b -a `echo $1 | sed -e 's,sha,,' -e 's,sum,,'` + return + fi + fi + if [ $UNAME = "NetBSD" ]; then + if test -x "`which cksum 2>/dev/null`"; then + echo cksum -a `echo $1 | sed -e 's,sum,,'` + return + fi + fi + if [ $UNAME = "Darwin" ]; then + if test -x "`which openssl 2>/dev/null`"; then + echo openssl `echo $1 | sed -e 's,sum,,'` + return + fi + fi + fi printf "${RED}ERROR:${red} Missing toolchain: $1${NC}\n" >&2 [ -z "$3" ] && exit 1 false @@ -151,6 +171,10 @@ wait_for_build() { true }
+SHA1SUM=`searchtool sha1sum` +SHA512SUM=`searchtool sha512sum` +CHECKSUM=$SHA1SUM + cleanup() { printf "Cleaning up temporary files... " @@ -295,10 +319,25 @@ for ARCHIVE in $GMP_ARCHIVE $MPFR_ARCHIVE $MPC_ARCHIVE $LIBELF_ARCHIVE \ $IASL_ARCHIVE $PYTHON_ARCHIVE $EXPAT_ARCHIVE; do FILE=`basename $ARCHIVE` printf " * $FILE " - test -f tarballs/$FILE && printf "(cached)" || ( + + ##create the sum + #test -f sum/$FILE.cksum || ( + # $CHECKSUM tarballs/$FILE > sum/$FILE.cksum + # continue + #) + + test -f tarballs/$FILE && \ + (test -z "$CHECKSUM" || \ + test "`cat sum/$FILE.cksum 2>/dev/null | sed -e 's,.*([0-9a-f]{40}).*,\1,'`" = "`$CHECKSUM tarballs/$FILE 2>/dev/null | sed -e 's,.*([0-9a-f]{40}).*,\1,'`" ) && \ + printf "(cached)" || ( printf "(downloading)" + rm -f tarballs/$FILE cd tarballs wget --no-check-certificate -q $ARCHIVE + cd .. + test ! -f sum/$FILE.cksum && test -f tarballs/$FILE && \ + (test -z "$CHECKSUM" || $CHECKSUM tarballs/$FILE > sum/$FILE.cksum ) && \ + printf "(checksum created. ${RED}Note. Please upload sum/$FILE.cksum if the corresponding archive is upgraded.${NC})" ) test -f tarballs/$FILE || \ printf "\n${RED}Failed to download $FILE.${NC}\n" diff --git a/util/crossgcc/sum/acpica-unix-20150204.tar.gz.cksum b/util/crossgcc/sum/acpica-unix-20150204.tar.gz.cksum new file mode 100644 index 0000000..c2f201f --- /dev/null +++ b/util/crossgcc/sum/acpica-unix-20150204.tar.gz.cksum @@ -0,0 +1 @@ +e8ab49a9cd47ec1f3542b4185852bb49814c7694 tarballs/acpica-unix-20150204.tar.gz diff --git a/util/crossgcc/sum/binutils-2.25.tar.bz2.cksum b/util/crossgcc/sum/binutils-2.25.tar.bz2.cksum new file mode 100644 index 0000000..1f339d4 --- /dev/null +++ b/util/crossgcc/sum/binutils-2.25.tar.bz2.cksum @@ -0,0 +1 @@ +b46cc90ebaba7ffcf6c6d996d60738881b14e50d tarballs/binutils-2.25.tar.bz2 diff --git a/util/crossgcc/sum/gcc-4.9.2.tar.bz2.cksum b/util/crossgcc/sum/gcc-4.9.2.tar.bz2.cksum new file mode 100644 index 0000000..b1d8c46 --- /dev/null +++ b/util/crossgcc/sum/gcc-4.9.2.tar.bz2.cksum @@ -0,0 +1 @@ +79dbcb09f44232822460d80b033c962c0237c6d8 tarballs/gcc-4.9.2.tar.bz2 diff --git a/util/crossgcc/sum/gmp-6.0.0a.tar.bz2.cksum b/util/crossgcc/sum/gmp-6.0.0a.tar.bz2.cksum new file mode 100644 index 0000000..67d60bf --- /dev/null +++ b/util/crossgcc/sum/gmp-6.0.0a.tar.bz2.cksum @@ -0,0 +1 @@ +360802e3541a3da08ab4b55268c80f799939fddc tarballs/gmp-6.0.0a.tar.bz2 diff --git a/util/crossgcc/sum/libelf-0.8.13.tar.gz.cksum b/util/crossgcc/sum/libelf-0.8.13.tar.gz.cksum new file mode 100644 index 0000000..daa27c6 --- /dev/null +++ b/util/crossgcc/sum/libelf-0.8.13.tar.gz.cksum @@ -0,0 +1 @@ +c1d6ac5f182d19dd685c4dfd74eedbfe3992425d tarballs/libelf-0.8.13.tar.gz diff --git a/util/crossgcc/sum/mpc-1.0.3.tar.gz.cksum b/util/crossgcc/sum/mpc-1.0.3.tar.gz.cksum new file mode 100644 index 0000000..c7ca1ac --- /dev/null +++ b/util/crossgcc/sum/mpc-1.0.3.tar.gz.cksum @@ -0,0 +1 @@ +b8be66396c726fdc36ebb0f692ed8a8cca3bcc66 tarballs/mpc-1.0.3.tar.gz diff --git a/util/crossgcc/sum/mpfr-3.1.2.tar.bz2.cksum b/util/crossgcc/sum/mpfr-3.1.2.tar.bz2.cksum new file mode 100644 index 0000000..d62e243 --- /dev/null +++ b/util/crossgcc/sum/mpfr-3.1.2.tar.bz2.cksum @@ -0,0 +1 @@ +46d5a11a59a4e31f74f73dd70c5d57a59de2d0b4 tarballs/mpfr-3.1.2.tar.bz2