This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See crosstool-NG for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.
 
-endif # ! FORBID_DOWNLOAD
-
 config USE_MIRROR
     bool
     prompt "Use a mirror"
@@ -69,6 +67,18 @@
       *not* on your LAN, for example on another subnet of your
company's
       network, or a mirror on the Internet.
 
+if USE_MIRROR
+
+config FORCE_MIRROR
+    bool
+    prompt "Only use mirror"
+    help
+      Only allow downloading from the mirror specified, other download
locations
+      will NOT be used, and the package will fail to be located if not
present
+      on the mirror provided
+
+endif # USE_MIRROR
+
 config MIRROR_BASE_URL
     string
     prompt "Base URL"
@@ -90,3 +100,5 @@
       
       The mirror is available at:
         http://crosstool-ng.org/mirrors/
+
+endif # ! FORBID_DOWNLOAD
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 @@
     fi
     # 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}" )
     fi
 
-    if [ "${CT_FORBID_DOWNLOAD}" != "y" ]; then
+    if [ "${CT_FORCE_MIRROR}" != "y" ]; then
         URLS+=( "${@}" )
     fi
 



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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]