Ticket #8763: regclean.diff

File regclean.diff, 2.4 KB (added by jmroot (Joshua Root), 16 years ago)

add the 'regclean' target

  • src/port/port.tcl

     
    20632063}
    20642064
    20652065
     2066proc action_regclean { action portlist opts } {
     2067    # Clean up the registry. Currently this just means removing duplicate
     2068    # dep_map entries.
     2069    registry::open_dep_map
     2070    registry::clean_dep_map
     2071    registry::write_dep_map
     2072   
     2073    return 0
     2074}
     2075
     2076
    20662077proc action_portcmds { action portlist opts } {
    20672078    # Operations on the port's directory and Portfile
    20682079    global env boot_env
     
    23482359    search      action_search
    23492360    list        action_list
    23502361   
     2362    regclean    action_regclean
     2363   
    23512364    ed          action_portcmds
    23522365    edit        action_portcmds
    23532366    cat         action_portcmds
  • src/registry1.0/receipt_flat.tcl

     
    750750        set dep_map $new_map
    751751}
    752752
     753# remove duplicate entries from the dep_map
     754# (could be put there by older versions of MacPorts)
     755proc clean_dep_map {args} {
     756    variable dep_map
     757    set new_map [list]
     758    set oldlen [llength $dep_map]
     759    ui_debug "Current dep_map has $oldlen entries"
     760    foreach de $dep_map {
     761        if {[lsearch -exact $new_map $de] == -1} {
     762            lappend new_map $de
     763        } else {
     764            ui_debug "Removing $de from dep_map"
     765        }
     766    }
     767    set dep_map $new_map
     768   
     769    set newlen [llength $dep_map]
     770    set diff [expr $oldlen - $newlen]
     771    ui_debug "New dep_map has $newlen entries"
     772    ui_info "Removed $diff duplicate entries from the dependency map"
     773}
     774
    753775proc write_dep_map {args} {
    754776        global macports::registry.path
    755777        variable dep_map
  • src/registry1.0/registry.tcl

     
    370370        return [${macports::registry.format}::unregister_dep $dep $type $port]
    371371}
    372372
     373proc clean_dep_map {args} {
     374    global macports::registry.format
     375    return [${macports::registry.format}::clean_dep_map $args]
     376}
     377
    373378proc write_dep_map {args} {
    374379        global macports::registry.format
    375380        return [${macports::registry.format}::write_dep_map $args]