summaryrefslogtreecommitdiff
path: root/third-party/pjproject
diff options
context:
space:
mode:
authorGeorge Joseph <gjoseph@digium.com>2016-11-16 11:05:43 -0700
committerGeorge Joseph <gjoseph@digium.com>2016-11-18 08:01:21 -0500
commit2a40c3a8679f1a02d88c48f0424fa41df09203a8 (patch)
tree98e1fc41d230cfe8eb4c4b00f8c4910bd4893ad0 /third-party/pjproject
parent0790aa528a902b49de9aff8232ff4c7a97ea6fda (diff)
pjproject_bundled: Improve reliability of pjproject download
The download process now has a timeout which will cause wget to retry if it stops retrieving data for 5 seconds and fetch and curl to timeout if the whole retrieval take smore than 30 seconds. If the tarball retrieval works, the MD5SUM file is retrieved from the downloads site and the md5 checksum is verified. If either the tarball retrieval or MD5SUM retrieval fails, or the checksums don't match, the entire process is retried once. If it fails again, any incomplete tarball is deleted. .DELETE_ON_ERROR: was also added to the Makefile. Not only does this delete the tarball on failure, it till also delete corrupted library files from the pjproject source directory should they fail to build correctly. Tested all the way back to FreeBSD 9, CentOS 6, Debian 6 and Ubuntu 14. Change-Id: Iea7d33b96a31622ab1b6e54baebaf271959514e1
Diffstat (limited to 'third-party/pjproject')
-rw-r--r--third-party/pjproject/Makefile23
-rw-r--r--third-party/pjproject/configure.m48
2 files changed, 27 insertions, 4 deletions
diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile
index 106938b6c..ff3266c16 100644
--- a/third-party/pjproject/Makefile
+++ b/third-party/pjproject/Makefile
@@ -75,14 +75,31 @@ include ../Makefile.rules
include Makefile.rules
ECHO_PREFIX := $(ECHO_PREFIX) echo '[pjproject] '
+SHELL_ECHO_PREFIX := echo '[pjproject] '
_all: $(TARGETS)
+define download_from_pjproject
+ ($(SHELL_ECHO_PREFIX) Downloading $(PJPROJECT_URL)/$(@F) to $@ ;\
+ $(DOWNLOAD_TO_STDOUT) $(call DOWNLOAD_TIMEOUT,5,10) $(PJPROJECT_URL)/$(@F) > $@ &&\
+ $(SHELL_ECHO_PREFIX) Downloading $(PJPROJECT_URL)/MD5SUM to $(PJMD5SUM) &&\
+ $(DOWNLOAD_TO_STDOUT) $(call DOWNLOAD_TIMEOUT,5,10) $(PJPROJECT_URL)/MD5SUM.TXT > $(PJMD5SUM) &&\
+ ($(SHELL_ECHO_PREFIX) Verifying $@ &&\
+ tarball_sum=$$($(CAT) $@ | $(MD5) | $(SED) -n -r -e "s/^([^ ]+)\s+.*/\1/gp") ;\
+ required_sum=$$($(SED) -n -r -e "s/^([^ ]+)\s+$(@F)/\1/gp" $(PJMD5SUM)) ;\
+ if [ "$$tarball_sum" != "$$required_sum" ] ; then $(SHELL_ECHO_PREFIX) Verify failed ; exit 1 ; fi) &&\
+ $(SHELL_ECHO_PREFIX) Verify successful ; exit 0)
+endef
+
+.DELETE_ON_ERROR:
+
DOWNLOAD_DIR := $(or $(EXTERNALS_CACHE_DIR),$(TMPDIR),$(wildcard /tmp),.)
+TARBALL = $(DOWNLOAD_DIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2
+PJMD5SUM = $(patsubst %.tar.bz2,%.md5,$(TARBALL))
-$(DOWNLOAD_DIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2: ../versions.mak
- $(ECHO_PREFIX) Downloading $(PJPROJECT_URL)/$(@F) to $@
- $(CMD_PREFIX) $(DOWNLOAD_TO_STDOUT) $(PJPROJECT_URL)/$(@F) > $@
+$(TARBALL): ../versions.mak
+ $(CMD_PREFIX) $(download_from_pjproject) || (rm -rf $@ ;\
+ $(SHELL_ECHO_PREFIX) Retrying download ; sleep 3 ; $(download_from_pjproject))
source/.unpacked: $(DOWNLOAD_DIR)/pjproject-$(PJPROJECT_VERSION).tar.bz2
$(ECHO_PREFIX) Unpacking $<
diff --git a/third-party/pjproject/configure.m4 b/third-party/pjproject/configure.m4
index 870468257..be03b45b5 100644
--- a/third-party/pjproject/configure.m4
+++ b/third-party/pjproject/configure.m4
@@ -28,8 +28,14 @@ AC_DEFUN([_PJPROJECT_CONFIGURE],
if test "${NM}" = ":" ; then
AC_MSG_ERROR(nm is required to build bundled pjproject)
fi
+ if test "${MD5}" = ":" ; then
+ AC_MSG_ERROR(md5sum is required to build bundled pjproject)
+ fi
+ if test "${CAT}" = ":" ; then
+ AC_MSG_ERROR(cat is required to build bundled pjproject)
+ fi
- export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT
+ export TAR PATCH SED NM EXTERNALS_CACHE_DIR DOWNLOAD_TO_STDOUT DOWNLOAD_TIMEOUT DOWNLOAD MD5 CAT
${GNU_MAKE} --quiet --no-print-directory -C ${PJPROJECT_DIR} EXTERNALS_CACHE_DIR=${EXTERNALS_CACHE_DIR} configure
if test $? -ne 0 ; then
AC_MSG_RESULT(failed)