On 08/11/2010 05:54, Christopher Faylor wrote: > On Sun, Nov 07, 2010 at 03:54:50PM +0000, Jon TURNEY wrote: >> On 06/11/2010 18:00, Christopher Faylor wrote: >>> This is great, please check in. I suspect that you're just trying a >>> local mirror or something but if there are actually sites in the mirror >>> list which are not proper FQDNs, please report them so that they can be >>> fixed in the mirror database. >> >> Yes, you are correct. There are no sites in the mirror list which aren't >> FQDNs. I was just fixing what happens when you add 'http://localhost/cygwin/' >> (or some other locally-known non-FQDN) to the mirror list. >> >> Just to be clear, you want me to check in the whole patch, and not just that >> fix? > > Actually, on reflection, I don't see a great benefit to parsing the UFL. > Why not just list the whole thing? What would be more useful to the > Cygwin project would be to list the other information like country.
As a start, the attached patch removes the URL parsing and just shows the whole URL in the site chooser. I think displaying multiple columns of information would require a grid control of some sort.
>From 53f70e0140b2eab531fbe320e50e27d2e598dd53 Mon Sep 17 00:00:00 2001 From: Jon TURNEY <[email protected]> Date: Thu, 4 Nov 2010 23:36:54 +0000 Subject: [PATCH] Show the full URL in site chooser If, for example, I manually add the site http://mirrors.kernel.org/sources.redhat.com/cygwinports/ to setup's mirror list, currently I get two indistinguishable entries named http://mirrors.kernel.org. Furthermore, because the code to ensure the site just added is selected uses the string inside the list control to locate elements, we end up with a random one of those two indistinguishable entries selected (usually the previously existing one). This problem also prevents the selection of such indistingushable sites from being correctly saved and restored for the next setup run. So, to make the site chooser list entries unique and distinguishable, show the full URL 2010-11-09 Jon TURNEY <[email protected]> * site.cc (init): Show full URL, not just protocol and sitename in the site chooser --- site.cc | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/site.cc b/site.cc index cafeac3..c496a12 100644 --- a/site.cc +++ b/site.cc @@ -140,10 +140,13 @@ site_list_type::init (const string &_url, const string &_servername, servername = _servername; area = _area; location = _location; - displayed_url = url.substr (0, url.find ("/", url.find ("."))); + displayed_url = _url; + /* the sorting key is hostname components in reverse order (to sort by country code) + plus the url (to ensure uniqueness) */ key = string(); - string::size_type last_idx = displayed_url.length () - 1; + string::size_type path_offset = url.find ("/", url.find ("//") + 2); + string::size_type last_idx = path_offset - 1; string::size_type idx = url.find_last_of("./", last_idx); if (last_idx - idx == 3) { -- 1.7.2.3
