[PATCH] make setup mirror list more like web page not just urls

Jon Turney jon.turney@dronecode.org.uk
Fri Nov 17 13:53:00 GMT 2017

On 15/11/2017 21:35, Brian Inglis wrote:
> I wondered if we could usefully add the mirrors.lst region and territory
> (called area and location in the code) to the Setup display, to avoid users
> having to refer to the web page to find out where mirrors are based geographically.

Thanks for the patch.

Nice idea.  I hadn't noticed that this information is in mirrors.lst, 
but we're failing to use it.

> The first change was to prefix the displayed_url member in site.cc
> site_list_type::init "constructor" with "area - location - ".

The 'real solution' to this would be to drag setup into the present 
century and use a grid control to present this information.

Lots of work, though :(

> The sort key was the mirror url host name with the domain components in reverse
> order to sort non-country TLDs together before CC TLDs.
> The code tested for TLD length == 3 to distinguish between CC and non-CC TLDs,
> as this code is over 10 years old and there were only the original com, edu,
> gov, mil, net, org non-CC domains, before other gTLDs were added.
> That test was changed to handle all gTLDs with length >= 3, to prefix area and
> location to the sort key member, reverse the domain components in the servername
> field instead of the url host, and suffix the url protocol prefix to keep the
> key unique where sites offer both ftp and http mirrors, rather than the whole
> url in the original.

This code needs to handle manually added URLs with non-FQDNs.

Although we give no indication of it in the UI, I think you can also 
just add a path.

Can you test your changes in those cases?

It's also a long-standing defect here that if you add two URLs with the 
same protocol/host, they aren't distinguishable [1]

[1] https://cygwin.com/ml/cygwin-apps/2010-11/msg00178.html

> When this was displayed in setup, some of the urls were cut off by the list box
> border, estimated about 3 ems too narrow.
> The width of the list box and related controls in res.rc was increased by about
> 30 pixels, and the position of the Add button moved over the same amount, to
> give an acceptable display.
> The required patch is attached for discussion: some may not like the display of
> the default mirror from /etc/setup/setup.rc last_mirror, which appears in the
> list as " - - url", as the other mirrors.lst fields are not currently saved
> under last_mirror, and more work may be needed to improve this.

Yeah, that's going to need fixing.

- If the URL matches one in the list, that item should be selected.
- Store area and location so we can populate those fields if it doesn't.

Please, please use git-format-patch in future.

The patch also has some spurious changes to the mode of the manifest files.

More information about the Cygwin-apps mailing list