Skip to content

Commit

Permalink
get_{dep_,sub}ports: don't error if -p was used
Browse files Browse the repository at this point in the history
  • Loading branch information
jmroot committed Oct 21, 2023
1 parent 1b4e6a1 commit 150c99d
Showing 1 changed file with 50 additions and 22 deletions.
72 changes: 50 additions & 22 deletions src/port/port.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -986,28 +986,42 @@ proc get_dep_ports {portname recursive} {

# look up portname
if {[catch {mportlookup $portname} result]} {
ui_debug "$::errorInfo"
return -code error "lookup of portname $portname failed: $result"
}
if {[llength $result] < 2} {
return -code error "Port $portname not found"
ui_debug $::errorInfo
if {[macports::ui_isset ports_processall]} {
ui_error "lookup of portname $portname failed"
return [list]
} else {
return -code error "lookup of portname $portname failed: $result"
}
} elseif {[llength $result] < 2} {
if {[macports::ui_isset ports_processall]} {
ui_error "Port $portname not found"
return [list]
} else {
return -code error "Port $portname not found"
}
}
array unset portinfo
array set portinfo [lindex $result 1]
set porturl $portinfo(porturl)

# open portfile
if {[catch {set mport [mportopen $porturl [list subport $portinfo(name)] [array get global_variations]]} result]} {
ui_debug "$::errorInfo"
return -code error "Unable to open port: $result"
ui_debug $::errorInfo
if {[macports::ui_isset ports_processall]} {
ui_error "Unable to open port $portinfo(name): $result"
return [list]
} else {
return -code error "Unable to open port $portinfo(name): $result"
}
}
array unset portinfo
array set portinfo [mportinfo $mport]
mportclose $mport

# gather its deps
set results {}
set deptypes {depends_fetch depends_extract depends_patch depends_build depends_lib depends_run depends_test}
set results [list]
set deptypes [list depends_fetch depends_extract depends_patch depends_build depends_lib depends_run depends_test]

set deplist {}
foreach type $deptypes {
Expand All @@ -1031,10 +1045,10 @@ proc get_dep_ports {portname recursive} {

# look up the dep
if {[catch {mportlookup $depname} result]} {
ui_debug "$::errorInfo"
return -code error "lookup of portname $depname failed: $result"
}
if {[llength $result] < 2} {
ui_debug $::errorInfo
ui_error "lookup of portname $depname failed: $result"
continue
} elseif {[llength $result] < 2} {
ui_error "Port $depname not found"
continue
}
Expand All @@ -1044,8 +1058,8 @@ proc get_dep_ports {portname recursive} {

# open its portfile
if {[catch {set mport [mportopen $porturl [list subport $portinfo(name)] [array get global_variations]]} result]} {
ui_debug "$::errorInfo"
ui_error "Unable to open port: $result"
ui_debug $::errorInfo
ui_error "Unable to open port $depname: $result"
continue
}
array unset portinfo
Expand Down Expand Up @@ -1087,20 +1101,34 @@ proc get_subports {portname} {

# look up portname
if {[catch {mportlookup $portname} result]} {
ui_debug "$::errorInfo"
return -code error "lookup of portname $portname failed: $result"
}
if {[llength $result] < 2} {
return -code error "Port $portname not found"
ui_debug $::errorInfo
if {[macports::ui_isset ports_processall]} {
ui_error "lookup of portname $portname failed"
return [list]
} else {
return -code error "lookup of portname $portname failed: $result"
}
} elseif {[llength $result] < 2} {
if {[macports::ui_isset ports_processall]} {
ui_error "Port $portname not found"
return [list]
} else {
return -code error "Port $portname not found"
}
}
array unset portinfo
array set portinfo [lindex $result 1]
set porturl $portinfo(porturl)

# open portfile
if {[catch {set mport [mportopen $porturl [list subport $portinfo(name)] [array get global_variations]]} result]} {
ui_debug "$::errorInfo"
return -code error "Unable to open port: $result"
ui_debug $::errorInfo
if {[macports::ui_isset ports_processall]} {
ui_error "Unable to open port $portinfo(name): $result"
return [list]
} else {
return -code error "Unable to open port $portinfo(name): $result"
}
}
array unset portinfo
array set portinfo [mportinfo $mport]
Expand Down

0 comments on commit 150c99d

Please sign in to comment.