Ticket #52626: remove-fallback_mirror_site.diff

File remove-fallback_mirror_site.diff, 6.5 KB (added by raimue (Rainer Müller), 8 years ago)
  • src/port1.0/fetch_common.tcl

     
    8484# For a given mirror site type, e.g. "gnu" or "x11", check to see if there's a
    8585# pre-registered set of sites, and if so, return them.
    8686proc portfetch::mirror_sites {mirrors tag subdir mirrorfile} {
    87     global UI_PREFIX name dist_subdir \
    88            global_mirror_site fallback_mirror_site
     87    global UI_PREFIX name dist_subdir global_mirror_site
    8988
    9089    if {[file exists $mirrorfile]} {
    9190        source $mirrorfile
    9291    }
    9392
    9493    if {![info exists portfetch::mirror_sites::sites($mirrors)]} {
    95         if {$mirrors != $global_mirror_site && $mirrors != $fallback_mirror_site} {
     94        if {$mirrors != $global_mirror_site} {
    9695            ui_warn "[format [msgcat::mc "No mirror sites on file for class %s"] $mirrors]"
    9796        }
    9897        return {}
     
    162161            continue
    163162        }
    164163        global ${listname}.mirror_subdir
    165         # add the specified global, fallback and user-defined mirrors
    166         set sglobal [lindex $extras 0]; set sfallback [lindex $extras 1]; set senv [lindex $extras 2]
     164        # add the specified global and user-defined mirrors
     165        set sglobal [lindex $extras 0]; set senv [lindex $extras 2]
    167166        set full_list [set $listname]
    168         append full_list " $sglobal $sfallback"
     167        append full_list " $sglobal"
    169168        if {[info exists env($senv)]} {
    170169            set full_list [concat $env($senv) $full_list]
    171170        }
     
    189188            }
    190189        }
    191190
    192         # add in the global, fallback and user-defined mirrors for each tag
     191        # add in the global and user-defined mirrors for each tag
    193192        foreach site $site_list {
    194193            if {[regexp {([a-zA-Z]+://.+/?):([0-9A-Za-z_-]+)$} $site match site tag] && ![info exists extras_added($tag)]} {
    195194                if {$sglobal ne ""} {
    196195                    set site_list [concat $site_list [mirror_sites $sglobal $tag "" $mirrorfile]]
    197196                }
    198                 if {$sfallback ne ""} {
    199                     set site_list [concat $site_list [mirror_sites $sfallback $tag "" $mirrorfile]]
    200                 }
    201197                if {[info exists env($senv)]} {
    202198                    set site_list [concat [list $env($senv)] $site_list]
    203199                }
     
    216212}
    217213
    218214# sorts fetch_urls in order of ping time
    219 proc portfetch::sortsites {urls fallback_mirror_list default_listvar} {
     215proc portfetch::sortsites {urls default_listvar} {
    220216    global $default_listvar
    221217    upvar $urls fetch_urls
    222218    variable urlmap
     
    234230        set hosts {}
    235231        set hostregex {[a-zA-Z]+://([a-zA-Z0-9\.\-_]+)}
    236232
    237         if {[llength $urllist] - [llength $fallback_mirror_list] <= 1} {
     233        if {[llength $urllist] <= 1} {
    238234            # there is only one mirror, no need to ping or sort
    239235            continue
    240236        }
     
    257253            if { [info exists seen($host)] } {
    258254                continue
    259255            }
    260             foreach fallback $fallback_mirror_list {
    261                 if {[string match ${fallback}* $site]} {
    262                     # don't bother pinging fallback mirrors
    263                     set seen($host) yes
    264                     # and make them sort to the very end of the list
    265                     set pingtimes($host) 20000
    266                     break
    267                 }
    268             }
    269256            if { ![info exists seen($host)] } {
    270257                # first check the persistent cache
    271258                set pingtimes($host) [get_pingtime $host]
     
    285272        foreach host $hosts {
    286273            gets $fds($host) pingtimes($host)
    287274            if { [catch { close $fds($host) }] || ![string is double -strict $pingtimes($host)] } {
    288                 # ping failed, so put it last in the list (but before the fallback mirrors)
     275                # ping failed, so put it last in the list
    289276                set pingtimes($host) 10000
    290277            }
    291278            # cache it
  • src/port1.0/portfetch.tcl

     
    116116# Use remote timestamps
    117117default fetch.remote_time "no"
    118118
    119 default fallback_mirror_site "macports"
    120119default global_mirror_site "macports_distfiles"
    121120default mirror_sites.listfile {"mirror_sites.tcl"}
    122121default mirror_sites.listpath {"port1.0/fetch"}
     
    274273# Perform the full checksites/checkpatchfiles/checkdistfiles sequence.
    275274# This method is used by distcheck target.
    276275proc portfetch::checkfiles {urls} {
    277     global global_mirror_site fallback_mirror_site
     276    global global_mirror_site
    278277    upvar $urls fetch_urls
    279278
    280     checksites [list patch_sites [list $global_mirror_site $fallback_mirror_site PATCH_SITE_LOCAL] \
    281                 master_sites [list $global_mirror_site $fallback_mirror_site MASTER_SITE_LOCAL]] \
     279    checksites [list patch_sites [list $global_mirror_site PATCH_SITE_LOCAL] \
     280                master_sites [list $global_mirror_site MASTER_SITE_LOCAL]] \
    282281               [get_full_mirror_sites_path]
    283282    checkpatchfiles fetch_urls
    284283    checkdistfiles fetch_urls
     
    485484proc portfetch::fetchfiles {args} {
    486485    global distpath all_dist_files UI_PREFIX \
    487486           fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert fetch.remote_time \
    488            fallback_mirror_site portverbose usealtworkpath altprefix
     487           portverbose usealtworkpath altprefix
    489488    variable fetch_urls
    490489    variable urlmap
    491490
     
    527526                continue
    528527            }
    529528            if {!$sorted} {
    530                 sortsites fetch_urls [mirror_sites $fallback_mirror_site {} {} [get_full_mirror_sites_path]] master_sites
     529                sortsites fetch_urls master_sites
    531530                set sorted yes
    532531            }
    533532            if {![info exists urlmap($url_var)]} {
  • src/package1.0/portarchivefetch.tcl

     
    209209                return -code error [format [msgcat::mc "%s must be writable"] $incoming_path]
    210210            }
    211211            if {!$sorted} {
    212                 portfetch::sortsites archivefetch_urls {} archive_sites
     212                portfetch::sortsites archivefetch_urls archive_sites
    213213                set sorted yes
    214214            }
    215215            if {![info exists urlmap($url_var)]} {