<pre style='margin:0'>
Joshua Root (jmroot) pushed a commit to branch master
in repository macports-base.
</pre>
<p><a href="https://github.com/macports/macports-base/commit/acd931c3c98722627ca32f5813f74caef097557e">https://github.com/macports/macports-base/commit/acd931c3c98722627ca32f5813f74caef097557e</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit acd931c3c98722627ca32f5813f74caef097557e
</span>Author: Joshua Root <jmr@macports.org>
AuthorDate: Tue Dec 27 16:25:07 2016 +1100
<span style='display:block; white-space:pre;color:#404040;'> port diagnose fixes
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> * Allow user config file to not exist, and simply use internal defaults
</span><span style='display:block; white-space:pre;color:#404040;'> in that case, rather than creating the file and writing defaults to it.
</span><span style='display:block; white-space:pre;color:#404040;'> Defaults may change in the future and the old defaults in the file
</span><span style='display:block; white-space:pre;color:#404040;'> would override them.
</span><span style='display:block; white-space:pre;color:#404040;'> * Keep config in macports_conf_path with the other config files
</span><span style='display:block; white-space:pre;color:#404040;'> * Fail gracefully when there is no Xcode version info for the current
</span><span style='display:block; white-space:pre;color:#404040;'> OS version
</span><span style='display:block; white-space:pre;color:#404040;'> * Raise an error when the Xcode version info file doesn't exist,
</span><span style='display:block; white-space:pre;color:#404040;'> instead of exiting immediately
</span><span style='display:block; white-space:pre;color:#404040;'> * Run compilation test in the proper temp dir instead of just whatever
</span><span style='display:block; white-space:pre;color:#404040;'> the working directory happens to be
</span><span style='display:block; white-space:pre;color:#404040;'> * Use cc in compilation test instead of clang (not all systems have it)
</span><span style='display:block; white-space:pre;color:#404040;'> * Use registry2 API to get installed ports and their files
</span><span style='display:block; white-space:pre;color:#404040;'> * Don't require root privileges
</span><span style='display:block; white-space:pre;color:#404040;'> * Correct information and use more usual terminology in some messages
</span><span style='display:block; white-space:pre;color:#404040;'> * Fix typos
</span>---
src/macports1.0/diagnose.tcl | 173 ++++++++++++++++++++-----------------------
src/port/port.tcl | 3 -
2 files changed, 79 insertions(+), 97 deletions(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/macports1.0/diagnose.tcl b/src/macports1.0/diagnose.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 868fa83..9fb3225 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/macports1.0/diagnose.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/macports1.0/diagnose.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -53,7 +53,7 @@
</span> # Check for archives from all ports exists
# Check for things in /usr/local
# Check for x11.app if the OS is 10.6 and suggest installing xorg-server or the xquartz site
<span style='display:block; white-space:pre;background:#ffe0e0;'>-# Add error catching for line's without an equals sign.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+# Add error catching for lines without an equals sign.
</span> # Support comments for the parser
# Check for amount of drive space
# Move port_diagnose.ini to the port tree, below _resources
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -90,20 +90,27 @@ namespace eval diagnose {
</span> }
array set config_options [list]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set parser_options {"macports_location" "profile_path" "shell_location" "xcode_version_10.10" "xcode_version_10.9" "xcode_version_10.8" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- "xcode_version_10.7" "xcode_version_10.6" "xcode_version_10.7" "xcode_version_10.6" "xcode_version_10.5" \
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- "xcode_version_10.4" "xcode_build"}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set parser_options [list macports_location profile_path shell_location \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xcode_version_${macports::macosx_version} xcode_build]
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set user_config_path ${macports::portdbpath}/port_diagnose.ini
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set user_config_path "${macports::autoconf::macports_conf_path}/port_diagnose.ini"
</span> set xcode_config_path [macports::getdefaultportresourcepath "macports1.0/xcode_versions.ini"]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Make sure at least a default copy of the xcode and user config exist
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- make_xcode_config $xcode_config_path
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- make_user_config $user_config_path
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Make sure the xcode config exists
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ check_xcode_config $xcode_config_path
</span>
# Read the config files
get_config config_options $parser_options $user_config_path
get_config config_options $parser_options $xcode_config_path
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists config_options(macports_location)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set config_options(macports_location) "${macports::prefix}"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists config_options(profile_path)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set config_options(profile_path) "${macports::user_home}/.bash_profile"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![info exists config_options(shell_location)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set config_options(shell_location) /bin/bash
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
# Start the checks
check_path $config_options(macports_location) $config_options(profile_path) $config_options(shell_location)
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -159,7 +166,7 @@ namespace eval diagnose {
</span> if {$xcode_select eq ""} {
ui_warn "Xcode Command Line Tools are not installed! To install them, please enter the command:
<span style='display:block; white-space:pre;background:#ffe0e0;'>- xcode-selct --install"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ xcode-select --install"
</span> success_fail 0
return
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -202,7 +209,7 @@ namespace eval diagnose {
</span> # Returns:
# None
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {${diagnose::quiet} == 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {!${diagnose::quiet}} {
</span> ui_msg -nonewline "Checking for $string... "
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -216,7 +223,7 @@ namespace eval diagnose {
</span> # Returns:
# None
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {${diagnose::quiet} eq 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {!${diagnose::quiet}} {
</span>
if {$result == 1} {
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -241,20 +248,25 @@ namespace eval diagnose {
</span>
output "compilation errors"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set filename "test.c"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set fd [open $filename w]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # 'clang' will fail when using
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # https://trac.macports.org/wiki/UsingTheRightCompiler#testing
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file isfile /usr/bin/cc]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "No compiler found at /usr/bin/cc"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ success_fail 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set builddir "[macports::gettmpdir]/port_diagnose"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file mkdir $builddir
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set filepath "${builddir}/test.c"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set fd [open $filepath w]
</span>
puts $fd "int main() { return 0; }"
close $fd
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # 'clang' will fail when using
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # https://trac.macports.org/wiki/UsingTheRightCompiler#testing
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # TODO: use default C compiler
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # TODO: skip if no C compiler installed
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- catch {exec /usr/bin/clang $filename -o main_test} output
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ catch {exec /usr/bin/cc $filepath -o "${builddir}/main_test"} output
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- file delete $filename
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- file delete "main_test"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ file delete -force $builddir
</span>
if {[string length $output] > 0} {
# Some type of error
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -321,7 +333,7 @@ namespace eval diagnose {
</span>
output "Fink"
if {[file exists "/sw"]} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_warn "it seems you have Fink installed on your system -- This could potentially cause issues with MacPorts. We'd recommend you'd \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_warn "it seems you have Fink installed on your system -- This could potentially cause issues with MacPorts. We'd recommend you \
</span> either uninstall it, or move it from /sw for now."
success_fail 0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -343,19 +355,15 @@ namespace eval diagnose {
</span> # None
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set apps [reclaim::get_info]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set apps [registry::entry imaged]
</span>
array set activeApps {}
set totalFiles 0
foreach app $apps {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set name [lindex $app 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set active [lindex $app 4]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set files [registry::port_registered $name]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {$active} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set activeApps($name) $files
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set files [$app files]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[$app state] eq "installed"} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set activeApps([$app name]) $files
</span> incr totalFiles [llength $files]
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -363,7 +371,7 @@ namespace eval diagnose {
</span> set fancyOutput [expr { ![macports::ui_isset ports_debug] \
&& ![macports::ui_isset ports_verbose] \
&& [info exists macports::ui_options(progress_generic)] \
<span style='display:block; white-space:pre;background:#ffe0e0;'>- && ${diagnose::quiet} == 0}]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ && !${diagnose::quiet}}]
</span>
if {$fancyOutput} {
set progress $macports::ui_options(progress_generic)
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -372,7 +380,7 @@ namespace eval diagnose {
</span> if {$totalFiles > 0} {
if {$fancyOutput} {
output "files installed by ports on disk"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {${diagnose::quiet} == 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {!${diagnose::quiet}} {
</span> # we need a newline here or the progress bar will overwrite the line
ui_msg ""
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -430,24 +438,14 @@ namespace eval diagnose {
</span> # Returns:
# None
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set apps [reclaim::get_info]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set apps [registry::entry imaged]
</span>
foreach app $apps {
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set name [lindex $app 0]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set version [lindex $app 1]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set revision [lindex $app 2]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set variants [lindex $app 3]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set epoch [lindex $app 5]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- output "'${name} @${version}_${revision}${variants}'s tarball on disk"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set ref [registry::open_entry $name $version $revision $variants $epoch]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set image_dir [registry::property_retrieve $ref location]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {![file exists $image_dir]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_warn "couldn't find the archive for '$name'. Please uninstall and reinstall this application."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set name [$app name]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ output "'${name} @[$app version]_[$app revision][$app variants]'s tarball on disk"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists [$app location]]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_warn "couldn't find the archive for '$name'. Please uninstall and reinstall this port."
</span> success_fail 0
} else {
success_fail 1
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -468,7 +466,7 @@ namespace eval diagnose {
</span> output "dylibs in /usr/local/lib"
if {[glob -nocomplain -directory "/usr/local/lib" *.dylib *.la *.prl] ne ""} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_warn "found dylib's in your /usr/local/lib directory. These are known to cause problems. We'd recommend \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_warn "found dylibs in your /usr/local/lib directory. These are known to cause problems. We'd recommend \
</span> you remove them."
success_fail 0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -556,9 +554,9 @@ namespace eval diagnose {
</span> # Returns:
# None
<span style='display:block; white-space:pre;background:#ffe0e0;'>- output "MacPort's location"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ output "MacPorts' location"
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[file exists ${macports::prefix}/bin/port] == 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists ${macports::prefix}/bin/port]} {
</span> ui_error "the port command was not found in ${macports::prefix}/bin. This can potentially cause errors. It's recommended you move it back to ${macports::prefix}/bin."
success_fail 0
return
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -578,7 +576,7 @@ namespace eval diagnose {
</span>
output "for '$app'"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[file exists /usr/bin/$app] == 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists /usr/bin/$app]} {
</span> ui_error "$app is needed by MacPorts to function normally, but wasn't found on this system. We'd recommend \
installing it for continued use of MacPorts."
success_fail 0
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -603,12 +601,16 @@ namespace eval diagnose {
</span>
set mac_version ${macports::macosx_version}
set xcode_current ${macports::xcodeversion}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- set xcode_versions $config(xcode_version_$mac_version)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[info exists config(xcode_version_$mac_version)]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set xcode_versions $config(xcode_version_$mac_version)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_warn "No Xcode version info was found for your OS version."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ success_fail 0
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
if {$xcode_current in $xcode_versions} {
success_fail 1
<span style='display:block; white-space:pre;background:#ffe0e0;'>- return
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> } else {
ui_error "currently installed version of Xcode, $xcode_current, is not supported by MacPorts. \
For your currently installed system, only the following versions of Xcode are supported: \
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -617,45 +619,23 @@ namespace eval diagnose {
</span> }
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- proc make_xcode_config {path} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ proc check_xcode_config {path} {
</span>
<span style='display:block; white-space:pre;background:#ffe0e0;'>- # Checks to see if xcode_versions.ini exists. If it does, it returns. If it doesn't, then it creats a defult config file.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Checks to see if xcode_versions.ini exists. If it does, it returns. If it doesn't, then it raises an error.
</span> #
# Args:
# None
# Returns:
# None
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[file exists $path] == 0} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file exists $path]} {
</span> ui_error "No configuration file found at $path. Please run,
\"port selfupdate\""
<span style='display:block; white-space:pre;background:#ffe0e0;'>- exit
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ error "missing [file tail $path]"
</span>
}
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>- proc make_user_config {path} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Builds a config file for the user using all default parameters if needed.
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- #
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Args:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # None
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # Returns:
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- # None
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[file exists $path] == 0} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_warn "No configuration file found at $path. Creating generic config file."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set fd [open $path w]
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts $fd "macports_location=${macports::prefix}"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts $fd "profile_path=${macports::user_home}/.bash_profile"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts $fd "shell_location=/bin/bash"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- close $fd
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> proc get_config {config_options parser_options path} {
# Reads in and parses the configuration file passed in to $path. After parsing, all variables found are assigned
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -668,6 +648,10 @@ namespace eval diagnose {
</span> # Returns:
# None.
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {![file isfile $path]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> upvar $config_options config
set fd [open $path r]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -676,10 +660,10 @@ namespace eval diagnose {
</span>
close $fd
<span style='display:block; white-space:pre;background:#ffe0e0;'>- foreach line $data {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ foreach line $data {
</span>
# Ignore comments
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[string index $line 0] eq "#" } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[string index $line 0] eq "#"} {
</span> continue
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -694,7 +678,7 @@ namespace eval diagnose {
</span> } elseif {[lindex $tokens 0] eq ""} {
continue
<span style='display:block; white-space:pre;background:#ffe0e0;'>- } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } elseif {![string match xcode_version_* [lindex $tokens 0]]} {
</span> ui_error "unrecognized config option in file $path: [lindex $tokens 0]"
}
}
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -715,16 +699,16 @@ namespace eval diagnose {
</span> set path ${macports::user_path}
set split [split $path :]
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {"$port_loc/bin" in $split && "$port_loc/sbin" in $split } {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {"$port_loc/bin" in $split && "$port_loc/sbin" in $split} {
</span>
if {[lindex $split 0] ne "$port_loc/bin"} {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_warn "$port_loc/bin is not first in your PATH environmental variable. This may or may not \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_warn "$port_loc/bin is not first in your PATH environment variable. This may or may not \
</span> cause problems in the future."
}
return
} else {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_warn "your environmental \$PATH variable does not currently include, $port_loc/bin, which is where port is located. \
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_warn "your \$PATH environment variable does not currently include, $port_loc/bin, which is where port is located. \
</span> Would you like to add $port_loc/bin to your \$PATH variable now? \[Y/N\]"
set input [gets stdin]
<span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -734,18 +718,19 @@ namespace eval diagnose {
</span> # share code?
ui_msg "Attempting to add $port_loc/bin to $profile_path"
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[file exists $profile_path] == 1} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- set fd [open $profile_path a]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[file exists $profile_path]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if {[file writable $profile_path]} {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ set fd [open $profile_path a]
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ puts $fd "export PATH=$port_loc/bin:$port_loc/sbin:\$PATH"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ close $fd
</span>
<span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_msg "Added PATH properly. Please open a new terminal window to load the modified ${profile_path}."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ } else {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ui_error "Can't write to ${profile_path}."
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span> } else {
ui_error "$profile_path does not exist."
}
<span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- puts $fd "export PATH=$port_loc/bin:$port_loc/sbin:\$PATH"
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- close $fd
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- ui_msg "Added PATH properly. Please execute, 'source $profile_path' in a new terminal window."
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>-
</span> } elseif {$input eq "n" || $input eq "N"} {
ui_msg "Not fixing your \$PATH variable."
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/src/port/port.tcl b/src/port/port.tcl
</span><span style='display:block; white-space:pre;color:#808080;'>index 843f6cb..c1e1f00 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/src/port/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/src/port/port.tcl
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -2773,9 +2773,6 @@ proc action_setrequested { action portlist opts } {
</span> }
proc action_diagnose { action portlist opts } {
<span style='display:block; white-space:pre;background:#ffe0e0;'>- if {[prefix_unwritable]} {
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- return 1
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>- }
</span> macports::diagnose_main $opts
return 0
}
</pre><pre style='margin:0'>
</pre>