Changeset 1226 for trunk/base


Ignore:
Timestamp:
Nov 11, 2002, 9:11:24 AM (21 years ago)
Author:
kevin
Message:

Deprecate dportmatch in favor of dportsearch.

Location:
trunk/base/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/darwinports1.0/darwinports.tcl

    r1169 r1226  
    311311                array set portinfo $line
    312312                if [info exists portinfo(portarchive)] {
    313                     set portinfo(porturl) ${source}/$portinfo(portarchive)
     313                    lappend line porturl ${source}/$portinfo(portarchive)
    314314                } elseif [info exists portinfo(portdir)] {
    315                     set portinfo(porturl) ${source}/$portinfo(portdir)
     315                    lappend line porturl ${source}/$portinfo(portdir)
    316316                }
    317317                lappend matches $name
     
    332332
    333333proc dportmatch {regexp} {
    334     global darwinports::portdbpath darwinports::sources
    335     foreach source $sources {
    336         if {[catch {set fd [open [darwinports::getindex $source] r]} result]} {
    337             return -code error "Can't open index file for source $source. Have you synced your source indexes?"
    338         }
    339         while {[gets $fd line] >= 0} {
    340             set name [lindex $line 0]
    341             if {[regexp -- $regexp $name] == 1} {
    342                 gets $fd line
    343                 array set portinfo $line
    344                 if [info exists portinfo(portarchive)] {
    345                     set portinfo(porturl) ${source}/$portinfo(portarchive)
    346                 } elseif [info exists portinfo(portdir)] {
    347                     set portinfo(porturl) ${source}/$portinfo(portdir)
    348                 }
    349                 close $fd
    350                 return [array get portinfo]
    351             } else {
    352                 set len [lindex $line 1]
    353                 seek $fd $len current
    354             }
    355         }
    356         close $fd
    357     }
     334        return -code error "dportmatch has been deprecated, use dportsearch instead."
    358335}
    359336
  • trunk/base/src/port/port.tcl

    r1066 r1226  
    153153        set target $action
    154154        if {[info exists portname]} {
    155             if {[catch {array set portinfo [dportmatch ^$portname\$]} result]} {
     155            if {[catch {set res [dportsearch ^$portname\$]} result]} {
    156156                puts $result
    157157                exit 1
    158158            }
    159             if {[array size portinfo] == 0} {
     159            if {[llength $res] < 2} {
    160160                puts "Port $portname not found"
    161161                exit 1
    162162            }
     163            array set portinfo [lindex $res 1]
    163164            set porturl $portinfo(porturl)
    164165        }
  • trunk/base/src/port1.0/portutil.tcl

    r1176 r1226  
    10771077    array set options [list]
    10781078    array set variations [list]
    1079     array set portinfo [dportmatch ^$portname\$]
    1080     if {[array size portinfo] == 0} {
     1079    set res [dportsearch ^$portname\$]
     1080    if {[llength $res] < 2} {
    10811081        ui_error "Dependency $portname not found"
    10821082        return -1
    10831083    }
     1084        array set portinfo [lindex $res 1]
    10841085    set porturl $portinfo(porturl)
    10851086   
Note: See TracChangeset for help on using the changeset viewer.