From 35f89c406423344b19dcf3e3f95ff6296f329e42 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 12 Feb 2017 13:51:42 -0800 Subject: Detect both wget/curl and allow user to select the agent Signed-off-by: Alexey Neyman --- scripts/functions | 41 ++++++++++++++++++--------------- scripts/scripts.mk | 54 ------------------------------------------- scripts/scripts.mk.in | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 72 deletions(-) delete mode 100644 scripts/scripts.mk create mode 100644 scripts/scripts.mk.in (limited to 'scripts') diff --git a/scripts/functions b/scripts/functions index 9f852b39..65ce4981 100644 --- a/scripts/functions +++ b/scripts/functions @@ -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 deleted file mode 100644 index 77368a7e..00000000 --- a/scripts/scripts.mk +++ /dev/null @@ -1,54 +0,0 @@ -# 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 - -wget_opt=-o /dev/null -ifeq ($(strip $(V)),2) - wget_opt= -endif - -PHONY += scripts -scripts: - @$(CT_ECHO) ' MKDIR $@' - $(SILENT)mkdir -p $@ - -$(CONFIG_SUB_DEST): scripts FORCE - @$(CT_ECHO) ' WGET $@' - $(SILENT)wget $(wget_opt) -O $@ $(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) - $(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 diff --git a/scripts/scripts.mk.in b/scripts/scripts.mk.in new file mode 100644 index 00000000..99b9d76b --- /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 -- cgit v1.2.3 From 41ba1d99c8801cf27bf59daf3663eee89156afa0 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 12 Feb 2017 13:52:13 -0800 Subject: Update config.{guess,sub} while testing curl Signed-off-by: Alexey Neyman --- scripts/config.guess | 5 ++++- scripts/config.sub | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/config.guess b/scripts/config.guess index bbd48b60..1000e2bd 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 7e792b4a..87abeab6 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 -- cgit v1.2.3 From f9bec4ed7c4540de73c82c94053f975c5c7c29e4 Mon Sep 17 00:00:00 2001 From: Alexey Neyman Date: Sun, 12 Feb 2017 14:23:16 -0800 Subject: stat: determine whether it is BSD or GNU flavor Seems like MacOS may have either in the path. Signed-off-by: Alexey Neyman --- configure.ac | 21 +++++++++++++++++- scripts/functions | 8 +++---- scripts/scripts.mk | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 5 deletions(-) create mode 100755 scripts/scripts.mk (limited to 'scripts') diff --git a/configure.ac b/configure.ac index 0e60f3b2..11c5a8e8 100644 --- a/configure.ac +++ b/configure.ac @@ -216,7 +216,6 @@ ACX_CHECK_PROGS_REQ([bison], [bison]) ACX_CHECK_PROGS_REQ([flex], [flex]) ACX_CHECK_PROGS_REQ([makeinfo], [makeinfo]) ACX_CHECK_PROGS_REQ([cut], [cut]) -ACX_CHECK_PROGS_REQ([stat], [stat]) ACX_CHECK_PROGS_REQ([readlink], [readlink]) ACX_CHECK_PROGS_REQ([tar], [tar]) ACX_CHECK_PROGS_REQ([gzip], [gzip]) @@ -233,6 +232,26 @@ AC_CHECK_PROGS([curl], [curl]) ACX_SET_KCONFIG_OPTION([curl]) AC_SUBST([curl]) +ACX_CHECK_PROGS_REQ([stat], [stat]) +AC_CACHE_CHECK([whether stat takes GNU or BSD format], + [acx_cv_stat_flavor], + [touch conftest + chmod 642 conftest + attr_bsd=`stat -f '%Lp' conftest 2>/dev/null` + attr_gnu=`stat -c '%a' conftest 2>/dev/null` + rm -f conftest + AS_IF([test "$attr_bsd" = "642"], + [acx_cv_stat_flavor=BSD], + [test "$attr_gnu" = "642"], + [acx_cv_stat_flavor=GNU], + [AC_MSG_ERROR([cannot determine stat(1) format option])])]) + +# FIXME: support SET_KCONFIG_OPTION with string values? But then +# again, these checks may be moved into ct-ng script. +test "$acx_cv_stat_flavor" = "BSD" && stat_flavor_BSD=y +ACX_SET_KCONFIG_OPTION([stat_flavor_BSD]) +test "$acx_cv_stat_flavor" = "GNU" && stat_flavor_GNU=y +ACX_SET_KCONFIG_OPTION([stat_flavor_GNU]) #-------------------------------------------------------------------- # Still boring, but remember the path, now... diff --git a/scripts/functions b/scripts/functions index 65ce4981..84054d58 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}")" diff --git a/scripts/scripts.mk b/scripts/scripts.mk new file mode 100755 index 00000000..42aacab6 --- /dev/null +++ b/scripts/scripts.mk @@ -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 (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 +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 -- cgit v1.2.3