Changeset 18771


Ignore:
Timestamp:
Jul 27, 2006, 11:49:48 PM (14 years ago)
Author:
pguyot (Paul Guyot)
Message:

Fix the bug known as the GNOME fetch problem:

  • removed buggy code
  • cleaned up the fetch code by splitting dist files checking, sites checking and patch files checking
  • dist files checking will not do anything if no dist file is defined (e.g. with cvs & svn fetches).
  • the check now always happen.

My tests of this code are limited. It works with:
py-gnome
bug #5269 test case

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portfetch.tcl

    r18739 r18771  
    11# et:ts=4
    22# portfetch.tcl
    3 # $Id: portfetch.tcl,v 1.113 2006/07/26 03:49:41 yeled Exp $
     3# $Id: portfetch.tcl,v 1.114 2006/07/27 23:49:48 pguyot Exp $
    44#
    55# Copyright (c) 2002 - 2003 Apple Computer, Inc.
     
    188188}
    189189
    190 # Checks all files and their tags to assemble url lists for later fetching
     190# Checks sites.
    191191# sites tags create variables in the portfetch:: namespace containing all sites
    192192# within that tag distfiles are added in $site $distfile format, where $site is
    193193# the name of a variable in the portfetch:: namespace containing a list of fetch
    194194# sites
    195 proc checkfiles {args} {
    196     global distfiles patchfiles all_dist_files patch_sites fetch_urls \
    197         master_sites filespath master_sites.mirror_subdir \
     195proc checksites {args} {
     196    global patch_sites master_sites master_sites.mirror_subdir \
    198197        patch_sites.mirror_subdir fallback_mirror_site env
    199198   
     
    241240        }
    242241    }
     242}
     243
     244# Checks patch files and their tags to assemble url lists for later fetching
     245proc checkpatchfiles {args} {
     246    global patchfiles all_dist_files patch_sites fetch_urls \
     247        filespath
    243248   
    244249    if {[info exists patchfiles]} {
     
    258263        }
    259264    }
    260    
     265}
     266
     267# Checks dist files and their tags to assemble url lists for later fetching
     268proc checkdistfiles {args} {
     269    global distfiles all_dist_files fetch_urls master_sites filespath
     270   
     271    if {[info exists distfiles]} {
    261272    foreach file $distfiles {
    262273        if {![file exists $filespath/$file]} {
     
    271282        }
    272283    }
    273 }
     284    }
     285}
     286
     287# Perform the full checksites/checkpatchfiles/checkdistfiles sequence.
     288# This method is used by distcheck target.
     289proc checkfiles {args} {
     290        checksites
     291        checkpatchfiles
     292        checkdistfiles
     293}
     294
    274295
    275296# Perform a CVS login and fetch, storing the CVS login
     
    313334    }
    314335
    315 # XXX this is a hack to make cvsfetch do the same as "standard fetch"
    316 # should be it's own routine that can be called.
    317336    if {[info exists patchfiles]} {
    318         foreach file $patchfiles {
    319             if {![file exists $filespath/$file]} {
    320                 set distsite [getdisttag $file]
    321                 set file [getdistname $file]
    322                 lappend all_dist_files $file
    323                 if {$distsite != ""} {
    324                     lappend fetch_urls $distsite $file
    325                 } elseif {[info exists patch_sites]} {
    326                     lappend fetch_urls patch_sites $file
    327                 }
    328             }
    329         }
    330337        return [fetchfiles]
    331338    }
     
    362369    }
    363370
    364 # XXX this is a hack to make svnfetch do the same as "standard fetch" (untested)
    365 # should be it's own routine that can be called.
    366371    if {[info exists patchfiles]} {
    367         foreach file $patchfiles {
    368             if {![file exists $filespath/$file]} {
    369                 set distsite [getdisttag $file]
    370                 set file [getdistname $file]
    371                 lappend all_dist_files $file
    372                 if {$distsite != ""} {
    373                     lappend fetch_urls $distsite $file
    374                 } elseif {[info exists patch_sites]} {
    375                     lappend fetch_urls patch_sites $file
    376                 }
    377             }
    378         }
    379372        return [fetchfiles]
    380373    }
     
    415408                                return -code error [format [msgcat::mc "%s must be writable"] $distpath]
    416409                        }
    417 # add master_sites & patch_sites here for when we call it from cvsfetch..
    418                         global portfetch::$url_var master_sites patch_sites
     410                        global portfetch::$url_var
    419411                        if {![info exists $url_var]} {
    420412                                ui_error [format [msgcat::mc "No defined site for tag: %s, using master_sites"] $url_var]
     
    482474}
    483475
    484 # Initialize fetch target, calling checkfiles if neccesary
     476# Initialize fetch target and call checkfiles.
    485477proc fetch_init {args} {
    486478    global distfiles distname distpath all_dist_files dist_subdir fetch.type
     
    489481        set distpath ${distpath}/${dist_subdir}
    490482    }
    491     if {"${fetch.type}" == "standard"} {
    492         checkfiles
    493     }
     483    checkfiles
    494484}
    495485
Note: See TracChangeset for help on using the changeset viewer.