[91012] trunk/base/src/port1.0/portfetch.tcl

cal at macports.org cal at macports.org
Wed Mar 21 16:57:25 PDT 2012


Revision: 91012
          https://trac.macports.org/changeset/91012
Author:   cal at macports.org
Date:     2012-03-21 16:57:23 -0700 (Wed, 21 Mar 2012)
Log Message:
-----------
fetch: Do not chown $distpath if not necessary and soft-fail if possible on error

Modified Paths:
--------------
    trunk/base/src/port1.0/portfetch.tcl

Modified: trunk/base/src/port1.0/portfetch.tcl
===================================================================
--- trunk/base/src/port1.0/portfetch.tcl	2012-03-21 17:22:22 UTC (rev 91011)
+++ trunk/base/src/port1.0/portfetch.tcl	2012-03-21 23:57:23 UTC (rev 91012)
@@ -520,15 +520,21 @@
     if {![file isdirectory $distpath]} {
         if {[catch {file mkdir $distpath} result]} {
             elevateToRoot "fetch"
-            set elevated yes
             if {[catch {file mkdir $distpath} result]} {
                 return -code error [format [msgcat::mc "Unable to create distribution files path: %s"] $result]
             }
+            chownAsRoot $distpath
+            dropPrivileges
         }
     }
-    chownAsRoot $distpath
-    if {[info exists elevated] && $elevated == yes} {
-        dropPrivileges
+    if {![file owned $distpath]} {
+        if {[catch {chownAsRoot $distpath} result]} {
+            if {[file writable $distpath]} {
+                ui_warn "$UI_PREFIX [format [msgcat::mc "Couldn't change ownership of distribution files path to macports user: %s"] $result]"
+            } else {
+                return -code error [format [msgcat::mc "Distribution files path %s not writable and could not be chowned: %s"] $distpath $result]
+            }
+        }
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20120321/f34db1ca/attachment.html>


More information about the macports-changes mailing list