New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 79365


Ignore:
Timestamp:
06/11/11 05:54:24 (4 years ago)
Author:
jmr@…
Message:

add --size option for contents action (#27245)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port/port.tcl

    r79349 r79365  
    199199} 
    200200 
     201proc filesize {fil {unit {}}} { 
     202    set siz {@} 
     203    catch { 
     204        set siz [bytesize [file size $fil] $unit] 
     205    } 
     206    return $siz 
     207} 
    201208 
    202209# Produce an error message, and exit, unless 
     
    31033110 
    31043111proc action_contents { action portlist opts } { 
    3105     set status 0 
     3112    global global_options 
    31063113    if {[require_portlist portlist]} { 
    31073114        return 1 
    31083115    } 
     3116    if {[info exists global_options(ports_contents_size)]} { 
     3117        set units {} 
     3118        if {[info exists global_options(ports_contents_units)]} { 
     3119            set units [complete_size_units $global_options(ports_contents_units)] 
     3120        } 
     3121        set outstring {[format "%12s $file" [filesize $file $units]]} 
     3122    } else { 
     3123        set outstring {  $file} 
     3124    } 
     3125 
    31093126    foreachport $portlist { 
    31103127        if { ![catch {set ilist [registry::installed $portname]} result] } { 
     
    31173134                ui_notice "Port $portname contains:" 
    31183135                foreach file $files { 
    3119                     puts "  $file" 
     3136                    puts [subst $outstring] 
    31203137                } 
    31213138            } else { 
     
    31283145    registry::close_file_map 
    31293146 
    3130     return $status 
     3147    return 0 
    31313148} 
    31323149 
     
    40144031                 maintainer maintainers name platform platforms portdir pretty 
    40154032                 replaced_by revision variant variants version} 
     4033    contents    {size {units 1}} 
    40164034    deps        {index no-build} 
    40174035    rdeps       {index no-build full} 
Note: See TracChangeset for help on using the changeset viewer.