Add an option to forbid downloads.
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Tue Jan 06 22:34:36 2009 +0000 (2009-01-06)
changeset 1131b62d14d45fc4
parent 1130 78681fe5cdd1
child 1132 c232833120c1
Add an option to forbid downloads.
Idea and code-base from Don Elwell <don@manifoldlabs.com>, adapted by me.

/trunk/scripts/functions | 6 6 0 0 ++++++
/trunk/config/global/download.in | 18 18 0 0 ++++++++++++++++++
2 files changed, 24 insertions(+)
config/global/download.in
scripts/functions
     1.1 --- a/config/global/download.in	Tue Jan 06 22:22:02 2009 +0000
     1.2 +++ b/config/global/download.in	Tue Jan 06 22:34:36 2009 +0000
     1.3 @@ -2,6 +2,22 @@
     1.4  
     1.5  comment "Downloading"
     1.6  
     1.7 +config FORBID_DOWNLOAD
     1.8 +    bool
     1.9 +    prompt "Forbid downloads"
    1.10 +    default n
    1.11 +    help
    1.12 +      Normally, crosstool-NG will try to download missing tarballs (or
    1.13 +      checkout from CVS/SVN...).
    1.14 +      If you do not have network connectivity when you run crosstool-NG,
    1.15 +      and some files are missing, it can be a long time before crosstool-NG
    1.16 +      fails.
    1.17 +      
    1.18 +      Saying 'y' here will prevent crosstool-NG from downloading missing
    1.19 +      files, thus failing early so that you don't get stuck.
    1.20 +
    1.21 +if ! FORBID_DOWNLOAD
    1.22 +
    1.23  config FORCE_DOWNLOAD
    1.24      bool
    1.25      prompt "Force downloads"
    1.26 @@ -281,3 +297,5 @@
    1.27        Only download the tarballs. Exit once it done.
    1.28        
    1.29        Usefull to pre-retrieve the tarballs before going off-line.
    1.30 +
    1.31 +endif # ! FORBID_DOWNLOAD
     2.1 --- a/scripts/functions	Tue Jan 06 22:22:02 2009 +0000
     2.2 +++ b/scripts/functions	Tue Jan 06 22:34:36 2009 +0000
     2.3 @@ -480,6 +480,9 @@
     2.4      CT_GetLocal "${file}" ${first_ext} && return 0 || true
     2.5      # No, it does not...
     2.6  
     2.7 +    # Are downloads allowed ?
     2.8 +    CT_TestAndAbort "File '${file}' not present locally, and downloads are not allowed" "${CT_FORBID_DOWNLOAD}" = "y"
     2.9 +
    2.10      # Try to retrieve the file
    2.11      CT_DoLog EXTRA "Retrieving '${file}'"
    2.12      CT_Pushd "${CT_TARBALLS_DIR}"
    2.13 @@ -539,6 +542,9 @@
    2.14      CT_GetLocal "${basename}" && return 0 || true
    2.15      # No, it does not...
    2.16  
    2.17 +    # Are downloads allowed ?
    2.18 +    CT_TestAndAbort "File '${file}' not present locally, and downloads are not allowed" "${CT_FORBID_DOWNLOAD}" = "y"
    2.19 +
    2.20      CT_DoLog EXTRA "Retrieving '${basename}'"
    2.21  
    2.22      CT_MktempDir tmp_dir