Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Changeset 32441

Show
Ignore:
Timestamp:
01/01/08 09:09:21 (11 months ago)
Author:
jberry@…
Message:

If checksum is mismatched, and in verbose mode, present a corrected pre-fabricated
checksum statement to make it easy to update a port.

Files:
1 modified

Legend:

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

    r26177 r32441  
    185185# 
    186186proc checksum_main {args} { 
    187         global UI_PREFIX all_dist_files checksums_array portverbose checksum.skip 
     187        global UI_PREFIX all_dist_files checksum_types checksums_array portverbose checksum.skip 
    188188 
    189189        # If no files have been downloaded, there is nothing to checksum. 
     
    219219                        if {![info exists checksums_array($distfile)]} { 
    220220                                ui_error "[format [msgcat::mc "No checksum set for %s"] $distfile]" 
    221                                 ui_info "[format [msgcat::mc "Distfile checksum: %s md5 %s"] $distfile [calc_md5 $fullpath]]" 
    222                                 ui_info "[format [msgcat::mc "Distfile checksum: %s sha1 %s"] $distfile [calc_sha1 $fullpath]]" 
    223                                 ui_info "[format [msgcat::mc "Distfile checksum: %s rmd160 %s"] $distfile [calc_rmd160 $fullpath]]" 
     221                                foreach type $checksum_types { 
     222                                        ui_info "[format [msgcat::mc "Distfile checksum: %s $type %s"] $distfile [calc_$type $fullpath]]" 
     223                                } 
    224224                                set fail yes 
    225225                        } else { 
     
    242242                                } 
    243243                        } 
     244                         
    244245                } 
    245246        } else { 
     
    249250 
    250251        if {[tbool fail]} { 
     252         
     253                # Show the desired checksum line for easy cut-paste 
     254                set sums "" 
     255                foreach distfile $all_dist_files { 
     256                        if {[llength $all_dist_files] > 1} { 
     257                                lappend sums $distfile 
     258                        } 
     259                         
     260                        set fullpath [file join $distpath $distfile] 
     261                        foreach type $checksum_types { 
     262                                lappend sums [format "%-8s%s" $type [calc_$type $fullpath]] 
     263                        } 
     264                } 
     265                ui_info "The correct checksum line may be:" 
     266                ui_info [format "%-20s%s" "checksums" [join $sums [format " \\\n%-20s" ""]]] 
     267                 
    251268                return -code error "[msgcat::mc "Unable to verify file checksums"]" 
    252269        }