1 | Index: port.tcl |
---|
2 | =================================================================== |
---|
3 | RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port/port.tcl,v |
---|
4 | retrieving revision 1.102 |
---|
5 | diff -r1.102 port.tcl |
---|
6 | 122c122 |
---|
7 | < set usage { [-vdqfonasbckt] [-D portdir] [-u porturl] action [actionflags] |
---|
8 | --- |
---|
9 | > set usage { [-vdqfonasbcktAR] [-D portdir] [-u porturl] action [actionflags] |
---|
10 | 128c128 |
---|
11 | < contents, deps, variants, search, list, echo, sync, |
---|
12 | --- |
---|
13 | > contents, deps, dependents, variants, search, list, echo, sync, |
---|
14 | 523a524,623 |
---|
15 | > # look up all the packages each portname in the portlist depends on |
---|
16 | > proc get_dependencies { portlist {case_sensitive no} } { |
---|
17 | > set depstypes {depends_build depends_lib depends_run} |
---|
18 | > set depstypes_descr {"build" "library" "runtime"} |
---|
19 | > |
---|
20 | > set lookup [list] |
---|
21 | > |
---|
22 | > foreachport $portlist { |
---|
23 | > # Get info about the port |
---|
24 | > # make sure that it's a valid port name. If not, error out |
---|
25 | > |
---|
26 | > if {[catch {dportsearch $portname $case_sensitive exact} result]} { |
---|
27 | > global errorInfo |
---|
28 | > ui_debug "$errorInfo" |
---|
29 | > fatal "search for portname $portname failed: $result" |
---|
30 | > } |
---|
31 | > |
---|
32 | > if {$result == ""} { |
---|
33 | > fatal "No port $portname found." |
---|
34 | > } |
---|
35 | > |
---|
36 | > array set portinfo [lindex $result 1] |
---|
37 | > set depends [list] |
---|
38 | > |
---|
39 | > # look up the dependencies |
---|
40 | > foreach depstype $depstypes depsdecr $depstypes_descr { |
---|
41 | > set deps [list] |
---|
42 | > if {[info exists portinfo($depstype)] && $portinfo($depstype) != ""} { |
---|
43 | > foreach i $portinfo($depstype) { |
---|
44 | > lappend deps [lindex [split [lindex $i 0] :] end] |
---|
45 | > } |
---|
46 | > } |
---|
47 | > |
---|
48 | > if {[llength $deps] != 0} { |
---|
49 | > lappend depends $depsdecr |
---|
50 | > lappend depends [lsort -unique $deps] |
---|
51 | > } |
---|
52 | > } |
---|
53 | > |
---|
54 | > lappend lookup $portname |
---|
55 | > lappend lookup $depends |
---|
56 | > } |
---|
57 | > |
---|
58 | > return $lookup |
---|
59 | > } |
---|
60 | > |
---|
61 | > |
---|
62 | > # look up the dependent packages for each portname in the portlist |
---|
63 | > proc get_all_dependents {} { |
---|
64 | > set all_dependencies [get_dependencies [get_installed_ports] no] |
---|
65 | > |
---|
66 | > array set dependents [list] |
---|
67 | > |
---|
68 | > # find the dependent packages |
---|
69 | > foreach {portname depsdecr_dependencies} $all_dependencies { |
---|
70 | > foreach {depsdecr dependencies} $depsdecr_dependencies { |
---|
71 | > foreach dep $dependencies { |
---|
72 | > if {[info exists dependents($dep)]} { |
---|
73 | > set dependents($dep) [concat $portname $dependents($dep)] |
---|
74 | > } else { |
---|
75 | > set dependents($dep) [list $portname] |
---|
76 | > } |
---|
77 | > } |
---|
78 | > } |
---|
79 | > } |
---|
80 | > |
---|
81 | > return [array get dependents] |
---|
82 | > } |
---|
83 | > |
---|
84 | > |
---|
85 | > proc get_dependents {portlist {find_all no}} { |
---|
86 | > # if no ports are specified just return null |
---|
87 | > if {[llength portlist] == 0} { |
---|
88 | > return |
---|
89 | > } |
---|
90 | > |
---|
91 | > array set all_dependents [get_all_dependents] |
---|
92 | > |
---|
93 | > set result [list] |
---|
94 | > |
---|
95 | > foreachport $portlist { |
---|
96 | > set dependents $all_dependents($portname) |
---|
97 | > |
---|
98 | > # grab all the dependent packages our dependent package depends on |
---|
99 | > if {$find_all == "yes"} { |
---|
100 | > foreach dep $dependents { |
---|
101 | > if {[info exists all_dependents($dep)]} { |
---|
102 | > foreach d $all_dependents($dep) { |
---|
103 | > lappend dependents $d |
---|
104 | > } |
---|
105 | > } |
---|
106 | > } |
---|
107 | > } |
---|
108 | > |
---|
109 | > # make sure that there are no repeating dependents |
---|
110 | > lappend result $portname [lsort -unique $dependents] |
---|
111 | > } |
---|
112 | > |
---|
113 | > return $result |
---|
114 | > } |
---|
115 | 997,1006c1097,1108 |
---|
116 | < f { set global_options(ports_force) yes } |
---|
117 | < o { set global_options(ports_ignore_older) yes } |
---|
118 | < n { set global_options(ports_nodeps) yes } |
---|
119 | < a { set global_options(port_upgrade_all) yes } |
---|
120 | < u { set global_options(port_uninstall_old) yes } |
---|
121 | < s { set global_options(ports_source_only) yes } |
---|
122 | < b { set global_options(ports_binary_only) yes } |
---|
123 | < c { set global_options(ports_autoclean) yes } |
---|
124 | < k { set global_options(ports_autoclean) no } |
---|
125 | < t { set global_options(ports_trace) yes } |
---|
126 | --- |
---|
127 | > f { set global_options(ports_force) yes } |
---|
128 | > o { set global_options(ports_ignore_older) yes } |
---|
129 | > n { set global_options(ports_nodeps) yes } |
---|
130 | > a { set global_options(port_upgrade_all) yes } |
---|
131 | > R { set global_options(port_upgrade_rebuild_dependents) yes } |
---|
132 | > A { set global_options(port_dependents_show_all) yes } |
---|
133 | > u { set global_options(port_uninstall_old) yes } |
---|
134 | > s { set global_options(ports_source_only) yes } |
---|
135 | > b { set global_options(ports_binary_only) yes } |
---|
136 | > c { set global_options(ports_autoclean) yes } |
---|
137 | > k { set global_options(ports_autoclean) no } |
---|
138 | > t { set global_options(ports_trace) yes } |
---|
139 | 1242c1344,1349 |
---|
140 | < |
---|
141 | --- |
---|
142 | > |
---|
143 | > if {[info exists global_options(port_upgrade_rebuild_dependents)] } { |
---|
144 | > # grab all the dependents and their dependents recursively |
---|
145 | > array set all_dependents [get_dependents $portlist yes] |
---|
146 | > } |
---|
147 | > |
---|
148 | 1251a1359,1365 |
---|
149 | > |
---|
150 | > if {[info exists global_options(port_upgrade_rebuild_dependents)] } { |
---|
151 | > set dependents $all_dependents($portname) |
---|
152 | > foreach i [lsort $dependents] { |
---|
153 | > darwinports::upgrade $portname "port:$i" |
---|
154 | > } |
---|
155 | > } |
---|
156 | 1460c1574 |
---|
157 | < |
---|
158 | --- |
---|
159 | > |
---|
160 | 1462a1577,1582 |
---|
161 | > |
---|
162 | > # grab all the dependencies |
---|
163 | > array set all_dependencies [get_dependencies $portlist yes] |
---|
164 | > |
---|
165 | > # now print them out. note that we want to print in the order |
---|
166 | > # specified on the command line |
---|
167 | 1464,1483c1584,1589 |
---|
168 | < # Get info about the port |
---|
169 | < if {[catch {dportsearch $portname no exact} result]} { |
---|
170 | < global errorInfo |
---|
171 | < ui_debug "$errorInfo" |
---|
172 | < fatal "search for portname $portname failed: $result" |
---|
173 | < } |
---|
174 | < |
---|
175 | < if {$result == ""} { |
---|
176 | < fatal "No port $portname found." |
---|
177 | < } |
---|
178 | < |
---|
179 | < array set portinfo [lindex $result 1] |
---|
180 | < |
---|
181 | < set depstypes {depends_build depends_lib depends_run} |
---|
182 | < set depstypes_descr {"build" "library" "runtime"} |
---|
183 | < |
---|
184 | < set nodeps true |
---|
185 | < foreach depstype $depstypes depsdecr $depstypes_descr { |
---|
186 | < if {[info exists portinfo($depstype)] && |
---|
187 | < $portinfo($depstype) != ""} { |
---|
188 | --- |
---|
189 | > array set dependencies $all_dependencies($portname) |
---|
190 | > |
---|
191 | > if {[array size dependencies] == 0} { |
---|
192 | > puts "$portname has no dependencies" |
---|
193 | > } else { |
---|
194 | > foreach depsdecr [lsort [array names dependencies]] { |
---|
195 | 1485,1486c1591,1592 |
---|
196 | < foreach i $portinfo($depstype) { |
---|
197 | < puts "\t[lindex [split [lindex $i 0] :] end]" |
---|
198 | --- |
---|
199 | > foreach i $dependencies($depsdecr) { |
---|
200 | > puts "\t$i" |
---|
201 | 1488d1593 |
---|
202 | < set nodeps false |
---|
203 | 1490a1596,1614 |
---|
204 | > } |
---|
205 | > } |
---|
206 | > |
---|
207 | > dependents { |
---|
208 | > global global_options |
---|
209 | > |
---|
210 | > require_portlist |
---|
211 | > |
---|
212 | > # grab all the dependents |
---|
213 | > if {[info exists global_options(port_dependents_show_all)] } { |
---|
214 | > array set all_dependents [get_dependents $portlist yes] |
---|
215 | > } else { |
---|
216 | > array set all_dependents [get_dependents $portlist] |
---|
217 | > } |
---|
218 | > |
---|
219 | > # now print them out. note that we want to print in the order |
---|
220 | > # specified on the command line |
---|
221 | > foreachport $portlist { |
---|
222 | > set dependents $all_dependents($portname) |
---|
223 | 1492,1494c1616,1622 |
---|
224 | < # no dependencies found |
---|
225 | < if {$nodeps == "true"} { |
---|
226 | < puts "$portname has no dependencies" |
---|
227 | --- |
---|
228 | > if {[llength $dependents] == 0} { |
---|
229 | > puts "no packages depend on $portname" |
---|
230 | > } else { |
---|
231 | > puts "the following packages depend on $portname:" |
---|
232 | > foreach i [lsort $dependents] { |
---|
233 | > puts "\t$i" |
---|
234 | > } |
---|
235 | 1498c1626 |
---|
236 | < |
---|
237 | --- |
---|
238 | > |
---|