[70136] branches/release_1_9/base/src/port/port.tcl
jmr at macports.org
jmr at macports.org
Fri Jul 30 01:00:02 PDT 2010
Revision: 70136
http://trac.macports.org/changeset/70136
Author: jmr at macports.org
Date: 2010-07-30 01:00:00 -0700 (Fri, 30 Jul 2010)
Log Message:
-----------
merge r70135 from trunk:
make actions that will fail due to insufficient privileges fail early (#25671)
Revision Links:
--------------
http://trac.macports.org/changeset/70135
Modified Paths:
--------------
branches/release_1_9/base/src/port/port.tcl
Modified: branches/release_1_9/base/src/port/port.tcl
===================================================================
--- branches/release_1_9/base/src/port/port.tcl 2010-07-30 07:57:13 UTC (rev 70135)
+++ branches/release_1_9/base/src/port/port.tcl 2010-07-30 08:00:00 UTC (rev 70136)
@@ -1481,6 +1481,18 @@
}
}
+# check if the install prefix is writable
+# should be called by actions that will modify it
+proc prefix_unwritable {} {
+ global macports::portdbpath
+ if {[file writable $portdbpath]} {
+ return 0
+ } else {
+ ui_error "Insufficient privileges to write to MacPorts install prefix."
+ return 1
+ }
+}
+
proc parsePortSpec { vername varname optname {remainder ""} } {
upvar $vername portversion
@@ -2214,7 +2226,7 @@
proc action_activate { action portlist opts } {
global macports::registry.format
set status 0
- if {[require_portlist portlist]} {
+ if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
}
foreachport $portlist {
@@ -2248,7 +2260,7 @@
proc action_deactivate { action portlist opts } {
global macports::registry.format
set status 0
- if {[require_portlist portlist]} {
+ if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
}
foreachport $portlist {
@@ -2409,7 +2421,7 @@
proc action_setrequested { action portlist opts } {
global macports::registry.format
set status 0
- if {[require_portlist portlist]} {
+ if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
}
# set or unset?
@@ -2437,7 +2449,7 @@
proc action_upgrade { action portlist opts } {
- if {[require_portlist portlist]} {
+ if {[require_portlist portlist] || [prefix_unwritable]} {
return 1
}
# shared depscache for all ports in the list
@@ -2811,6 +2823,9 @@
return 1
}
}
+ if {[prefix_unwritable]} {
+ return 1
+ }
foreachport $portlist {
if {![registry::entry_exists_for_name $portname]} {
@@ -3590,6 +3605,9 @@
if {[require_portlist portlist]} {
return 1
}
+ if {($action == "install" || $action == "archive") && [prefix_unwritable]} {
+ return 1
+ }
foreachport $portlist {
# If we have a url, use that, since it's most specific
# otherwise try to map the portname to a url
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100730/f3212b37/attachment.html>
More information about the macports-changes
mailing list