Ignore:
Timestamp:
Dec 7, 2002, 3:17:30 AM (16 years ago)
Author:
kevin
Message:

Added portexec primitive to run an arbitrary target of a port.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port1.0/portutil.tcl

    r1226 r1333  
    10701070}
    10711071
    1072 # build the specified portfile
    1073 proc portfile_run {this} {
    1074     set portname [$this get name]
    1075    
    1076     ui_debug "Building $portname"
     1072# jkh uses this API so i guess it's public =)
     1073# builds the specified port (looked up in the index) to the specified target
     1074# doesn't yet support options or variants...
     1075proc portexec {portname target} {
     1076    ui_debug "Executing $target ($portname)"
    10771077    array set options [list]
    10781078    array set variations [list]
    10791079    set res [dportsearch ^$portname\$]
    10801080    if {[llength $res] < 2} {
    1081         ui_error "Dependency $portname not found"
     1081        ui_error "Portfile $portname not found"
    10821082        return -1
    10831083    }
     
    10871087    set worker [dportopen $porturl options variations]
    10881088    if {[catch {dportexec $worker clean} result] || $result != 0} {
    1089         ui_error "Clean of $portname before build failed: $result"
     1089        ui_error "Clean of $portname failed: $result"
    10901090        dportclose $worker
    10911091        return -1
    10921092    }
    1093     if {[catch {dportexec $worker install} result] || $result != 0} {
    1094         ui_error "Build of $portname failed: $result"
    1095         dportclose $worker
    1096         return -1
    1097     }
    1098     if {[catch {dportexec $worker clean} result] || $result != 0} {
    1099         ui_error "Clean of $portname after build failed: $result"
    1100     }
     1093        if {$target != "clean"} {
     1094                if {[catch {dportexec $worker $target} result] || $result != 0} {
     1095                ui_error "Execution $portname $target failed: $result"
     1096                dportclose $worker
     1097                return -1
     1098                }
     1099        }
    11011100    dportclose $worker
    11021101   
    11031102    return 0
     1103}
     1104
     1105# build the specified portfile
     1106proc portfile_run {this} {
     1107    set portname [$this get name]
     1108        if {[portexec $portname install] == 0} {
     1109                portexec $portname clean
     1110    }
    11041111}
    11051112
Note: See TracChangeset for help on using the changeset viewer.