[55639] contrib/port_cutleaves/port_cutleaves
jmr at macports.org
jmr at macports.org
Sat Aug 15 01:35:16 PDT 2009
Revision: 55639
http://trac.macports.org/changeset/55639
Author: jmr at macports.org
Date: 2009-08-15 01:35:14 -0700 (Sat, 15 Aug 2009)
Log Message:
-----------
port_cutleaves: add option to keep build deps (info taken from PortIndex)
Modified Paths:
--------------
contrib/port_cutleaves/port_cutleaves
Modified: contrib/port_cutleaves/port_cutleaves
===================================================================
--- contrib/port_cutleaves/port_cutleaves 2009-08-15 06:53:25 UTC (rev 55638)
+++ contrib/port_cutleaves/port_cutleaves 2009-08-15 08:35:14 UTC (rev 55639)
@@ -150,8 +150,34 @@
return [lindex $port 4]
}
+proc collect_build_deps {installedvar} {
+ upvar $installedvar installed
+ global build_deps
+ array unset build_deps
+ foreach i $installed {
+ set iname [name $i]
+ if {[catch {set res [mportlookup $iname]} result]} {
+ puts stderr "lookup of portname $iname failed: $result"
+ exit 1
+ }
+ if {[llength $res] < 2} {
+ continue
+ } else {
+ array unset portinfo
+ array set portinfo [lindex $res 1]
+ }
+ foreach type {depends_fetch depends_extract depends_build} {
+ if {[info exists portinfo($type)]} {
+ foreach d $portinfo($type) {
+ set build_deps([lindex [split $d :] end]) 1
+ }
+ }
+ }
+ }
+}
+
proc leaves {} {
- global option
+ global option build_deps
registry::open_dep_map
if {[catch {set installed [registry::installed]} result]} {
@@ -162,11 +188,15 @@
}
set exclusions {}
}
+ if {$option(b)} {
+ collect_build_deps installed
+ }
set leaves {}
foreach port $installed {
if {[llength [registry::list_dependents [name $port]]] < 1
- && ![should_be_excluded $port $exclusions]} {
+ && ![should_be_excluded $port $exclusions]
+ && (!$option(b) || ![info exists build_deps([name $port])])} {
lappend leaves $port
}
}
@@ -232,6 +262,7 @@
package require cmdline
set options {
+ { b "Don't count ports as leaves when they are only needed at build time" }
{ F.arg ~/.port_leaves.exclude \
"Specify a different file to read exclusions from" }
{ l "List leaves and exit"}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090815/7c3be119/attachment.html>
More information about the macports-changes
mailing list