diff options
author | Alexey Neyman <stilor@att.net> | 2017-02-14 06:45:45 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-14 06:45:45 (GMT) |
commit | fbc69323085e2370faeb8b46291cd66cbf9ef649 (patch) | |
tree | 10da28cd40b45913f6104c07badbf48971500066 /scripts | |
parent | c440a13a8231e267827349065a90f98fac3d4cc0 (diff) | |
parent | f9bec4ed7c4540de73c82c94053f975c5c7c29e4 (diff) |
Merge pull request #594 from stilor/wget-vs-curl
Select wget vs curl, BSD stat vs GNU stat
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/config.guess | 5 | ||||
-rwxr-xr-x | scripts/config.sub | 5 | ||||
-rw-r--r-- | scripts/functions | 49 | ||||
-rwxr-xr-x[-rw-r--r--] | scripts/scripts.mk | 24 | ||||
-rw-r--r-- | scripts/scripts.mk.in | 64 |
5 files changed, 116 insertions, 31 deletions
diff --git a/scripts/config.guess b/scripts/config.guess index bbd48b6..1000e2b 100755 --- a/scripts/config.guess +++ b/scripts/config.guess @@ -2,7 +2,7 @@ # Attempt to guess a canonical system name. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-01-01' +timestamp='2017-02-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -1343,6 +1343,9 @@ EOF NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; + NSX-?:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk${UNAME_RELEASE} + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; diff --git a/scripts/config.sub b/scripts/config.sub index 7e792b4..87abeab 100755 --- a/scripts/config.sub +++ b/scripts/config.sub @@ -2,7 +2,7 @@ # Configuration validation subroutine script. # Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2017-01-01' +timestamp='2017-02-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -948,6 +948,9 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf diff --git a/scripts/functions b/scripts/functions index 9f852b3..84054d5 100644 --- a/scripts/functions +++ b/scripts/functions @@ -567,15 +567,15 @@ CT_DoForceRmdir() { local mode for dir in "${@}"; do [ -d "${dir}" ] || continue - case "$CT_SYS_OS" in - Linux|CYGWIN*) + case "${CT_CONFIGURE_has_stat_flavor_GNU},${CT_CONFIGURE_has_stat_flavor_BSD}" in + y,*) mode="$(stat -c '%a' "$(dirname "${dir}")")" ;; - Darwin|*BSD) + *,y) mode="$(stat -f '%Lp' "$(dirname "${dir}")")" ;; *) - CT_Abort "Unhandled host OS $CT_SYS_OS" + CT_Abort "Unknown stat format options" ;; esac CT_DoExecLog ALL chmod u+w "$(dirname "${dir}")" @@ -663,29 +663,34 @@ CT_DoGetFile() { local url="${1}" local dest="${CT_TARBALLS_DIR}/${url##*/}" local tmp="${dest}.tmp-dl" + local ok + local T # Remove potential left-over from a previous run rm -f "${tmp}" - # We also retry a few times, in case there is a transient error (eg. behind - # a dynamic IP that changes during the transfer...) - # With automated download as we are doing, it can be very dangerous to - # continue the downloads. It's far better to simply overwrite the - # destination file. - # Some company networks have firewalls to connect to the internet, but it's - # not easy to detect them, so force a global ${CT_CONNECT_TIMEOUT}-second - # timeout. - if [ ${CT_CONNECT_TIMEOUT} = -1 ]; then - T= - else - T="-T ${CT_CONNECT_TIMEOUT}" + # Replace a special value of '-1' with empty string + if [ ${CT_CONNECT_TIMEOUT} != -1 ]; then + T="${CT_CONNECT_TIMEOUT}" + fi + + if [ "${CT_DOWNLOAD_AGENT_WGET}" = "y" ]; then + if CT_DoExecLog ALL wget ${CT_DOWNLOAD_WGET_OPTIONS} \ + ${T:+-T ${T}} \ + -O "${tmp}" \ + "${url}"; then + ok=y + fi + elif [ "${CT_DOWNLOAD_AGENT_CURL}" = "y" ]; then + if CT_DoExecLog ALL curl ${CT_DOWNLOAD_CURL_OPTIONS} \ + ${T:+--connect-timeout ${T}} \ + -o "${tmp}" \ + "${url}"; then + ok=y + fi fi - if CT_DoExecLog ALL wget --passive-ftp --tries=3 -nc \ - --progress=dot:binary \ - ${T} \ - -O "${tmp}" \ - "${url}" - then + + if [ "${ok}" = "y" ]; then # Success, we got it, good! mv "${tmp}" "${dest}" CT_DoLog DEBUG "Got it from: \"${url}\"" diff --git a/scripts/scripts.mk b/scripts/scripts.mk index 77368a7..42aacab 100644..100755 --- a/scripts/scripts.mk +++ b/scripts/scripts.mk @@ -26,9 +26,19 @@ updatetools: $(CONFIG_SUB_DEST) $(CONFIG_GUESS_DEST) # ---------------------------------------------------------- # How to retrieve the tools -wget_opt=-o /dev/null -ifeq ($(strip $(V)),2) - wget_opt= +ifneq ($(strip $(V)),2) + wget_silent_opt = -o /dev/null + curl_silent_opt = --silent +endif + +ifneq (wget,) +download_cmd = wget --passive-ftp $(wget_silent_opt) -O $@ +else +ifneq (curl,) +download_cmd = curl --ftp-pasv $(curl_silent_opt) -o $@ +else +download_cmd = $(error wget or curl needed for downloads) +endif endif PHONY += scripts @@ -37,13 +47,13 @@ scripts: $(SILENT)mkdir -p $@ $(CONFIG_SUB_DEST): scripts FORCE - @$(CT_ECHO) ' WGET $@' - $(SILENT)wget $(wget_opt) -O $@ $(CONFIG_SUB_SRC) + @$(CT_ECHO) ' DOWNLOAD $@' + $(SILENT)$(download_cmd) $(CONFIG_SUB_SRC) $(SILENT)chmod u+rwx,go+rx-w $@ $(CONFIG_GUESS_DEST): scripts FORCE - @$(CT_ECHO) ' WGET $@' - $(SILENT)wget $(wget_opt) -O $@ $(CONFIG_GUESS_SRC) + @$(CT_ECHO) ' DOWNLOAD $@' + $(SILENT)$(download_cmd) $(CONFIG_GUESS_SRC) $(SILENT)chmod u+rwx,go+rx-w $@ # ---------------------------------------------------------- diff --git a/scripts/scripts.mk.in b/scripts/scripts.mk.in new file mode 100644 index 0000000..99b9d76 --- /dev/null +++ b/scripts/scripts.mk.in @@ -0,0 +1,64 @@ +# Makefile for the scripts/ sub-directory + +# Here, we can update the config.* scripts. +# If we're in CT_LIB_DIR, then CT_LIB_DIR == CT_TOP_DIR, and we can update those +# scripts for later inclusion mainline. If CT_LIB_DIR != CT_TOP_DIR, then those +# scripts are downloaded only for use in CT_TOP_DIR. + +# ---------------------------------------------------------- +# The tools help entry + +help-distrib:: + @echo ' updatetools - Update the config tools' + +# ---------------------------------------------------------- +# Where to get tools from, and where to store them into +# The tools are: config.guess and config.sub + +CONFIG_SUB_SRC="http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" +CONFIG_SUB_DEST=scripts/config.sub +CONFIG_GUESS_SRC="http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" +CONFIG_GUESS_DEST=scripts/config.guess + +PHONY += updatetools +updatetools: $(CONFIG_SUB_DEST) $(CONFIG_GUESS_DEST) + +# ---------------------------------------------------------- +# How to retrieve the tools + +ifneq ($(strip $(V)),2) + wget_silent_opt = -o /dev/null + curl_silent_opt = --silent +endif + +ifneq (@@CT_wget@@,) +download_cmd = wget --passive-ftp $(wget_silent_opt) -O $@ +else +ifneq (@@CT_curl@@,) +download_cmd = curl --ftp-pasv $(curl_silent_opt) -o $@ +else +download_cmd = $(error wget or curl needed for downloads) +endif +endif + +PHONY += scripts +scripts: + @$(CT_ECHO) ' MKDIR $@' + $(SILENT)mkdir -p $@ + +$(CONFIG_SUB_DEST): scripts FORCE + @$(CT_ECHO) ' DOWNLOAD $@' + $(SILENT)$(download_cmd) $(CONFIG_SUB_SRC) + $(SILENT)chmod u+rwx,go+rx-w $@ + +$(CONFIG_GUESS_DEST): scripts FORCE + @$(CT_ECHO) ' DOWNLOAD $@' + $(SILENT)$(download_cmd) $(CONFIG_GUESS_SRC) + $(SILENT)chmod u+rwx,go+rx-w $@ + +# ---------------------------------------------------------- +# Clean up the mess + +distclean:: + @$(CT_ECHO) " CLEAN scripts" + $(SILENT)[ $(CT_TOP_DIR) = $(CT_LIB_DIR) ] || rm -rf $(CT_TOP_DIR)/scripts |