Projects
New Ticket     Wiki     Browse Source     Timeline     Roadmap     Bug Reports     Search

Ticket #11891: deps.patch

File deps.patch, 6.8 KB (added by gwhitney@…, 18 months ago)

Proposed patch against r25303 to resolve this issue

  • src/port/port.tcl

     
    11311131        return 0 
    11321132} 
    11331133 
    1134  
    1135 proc action_info { action portlist opts } { 
    1136     set status 0 
    1137     require_portlist portlist 
    1138     foreachport $portlist { 
     1134# Helper for info and deps actions, which should both get the "true" port  
     1135# info found by opening the port and thereby evaluating the variants 
     1136proc obtain_port_info { porturl portname onlyindex varname} { 
     1137        upvar $varname variations 
     1138        global global_variations 
    11391139        # If we have a url, use that, since it's most specific 
    11401140        # otherwise try to map the portname to a url 
    11411141        if {$porturl eq ""} { 
    11421142            # Verify the portname, getting portinfo to map to a porturl 
    11431143            if {[catch {dportsearch $portname no exact} result]} { 
    11441144                ui_debug "$::errorInfo" 
    1145                 break_softcontinue "search for portname $portname failed: $result" 1 status 
     1145                set portinfo(SignalError) "search for portname $portname failed: $result" 
     1146                return [array get portinfo] 
    11461147            } 
    11471148            if {[llength $result] < 2} { 
    1148                 break_softcontinue "Port $portname not found" 1 status 
     1149                set portinfo(SignalError) "Port $portname not found" 
     1150                return [array get portinfo]  
    11491151            } 
    11501152            set found [expr [llength $result] / 2] 
    11511153            if {$found > 1} { 
     
    11561158            set porturl $portinfo(porturl) 
    11571159            set portdir $portinfo(portdir) 
    11581160        } 
    1159          
    1160         if {!([info exists options(ports_info_index)] && $options(ports_info_index) eq "yes")} { 
     1161 
     1162        # Add any global_variations to the variations  
     1163        # specified for the port 
     1164        foreach { variation value } [array get global_variations] { 
     1165                if { ![info exists variations($variation)] } { 
     1166                        set variations($variation) $value 
     1167                } 
     1168        } 
     1169 
     1170        if {$onlyindex != "yes"} { 
    11611171            if {[catch {set dport [dportopen $porturl [array get options] [array get variations]]} result]} { 
    11621172                ui_debug "$::errorInfo" 
    1163                 break_softcontinue "Unable to open port: $result" 1 status 
     1173                set portinfo(SignalError) "Unable to open port: $result" 
     1174                return [array get portinfo] 
    11641175            } 
    11651176            array unset portinfo 
    11661177            array set portinfo [dportinfo $dport] 
     
    11721183            ui_warn "port info --index does not work with 'current' pseudo-port" 
    11731184            continue 
    11741185        } 
    1175          
     1186        return [array get portinfo] 
     1187} 
     1188 
     1189proc action_info { action portlist opts } { 
     1190    set status 0 
     1191    require_portlist portlist 
     1192    foreachport $portlist { 
     1193        if {![info exists options(ports_info_index)]} { 
     1194            set options(ports_info_index) "no" 
     1195        } 
     1196        array unset portinfo 
     1197        array set portinfo [obtain_port_info $porturl $portname $options(ports_info_index) variations] 
     1198        if {[info exists portinfo(SignalError)]} { 
     1199            break_softcontinue $portinfo(SignalError) 1 status 
     1200         } 
    11761201        # Map from friendly to less-friendly but real names 
    11771202        array set name_map " 
    11781203                category        categories 
     
    12581283         
    12591284            # If we weren't asked to show any specific fields, then show general information 
    12601285            puts -nonewline "$portinfo(name) $portinfo(version)" 
     1286            if {[info exists portinfo(portvariants)]} { 
     1287                puts -nonewline "$portinfo(portvariants)" 
     1288            } 
    12611289            if {[info exists portinfo(revision)] && $portinfo(revision) > 0} {  
    12621290                puts -nonewline ", Revision $portinfo(revision)"  
    12631291            } 
     
    16981726 
    16991727 
    17001728proc action_deps { action portlist opts } { 
     1729        global variations global_variations 
    17011730        set status 0 
    17021731        require_portlist portlist 
    17031732        foreachport $portlist { 
    1704                 # Get info about the port 
    1705                 if {[catch {dportsearch $portname no exact} result]} { 
    1706                         global errorInfo 
    1707                         ui_debug "$errorInfo" 
    1708                         break_softcontinue "search for portname $portname failed: $result" 1 status 
     1733                if {![info exists options(ports_deps_index)]} { 
     1734                    set options(ports_deps_index) "no" 
    17091735                } 
    1710  
    1711                 if {$result == ""} { 
    1712                         break_softcontinue "No port $portname found." 1 status 
    1713                 } 
    1714  
    17151736                array unset portinfo 
    1716                 array set portinfo [lindex $result 1] 
    1717  
     1737                array set portinfo [obtain_port_info $porturl $portname $options(ports_deps_index) variations] 
     1738                if {[info exists portinfo(SignalError)]} { 
     1739                        break_softcontinue $portinfo(SignalError) 1 status 
     1740                } 
    17181741                set depstypes {depends_build depends_lib depends_run} 
    17191742                set depstypes_descr {"build" "library" "runtime"} 
    17201743 
     1744                if {[info exists portinfo(portvariants)]} { 
     1745                        set fullportname "$portname $portinfo(portvariants)" 
     1746                } else { 
     1747                        set fullportname $portname 
     1748                } 
    17211749                set nodeps true 
    17221750                foreach depstype $depstypes depsdecr $depstypes_descr { 
    17231751                        if {[info exists portinfo($depstype)] && 
    17241752                                $portinfo($depstype) != ""} { 
    1725                                 puts "$portname has $depsdecr dependencies on:" 
     1753                                puts "$fullportname has $depsdecr dependencies on:" 
    17261754                                foreach i $portinfo($depstype) { 
    17271755                                        puts "\t[lindex [split [lindex $i 0] :] end]" 
    17281756                                } 
     
    17321760                 
    17331761                # no dependencies found 
    17341762                if {$nodeps == "true"} { 
    1735                         puts "$portname has no dependencies" 
     1763                        puts "$fullportname has no dependencies" 
    17361764                } 
    17371765        } 
    17381766         
  • src/darwinports1.0/darwinports.tcl

     
    13541354 
    13551355proc dportinfo {dport} { 
    13561356        set workername [ditem_key $dport workername] 
    1357     return [$workername eval array get PortInfo] 
     1357        array set pinfo [$workername eval array get PortInfo]  
     1358        if {[$workername eval info exists portvariants]} { 
     1359                set pinfo(portvariants) [$workername eval return \$portvariants] 
     1360        } 
     1361        return [array get pinfo] 
    13581362} 
    13591363 
    13601364proc dportclose {dport} { 
  • src/port1.0/portutil.tcl

     
    13731373} 
    13741374 
    13751375proc variant_run {ditem} { 
     1376    global PortInfo 
    13761377    set name [ditem_key $ditem name] 
    13771378    ui_debug "Executing variant $name provides [ditem_key $ditem provides]" 
    13781379     
     
    13911392        ui_error "Error executing $name: $result" 
    13921393        return 1 
    13931394    } 
     1395    # Update the long description to show that the variant is active 
     1396    if {[string first [option os.platform] $name] != 0 
     1397           && $name != [option os.arch] 
     1398           && [info exists PortInfo(long_description)]} { 
     1399        set terminator "." 
     1400        if {[info exists PortInfo(variant_desc)]} { 
     1401            array set descs $PortInfo(variant_desc) 
     1402            if {[info exists descs($name)]} { 
     1403                set terminator ": $descs($name)\n" 
     1404            } 
     1405        } 
     1406        set PortInfo(long_description) [concat $PortInfo(long_description) "\n(+$name active$terminator)\n"] 
     1407    } 
    13941408    return 0 
    13951409} 
    13961410