[31056] trunk/base/src/port/port.tcl
source_changes at macosforge.org
source_changes at macosforge.org
Wed Nov 14 16:51:16 PST 2007
Revision: 31056
http://trac.macosforge.org/projects/macports/changeset/31056
Author: jberry at macports.org
Date: 2007-11-14 16:51:15 -0800 (Wed, 14 Nov 2007)
Log Message:
-----------
Dramatic speed improvement to file, dir, work, url, etc, actions.
We no longer take a trip through mportsearch for each port, which means
that doing things like "port file all" is now many orders of magnatude
faster since we already have the information we need from our initial
evaluation of the pseudo-port selector.
Modified Paths:
--------------
trunk/base/src/port/port.tcl
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2007-11-15 00:39:13 UTC (rev 31055)
+++ trunk/base/src/port/port.tcl 2007-11-15 00:51:15 UTC (rev 31056)
@@ -1866,27 +1866,29 @@
set status 0
require_portlist portlist
foreachport $portlist {
- # Verify the portname, getting portinfo to map to a porturl
- if {[catch {set res [mportsearch $portname no exact]} result]} {
- global errorInfo
- ui_debug "$errorInfo"
- break_softcontinue "search for portname $portname failed: $result" 1 status
- }
- if {[llength $res] < 2} {
- break_softcontinue "Port $portname not found" 1 status
- }
- array set portinfo [lindex $res 1]
-
- # If we have a url, use that, since it's most specific
- # otherwise try to map the portname to a url
+ # If we have a url, use that, since it's most specific, otherwise try to map the portname to a url
if {$porturl == ""} {
+
+ # Verify the portname, getting portinfo to map to a porturl
+ if {[catch {set res [mportsearch $portname no exact]} result]} {
+ global errorInfo
+ ui_debug "$errorInfo"
+ break_softcontinue "search for portname $portname failed: $result" 1 status
+ }
+ if {[llength $res] < 2} {
+ break_softcontinue "Port $portname not found" 1 status
+ }
+ array set portinfo [lindex $res 1]
set porturl $portinfo(porturl)
}
+
+ # Calculate portdir, porturl, and portfile from initial porturl
set portdir [file normalize [macports::getportdir $porturl]]
set porturl "file://${portdir}"; # Rebuild url so it's fully qualified
set portfile "${portdir}/Portfile"
+ # Now execute the specific action
if {[file readable $portfile]} {
switch -- $action {
cat {
@@ -1961,6 +1963,14 @@
}
gohome {
+ # Get the homepage for the port by opening the portfile
+ if {![catch {set ctx [mportopen $porturl]} result]} {
+ array set portinfo [mportinfo $ctx]
+ set homepage $portinfo(homepage)
+ mportclose $ctx
+ }
+
+ # Try to open a browser to the homepage for the given port
set homepage $portinfo(homepage)
if { $homepage != "" } {
system "${macports::autoconf::open_path} $homepage"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20071114/f13e2cae/attachment.html
More information about the macports-changes
mailing list