How I could restrict download mirrors

Ryan Schmidt ryandesign at macports.org
Fri Mar 22 05:26:50 UTC 2019



On Mar 18, 2019, at 03:30, FritzS wrote:

> How I could restrict download mirrors?

As Chris mentioned, the options that exist in macports.conf are host_blacklist and preferred_hosts. But the question is: why do you want to restrict this?


> I want only download ports from macports.org server self or european mirrors, like French, German, Austrian, etc. mirrors.

What do you mean by "download ports"?

MacPorts base updates will only be downloaded from the rsync server specified in rsync_server in macports.conf. So you can change this to a closer mirror if you want to. You can see a list of available mirrors at https://trac.macports.org/wiki/Mirrors

Similarly, the portfile definitions (the ports tree) will only be downloaded from the source you specify in sources.conf.

If MacPorts is installed in the normal /opt/local prefix and certain options in macports.conf are set at their default values, then when you request to install ports, MacPorts will try to download binaries/packages/archives of them. The servers from which it will try to download binaries are specified in the _resources/port1.0/fetch/archive_sites.tcl file in the ports tree. MacPorts will try them in ascending order by ping time, so the servers closest to you will be tried first and there should be no need to override this, but if you need to exclude one or more servers that are misbehaving, you can blacklist them by adding them to host_blacklist in macports.conf. And if you want one or more of these servers to be tried first, regardless of ping time, you can add them to preferred_hosts.

If a binary of a port is not available or if you have configured MacPorts not to use binaries, then the port will build from source. The source code will be downloaded from the server(s) specified in the Portfile and/or the _resources/port1.0/fetch/mirror_sites.tcl file in the ports tree. Same as above, they're tried in ping order, so MacPorts should already be picking the best server for you automatically. Same as above, you could use host_blacklist to prevent a "bad" server from being used, but you would only really use that if there was something unique about your network situation that makes a server "bad" for you but not for anybody else; obviously if a server were "bad" for everybody we'd remove it. You could also use preferred_hosts, for example to give a preference to distfiles.macports.org or a closer MacPorts mirror, if for some reason you really don't want to download from a different server that might be closer to you and therefore faster. If a file is not available on your preferred server(s), MacPorts will try to download from other servers (unless they're blacklisted). There are a few ports for which we cannot mirror the source code, because they can only fetch their source code from a single server (a repository using git, hg, svn, etc.), so there's nothing that can be usefully configured about that; if you've blacklisted that one server, then you won't be able to build that port.




More information about the macports-users mailing list