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
84 84 # For a given mirror site type, e.g. "gnu" or "x11", check to see if there's a 85 85 # pre-registered set of sites, and if so, return them. 86 86 proc 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 89 88 90 89 if {[file exists $mirrorfile]} { 91 90 source $mirrorfile 92 91 } 93 92 94 93 if {![info exists portfetch::mirror_sites::sites($mirrors)]} { 95 if {$mirrors != $global_mirror_site && $mirrors != $fallback_mirror_site} {94 if {$mirrors != $global_mirror_site} { 96 95 ui_warn "[format [msgcat::mc "No mirror sites on file for class %s"] $mirrors]" 97 96 } 98 97 return {} … … 162 161 continue 163 162 } 164 163 global ${listname}.mirror_subdir 165 # add the specified global , fallbackand user-defined mirrors166 set sglobal [lindex $extras 0]; set s fallback [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] 167 166 set full_list [set $listname] 168 append full_list " $sglobal $sfallback"167 append full_list " $sglobal" 169 168 if {[info exists env($senv)]} { 170 169 set full_list [concat $env($senv) $full_list] 171 170 } … … 189 188 } 190 189 } 191 190 192 # add in the global , fallbackand user-defined mirrors for each tag191 # add in the global and user-defined mirrors for each tag 193 192 foreach site $site_list { 194 193 if {[regexp {([a-zA-Z]+://.+/?):([0-9A-Za-z_-]+)$} $site match site tag] && ![info exists extras_added($tag)]} { 195 194 if {$sglobal ne ""} { 196 195 set site_list [concat $site_list [mirror_sites $sglobal $tag "" $mirrorfile]] 197 196 } 198 if {$sfallback ne ""} {199 set site_list [concat $site_list [mirror_sites $sfallback $tag "" $mirrorfile]]200 }201 197 if {[info exists env($senv)]} { 202 198 set site_list [concat [list $env($senv)] $site_list] 203 199 } … … 216 212 } 217 213 218 214 # sorts fetch_urls in order of ping time 219 proc portfetch::sortsites {urls fallback_mirror_listdefault_listvar} {215 proc portfetch::sortsites {urls default_listvar} { 220 216 global $default_listvar 221 217 upvar $urls fetch_urls 222 218 variable urlmap … … 234 230 set hosts {} 235 231 set hostregex {[a-zA-Z]+://([a-zA-Z0-9\.\-_]+)} 236 232 237 if {[llength $urllist] - [llength $fallback_mirror_list]<= 1} {233 if {[llength $urllist] <= 1} { 238 234 # there is only one mirror, no need to ping or sort 239 235 continue 240 236 } … … 257 253 if { [info exists seen($host)] } { 258 254 continue 259 255 } 260 foreach fallback $fallback_mirror_list {261 if {[string match ${fallback}* $site]} {262 # don't bother pinging fallback mirrors263 set seen($host) yes264 # and make them sort to the very end of the list265 set pingtimes($host) 20000266 break267 }268 }269 256 if { ![info exists seen($host)] } { 270 257 # first check the persistent cache 271 258 set pingtimes($host) [get_pingtime $host] … … 285 272 foreach host $hosts { 286 273 gets $fds($host) pingtimes($host) 287 274 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 289 276 set pingtimes($host) 10000 290 277 } 291 278 # cache it -
src/port1.0/portfetch.tcl
116 116 # Use remote timestamps 117 117 default fetch.remote_time "no" 118 118 119 default fallback_mirror_site "macports"120 119 default global_mirror_site "macports_distfiles" 121 120 default mirror_sites.listfile {"mirror_sites.tcl"} 122 121 default mirror_sites.listpath {"port1.0/fetch"} … … 274 273 # Perform the full checksites/checkpatchfiles/checkdistfiles sequence. 275 274 # This method is used by distcheck target. 276 275 proc portfetch::checkfiles {urls} { 277 global global_mirror_site fallback_mirror_site276 global global_mirror_site 278 277 upvar $urls fetch_urls 279 278 280 checksites [list patch_sites [list $global_mirror_site $fallback_mirror_sitePATCH_SITE_LOCAL] \281 master_sites [list $global_mirror_site $fallback_mirror_siteMASTER_SITE_LOCAL]] \279 checksites [list patch_sites [list $global_mirror_site PATCH_SITE_LOCAL] \ 280 master_sites [list $global_mirror_site MASTER_SITE_LOCAL]] \ 282 281 [get_full_mirror_sites_path] 283 282 checkpatchfiles fetch_urls 284 283 checkdistfiles fetch_urls … … 485 484 proc portfetch::fetchfiles {args} { 486 485 global distpath all_dist_files UI_PREFIX \ 487 486 fetch.user fetch.password fetch.use_epsv fetch.ignore_sslcert fetch.remote_time \ 488 fallback_mirror_siteportverbose usealtworkpath altprefix487 portverbose usealtworkpath altprefix 489 488 variable fetch_urls 490 489 variable urlmap 491 490 … … 527 526 continue 528 527 } 529 528 if {!$sorted} { 530 sortsites fetch_urls [mirror_sites $fallback_mirror_site {} {} [get_full_mirror_sites_path]]master_sites529 sortsites fetch_urls master_sites 531 530 set sorted yes 532 531 } 533 532 if {![info exists urlmap($url_var)]} { -
src/package1.0/portarchivefetch.tcl
209 209 return -code error [format [msgcat::mc "%s must be writable"] $incoming_path] 210 210 } 211 211 if {!$sorted} { 212 portfetch::sortsites archivefetch_urls {}archive_sites212 portfetch::sortsites archivefetch_urls archive_sites 213 213 set sorted yes 214 214 } 215 215 if {![info exists urlmap($url_var)]} {