[PATCH] [CT_NG] [config] [scripts] fix download options

Austin Morton austinpmorton@gmail.com
Sun Aug 12 11:51:00 GMT 2012

Hello all,

I have been using crosstool-NG for the past few days to build a
toolchain for a powerpc64 system, and while using it, have discovered a
few bugs.

One of my testers was having issues getting crosstool-NG to download
tarballs successfully, and we managed to rule it as an issue with the
remote locations being used for various components.  So I threw together
a mirror of just the components our project needed and changed the
sample I had been distributing to use that mirror.

One of the bugs I found while doing this was the wrongly named
"FORBID_DOWNLOAD" option does not in fact forbid downloads. Rather it
forbids using the locations specified in the call to CT_GetFile,
restricting the requests to only use the mirror specified.

In fixing this issue I found it pleasing to also implement a
"FORCE_MIRROR" option which, as it is named only allows the mirror
specified to be used.

Below is the patch

# HG changeset patch
# User Austin Morton <austinpmorton@gmail.com>
# Date 1344771942 14400
# Node ID f9d225d5e8b1791db661cef261613b9b327dff50
# Parent  9ddca166bb2703129235bacf2e04e0b80f997462
fix download options

Signed-off by: Austin Morton <austinpmorton@gmail.com>

diff -r 9ddca166bb27 -r f9d225d5e8b1 config/global/download.in
--- a/config/global/download.in	Sun Aug 05 00:33:27 2012 +1000
+++ b/config/global/download.in	Sun Aug 12 07:45:42 2012 -0400
@@ -55,8 +55,6 @@
       Useful to pre-retrieve the tarballs before going off-line.
 config USE_MIRROR
     prompt "Use a mirror"
@@ -69,6 +67,18 @@
       *not* on your LAN, for example on another subnet of your
       network, or a mirror on the Internet.
+    bool
+    prompt "Only use mirror"
+    help
+      Only allow downloading from the mirror specified, other download
+      will NOT be used, and the package will fail to be located if not
+      on the mirror provided
+endif # USE_MIRROR
     prompt "Base URL"
@@ -90,3 +100,5 @@
       The mirror is available at:
diff -r 9ddca166bb27 -r f9d225d5e8b1 scripts/functions
--- a/scripts/functions	Sun Aug 05 00:33:27 2012 +1000
+++ b/scripts/functions	Sun Aug 12 07:45:42 2012 -0400
@@ -556,6 +556,12 @@
     # No, it does not...
+    # If not allowed to download from the Internet, don't
+    if [ "${CT_FORBID_DOWNLOAD}" = "y" ]; then
+        CT_DoLog DEBUG "Not allowed to download from the Internet,
aborting ${file} download"
+        return 1
+    fi
     # Try to retrieve the file
     CT_DoLog EXTRA "Retrieving '${file}'"
@@ -566,7 +572,7 @@
         URLS+=( "${CT_MIRROR_BASE_URL}" )
-    if [ "${CT_FORBID_DOWNLOAD}" != "y" ]; then
+    if [ "${CT_FORCE_MIRROR}" != "y" ]; then
         URLS+=( "${@}" )

For unsubscribe information see http://sourceware.org/lists.html#faq

More information about the crossgcc mailing list