[44664] users/perry/base-select/src/macports1.0/macports.tcl
perry at macports.org
perry at macports.org
Thu Jan 1 17:07:12 PST 2009
Revision: 44664
http://trac.macports.org/changeset/44664
Author: perry at macports.org
Date: 2009-01-01 17:07:08 -0800 (Thu, 01 Jan 2009)
Log Message:
-----------
macports1.0/macports.tcl - Updated --show to use the 'current' symlink.
Modified Paths:
--------------
users/perry/base-select/src/macports1.0/macports.tcl
Modified: users/perry/base-select/src/macports1.0/macports.tcl
===================================================================
--- users/perry/base-select/src/macports1.0/macports.tcl 2009-01-01 23:51:51 UTC (rev 44663)
+++ users/perry/base-select/src/macports1.0/macports.tcl 2009-01-02 01:07:08 UTC (rev 44664)
@@ -2412,69 +2412,24 @@
}
set i [expr $i+1]
}
+
+ # Update the selected version.
+ set selected_version "$confpath/current"
+ if {[file exists $selected_version]} {
+ file delete $selected_version
+ }
+ symlink $version $selected_version
+
return "Success"
}
show {
- if {[set versions [mportselect list $group]] eq ""} {
- return ""
- }
+ set selected_version "$confpath/current"
- foreach version $versions {
- # Use $confpath/$version to read in sources.
- if {[catch {set src_file [open "$confpath/$version"]}]} {
- ui_debug [concat "The file '$confpath/$version' could " \
- "not be opened. This likely means " \
- "that the specified version is invalid."]
- return ""
- }
- set srcs [split [read -nonewline $src_file] "\n"]
- close $src_file
-
- # Use $confpath/base to read in targets.
- if {[catch {set tgt_file [open "$confpath/base"]}]} {
- ui_debug "The file '$confpath/base' could not be opened."
- return ""
- }
- set tgts [split [read -nonewline $tgt_file] "\n"]
- close $tgt_file
-
- set i 0
- foreach tgt $tgts {
- set src [lindex $srcs $i]
-
- switch -glob -- $src {
- - {
- set tgt [file join $macports::prefix $tgt]
- if {[file exists $tgt]} {
- break
- }
- }
- /* {
- set tgt [file join $macports::prefix $tgt]
- if {![file exists $tgt]} {
- break
- }
- set link [file link $tgt]
- if {$link eq $src} {
- return $version
- }
- }
- default {
- set src [file join $macports::prefix $src]
- set tgt [file join $macports::prefix $tgt]
- if {![file exists $tgt]} {
- break
- }
- set link [file link $tgt]
- if {$link eq $src} {
- return $version
- }
- }
- }
- set i [expr $i+1]
- }
+ if {![file exists $selected_version]} {
+ return "none"
+ } else {
+ return [file readlink $selected_version]
}
- return ""
}
}
return ""
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20090101/cb203f84/attachment.html>
More information about the macports-changes
mailing list