mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
contrib: main.mak: Guard downloads with flock.
This is to prevent resource contention on shared file systems such as NFS. * contrib/src/main.mak (download) <wget>: Guard with flock. <curl>: Likewise. <fetch> Likewise, and properly quote shell arguments. (download_git): Likewise. Change-Id: I8e2139d780a34ad054cfa8e188c6cbaf94df0609
This commit is contained in:

committed by
Amin Bandali

parent
f13474e4ac
commit
15174309b8
@ -250,14 +250,12 @@ SVN ?= $(error subversion client (svn) not found!)
|
||||
ifeq ($(DISABLE_CONTRIB_DOWNLOADS),TRUE)
|
||||
download = $(error Trying to download $(1) but DISABLE_CONTRIB_DOWNLOADS is TRUE, aborting.)
|
||||
else ifeq ($(shell wget --version >/dev/null 2>&1 || echo FAIL),)
|
||||
download = wget $(if ${BATCH_MODE},-nv) -t 4 --waitretry 10 -O "$@" "$(1)"
|
||||
download = flock "$@.lock" wget $(if ${BATCH_MODE},-nv) -t 4 --waitretry 10 -O "$@" "$(1)"
|
||||
else ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),)
|
||||
download = curl $(if ${BATCH_MODE},-sS) -f -L --retry-delay 10 --retry 4 -- "$(1)" > "$@"
|
||||
download = flock "$@.lock" curl $(if ${BATCH_MODE},-sS) -f -L --retry-delay 10 --retry 4 -- "$(1)" > "$@"
|
||||
else ifeq ($(which fetch >/dev/null 2>&1 || echo FAIL),)
|
||||
download = rm -f $@.tmp && \
|
||||
fetch -p -o $@.tmp "$(1)" && \
|
||||
touch $@.tmp && \
|
||||
mv $@.tmp $@
|
||||
download = flock "$@.lock" sh -c \
|
||||
'rm -f "$@.tmp" && fetch -p -o "$@.tmp" "$(1)" && touch "$@.tmp" && mv "$@.tmp" "$@"'
|
||||
else
|
||||
download = $(error Neither wget nor curl found!)
|
||||
endif
|
||||
@ -338,14 +336,13 @@ HOSTVARS := $(HOSTTOOLS) \
|
||||
ifeq ($(DISABLE_CONTRIB_DOWNLOADS),TRUE)
|
||||
download_git = $(error Trying to clone $(1) but DISABLE_CONTRIB_DOWNLOADS is TRUE, aborting.)
|
||||
else
|
||||
download_git = \
|
||||
rm -Rf $(@:.tar.xz=) && \
|
||||
$(GIT) clone $(2:%=--branch %) $(1) $(@:.tar.xz=) && \
|
||||
(cd $(@:.tar.xz=) && $(GIT) checkout $(3:%= %)) && \
|
||||
(test -z "$(4)" && rm -Rf $(@:%.tar.xz=%)/.git) || true && \
|
||||
(cd $(dir $@) && \
|
||||
tar cJ $(notdir $(@:.tar.xz=))) > $@ && \
|
||||
rm -Rf $(@:.tar.xz=)
|
||||
download_git = flock "$@.lock" sh -c "\
|
||||
rm -Rf '$(@:.tar.xz=)' && \
|
||||
$(GIT) clone $(2:%=--branch '%') '$(1)' '$(@:.tar.xz=)' && \
|
||||
(cd '$(@:.tar.xz=)' && $(GIT) checkout $(3:%= '%')) && \
|
||||
(test -z '$(4)' && rm -Rf $(@:%.tar.xz='%')/.git) || true && \
|
||||
(cd '$(dir $@)' && tar cJ '$(notdir $(@:.tar.xz=))') > '$@' && \
|
||||
rm -Rf '$(@:.tar.xz=)'"
|
||||
endif
|
||||
|
||||
checksum = \
|
||||
|
Reference in New Issue
Block a user