Ticket #685: portquery-requires.tcl

File portquery-requires.tcl, 1.6 KB (added by jcorley1@…, 21 years ago)

query-requires target

Line 
1# portquery-requires.tcl
2
3package provide portquery-requires 1.0
4
5set com.apple.query-requires [target_new com.apple.query-requires query-requires_main]
6target_runtype ${com.apple.query-requires} always
7target_provides ${com.apple.query-requires} query-requires
8target_requires ${com.apple.query-requires} main
9target_postrun ${com.apple.query-requires} clean
10
11# right now this doesn't handle variants at all
12proc query-requires_main {args} {
13    global portname
14    set nodeps true
15
16    # search for port
17    set res [dportsearch ^$portname$]
18
19    # an array is better than a list for this imho
20    array set portinfo [lindex $res 1]
21
22    # find build dependencies
23    if {![catch {set depends_build $portinfo(depends_build)} result]} {
24        puts "$portname has build dependencies on:"
25        foreach i $depends_build {
26            puts "\t[lindex [split [lindex $i 0] :] 2]"
27        }
28        set nodeps false
29    }
30   
31    # find library dependencies
32    if {![catch {set depends_lib $portinfo(depends_lib)} result]} {
33        puts "$portname has library dependencies on:"
34        foreach i $depends_lib {
35            puts "\t[lindex [split [lindex $i 0] :] 2]"
36        }
37        set nodeps false
38    }
39   
40    # find runtime dependencies
41    if {![catch {set depends_run $portinfo(depends_run)} result]} {
42        puts "$portname has runtime dependencies on:"
43        foreach i $depends_run {
44            puts "\t[lindex [split [lindex $i 0] :] 2]"
45        }
46        set nodeps false
47    }
48
49    # no dependencies found
50    if {"$nodeps" == "true"} {
51        puts "$portname has no dependencies"
52    }
53}
54