From: Jaroslav Kysela Date: Tue, 18 Apr 2017 20:12:02 +0000 (+0200) Subject: bintray cache: another fixes X-Git-Tag: v4.2.1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=863148bdbf599c4e63b913915906374c803b3081;p=thirdparty%2Ftvheadend.git bintray cache: another fixes --- diff --git a/Makefile b/Makefile index 10d98cc73..1ec9caaff 100644 --- a/Makefile +++ b/Makefile @@ -754,11 +754,14 @@ ${BUILDDIR}/libffmpeg_stamp: ${BUILDDIR}/ffmpeg/build/ffmpeg/lib/libavcodec.a @touch $@ ${BUILDDIR}/ffmpeg/build/ffmpeg/lib/libavcodec.a: Makefile.ffmpeg +ifeq ($(CONFIG_BINTRAY_CACHE),yes) + $(MAKE) -f Makefile.ffmpeg libcacheget +endif $(MAKE) -f Makefile.ffmpeg # Static HDHOMERUN library -ifeq ($(CONFIG_LIBHDHOMERUN_STATIC),yes) +ifeq ($(CONFIG_HDHOMERUN_STATIC),yes) src/input/mpegts/tvhdhomerun/tvhdhomerun_private.h ${SRCS-HDHOMERUN}: ${BUILDDIR}/libhdhomerun_stamp endif @@ -766,6 +769,9 @@ ${BUILDDIR}/libhdhomerun_stamp: ${BUILDDIR}/hdhomerun/libhdhomerun/libhdhomerun. @touch $@ ${BUILDDIR}/hdhomerun/libhdhomerun/libhdhomerun.a: Makefile.hdhomerun +ifeq ($(CONFIG_BINTRAY_CACHE),yes) + $(MAKE) -f Makefile.hdhomerun libcacheget +endif $(MAKE) -f Makefile.hdhomerun # linuxdvb git tree diff --git a/Makefile.ffmpeg b/Makefile.ffmpeg index da95c56b5..78063c0c0 100644 --- a/Makefile.ffmpeg +++ b/Makefile.ffmpeg @@ -108,7 +108,28 @@ LIB_NAME := ffmpeg LIB_ROOT := $(BUILDDIR)/$(LIB_NAME) EBUILDIR := $(LIB_ROOT)/build EPREFIX := $(EBUILDIR)/ffmpeg -LIB_FILES := $(EPREFIX) +LIB_FILES := \ + $(LIB_ROOT)/$(YASM)/.tvh_download \ + $(LIB_ROOT)/$(YASM)/.tvh_build \ + $(LIB_ROOT)/$(LIBX264)/.tvh_download \ + $(LIB_ROOT)/$(LIBX264)/.tvh_build \ + $(LIB_ROOT)/$(LIBX265)/.tvh_download \ + $(LIB_ROOT)/$(LIBX265)/.tvh_build \ + $(LIB_ROOT)/$(LIBVPX)/.tvh_download \ + $(LIB_ROOT)/$(LIBVPX)/.tvh_build \ + $(LIB_ROOT)/$(LIBTHEORA)/.tvh_download \ + $(LIB_ROOT)/$(LIBTHEORA)/.tvh_build \ + $(LIB_ROOT)/$(LIBOGG)/.tvh_download \ + $(LIB_ROOT)/$(LIBOGG)/.tvh_build \ + $(LIB_ROOT)/$(LIBVORBIS)/.tvh_download \ + $(LIB_ROOT)/$(LIBVORBIS)/.tvh_build \ + $(LIB_ROOT)/$(LIBFDKAAC)/.tvh_download \ + $(LIB_ROOT)/$(LIBFDKAAC)/.tvh_build \ + $(LIB_ROOT)/$(LIBMFX)/.tvh_download \ + $(LIB_ROOT)/$(LIBMFX)/.tvh_build \ + $(LIB_ROOT)/$(FFMPEG)/.tvh_download \ + $(LIB_ROOT)/$(FFMPEG)/.tvh_build \ + $(EPREFIX) include $(DIR)/Makefile.static diff --git a/Makefile.hdhomerun b/Makefile.hdhomerun index a7f8f81fa..ba6beddc2 100644 --- a/Makefile.hdhomerun +++ b/Makefile.hdhomerun @@ -44,10 +44,10 @@ LIBHDHR_SHA1 = 24ce6003b1e815ec4c642d180b621c1d524ca1cf LIB_NAME := hdhomerun LIB_ROOT := $(BUILDDIR)/$(LIB_NAME) LIB_FILES := \ - $(LIB_ROOT)/$(LIBHDHR)/.tvh_download\ - $(LIB_ROOT)/$(LIBHDHR)/.tvh_build\ - $(LIB_ROOT)/libhdhomerun/libhdhomerun.a\ - $(LIB_ROOT)/libhdhomerun/*.h + $(LIB_ROOT)/$(LIBHDHR)/.tvh_download \ + $(LIB_ROOT)/$(LIBHDHR)/.tvh_build \ + $(LIB_ROOT)/libhdhomerun/libhdhomerun.a \ + $(LIB_ROOT)/libhdhomerun/*.h include $(DIR)/Makefile.static diff --git a/Makefile.static b/Makefile.static index fefebe045..d43d8d3ac 100644 --- a/Makefile.static +++ b/Makefile.static @@ -44,7 +44,7 @@ MAKEFILE ?= $(firstword $(MAKEFILE_LIST)) # ./configure override BINTRAY_CACHE ?= $(CONFIG_BINTRAY_CACHE) -default: liball +default: libcacheput # Setup environment for scripts export ARCH @@ -57,25 +57,24 @@ export BINTRAY_USER export BINTRAY_PASS export BINTRAY_REPO +LIB_STATIC_STAMP := $(BUILDDIR)/$(LIB_NAME)_static_stamp + # Download cache .PHONY: libcacheget libcacheget: ifeq ($(BINTRAY_CACHE),yes) @( $(ROOTDIR)/support/lib.sh download $(LIB_NAME) &&\ $(ROOTDIR)/support/lib.sh unpack $(LIB_NAME) ) || true + @touch $(BUILDDIR)/$(LIB_NAME)_static_stamp endif -# Upload +# Download and Upload on demand .PHONY: libcacheput libcacheput: build ifneq ($(BINTRAY_USER),) @$(ROOTDIR)/support/lib.sh upload $(LIB_NAME) $(LIB_FILES) endif -# Do it all -.PHONY: liball -liball: libcacheget libcacheput - # ############################################################################ # Helper routines # ############################################################################ diff --git a/support/lib.sh b/support/lib.sh index afe062df3..62928e30e 100755 --- a/support/lib.sh +++ b/support/lib.sh @@ -38,15 +38,23 @@ [ -z "$BINTRAY_REPO" ] && BINTRAY_REPO=tvheadend/misc [ -z "$ARCH" ] && ARCH=$(uname -m) if [ -z "$CODENAME" ]; then - if [ -f /etc/lsb-release ]; then + CODENAME=$(lsb_release -irs 2> /dev/null) + if [ -z "$CODENAME" -a -f /etc/lsb-release ]; then . /etc/lsb-release CODENAME=${DISTRIB_CODENAME} fi - # TODO: support more than debian + if [ -z "$CODENAME" -a -f /etc/redhat-release ]; then + CODENAME=$(cat /etc/redhat-release | \ + cut -d '(' -f 1 | sed -e 's/Red Hat Enterprise Linux/rhel/g' -e 's/ release / /g' -e 's/ Linux / /g') + fi + if [ -z "$CODENAME" ]; then + CODENAME="unknown" + fi fi +CODENAME=$(echo "$CODENAME" | tr '\n' ' ' | sed -e 's/[[:blank:]]*$//g' -e 's: :%20:g') -# Convert x86_64 (ensure uniformity) -[ "${ARCH}" = "x86_64" ] && ARCH=amd64 +# Convert amd64 to x86_64 (ensure uniformity) +[ "${ARCH}" = "amd64" ] && ARCH=x86_64 # ############################################################################ # Config @@ -102,7 +110,7 @@ function download fi # Move tmp file - mv ${P}.tmp ${P} + mv ${P}.tmp ${P} || return 1 return ${R} } @@ -127,12 +135,12 @@ function unpack fi # Cleanup - rm -rf ${BUILDDIR}/${LIB_NAME} - mkdir -p ${BUILDDIR}/${LIB_NAME} + rm -rf ${BUILDDIR}/${LIB_NAME} || return 1 + mkdir -p ${BUILDDIR}/${LIB_NAME} || return 1 # Unpack echo "UNPACK ${P}" - tar -C ${BUILDDIR}/${LIB_NAME} -xf ${P} + tar -C ${BUILDDIR}/${LIB_NAME} -xf ${P} || return 1 # Record echo ${LIB_HASH} > ${U} @@ -159,16 +167,23 @@ function upload # Build temporary file echo "PACK ${P} [${LIB_FILES}]" - tar -C ${BUILDDIR}/${LIB_NAME} -zcf ${P}.tmp ${LIB_FILES} + tar -C ${BUILDDIR}/${LIB_NAME} -zcf ${P}.tmp ${LIB_FILES} || return 1 # Upload N=staticlib/${CODENAME}/${ARCH}/${LIB_NAME}-${LIB_HASH}.tgz URL="https://api.bintray.com/content/${BINTRAY_REPO}/staticlib/${LIB_NAME}-${LIB_HASH}/${N};publish=1" echo "UPLOAD ${URL}" - curl -s -T ${P}.tmp -u${BINTRAY_USER}:${BINTRAY_PASS} "${URL}" || return 1 + curl -s -T ${P}.tmp -u${BINTRAY_USER}:${BINTRAY_PASS} "${URL}" + R=$? + if [ ${R} -ne 0 ]; then + echo " UPLOAD FAILED! RETRYING..." + sleep 10 + curl -s -T ${P}.tmp -u${BINTRAY_USER}:${BINTRAY_PASS} "${URL}" || return 1 + fi + echo # Done - mv ${P}.tmp ${P} + mv ${P}.tmp ${P} || return 1 } # Run command