[68697] trunk/base/src

jmr at macports.org jmr at macports.org
Thu Jun 10 08:43:56 PDT 2010


Revision: 68697
          http://trac.macports.org/changeset/68697
Author:   jmr at macports.org
Date:     2010-06-10 08:43:52 -0700 (Thu, 10 Jun 2010)
Log Message:
-----------
fix case of incorrectly trying to deactivate when using direct mode, and make the activate and deactivate targets noops in that situation, but run them in order to execute the pre and post procs (#11562)

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/port/port.tcl
    trunk/base/src/port1.0/portactivate.tcl
    trunk/base/src/port1.0/portdeactivate.tcl
    trunk/base/src/registry2.0/portuninstall.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2010-06-10 15:37:31 UTC (rev 68696)
+++ trunk/base/src/macports1.0/macports.tcl	2010-06-10 15:43:52 UTC (rev 68697)
@@ -1637,11 +1637,6 @@
     }
 
     set clean 0
-    if {[string equal $target "install"] && [string equal ${macports::registry.installtype} "image"]} {
-        # If we're doing image installs, then we should activate after install
-        # xxx: This isn't pretty
-        set target activate
-    }
     if {[string equal ${macports::portautoclean} "yes"] && ([string equal $target "install"] || [string equal $target "activate"])} {
         # If we're doing an install, check if we should clean after
         set clean 1

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2010-06-10 15:37:31 UTC (rev 68696)
+++ trunk/base/src/port/port.tcl	2010-06-10 15:43:52 UTC (rev 68697)
@@ -2225,7 +2225,7 @@
 
             set i [lindex $ilist 0]
             set regref [registry::entry open $portname [lindex $i 1] [lindex $i 2] [lindex $i 3] [lindex $i 5]]
-            if {[registry::run_target $regref activate [array get options]]} {
+            if {[$regref installtype] == "image" && [registry::run_target $regref activate [array get options]]} {
                 continue
             }
         }
@@ -2262,7 +2262,7 @@
             set ivariants [lindex $i 3]
             if {$composite_version == "" || $composite_version == "${iversion}_${irevision}${ivariants}"} {
                 set regref [registry::entry open $portname $iversion $irevision $ivariants [lindex $i 5]]
-                if {[registry::run_target $regref deactivate [array get options]]} {
+                if {[$regref installtype] == "image" && [registry::run_target $regref deactivate [array get options]]} {
                     continue
                 }
             }
@@ -3577,7 +3577,6 @@
     if {[require_portlist portlist]} {
         return 1
     }
-    set target $action
     foreachport $portlist {
         # If we have a url, use that, since it's most specific
         # otherwise try to map the portname to a url
@@ -3622,8 +3621,12 @@
             set options(ports_version_glob) $portversion
         }
         # if installing, mark the port as explicitly requested
-        if {$target == "install"} {
+        if {$action == "install"} {
             set options(ports_requested) 1
+            # we actually activate as well
+            set target activate
+        } else {
+            set target $action
         }
         if {[catch {set workername [mportopen $porturl [array get options] [array get requested_variations]]} result]} {
             global errorInfo

Modified: trunk/base/src/port1.0/portactivate.tcl
===================================================================
--- trunk/base/src/port1.0/portactivate.tcl	2010-06-10 15:37:31 UTC (rev 68696)
+++ trunk/base/src/port1.0/portactivate.tcl	2010-06-10 15:43:52 UTC (rev 68697)
@@ -54,17 +54,21 @@
 default activate.asroot no
 
 proc portactivate::activate_start {args} {
-    global prefix
-    if { ![file writable $prefix] } {
+    global prefix registry.installtype
+    if { ![file writable $prefix] && ${registry.installtype} == "image"} {
         # if install location is not writable, need root privileges
         elevateToRoot "activate"
     }
 }
 
 proc portactivate::activate_main {args} {
-    global env name version revision portvariants user_options PortInfo
-    registry_activate $name "${version}_${revision}${portvariants}" [array get user_options]
+    global env name version revision portvariants user_options PortInfo registry.installtype
 
+    # skip the actual activation in direct mode (we still want the notes and the pre/post procs)
+    if {${registry.installtype} == "image"} {
+        registry_activate $name "${version}_${revision}${portvariants}" [array get user_options]
+    }
+
     # Display notes at the end of the activation phase.
     if {[info exists PortInfo(notes)] && $PortInfo(notes) ne {}} {
         ui_msg ""

Modified: trunk/base/src/port1.0/portdeactivate.tcl
===================================================================
--- trunk/base/src/port1.0/portdeactivate.tcl	2010-06-10 15:37:31 UTC (rev 68696)
+++ trunk/base/src/port1.0/portdeactivate.tcl	2010-06-10 15:43:52 UTC (rev 68697)
@@ -49,15 +49,18 @@
 default deactivate.asroot no
 
 proc portdeactivate::deactivate_start {args} {
-    global prefix
-    if { ![file writable $prefix] } {
+    global prefix registry.installtype
+    if { ![file writable $prefix] && ${registry.installtype} == "image"} {
         # if install location is not writable, need root privileges
         elevateToRoot "deactivate"
     }
 }
 
 proc portdeactivate::deactivate_main {args} {
-    global name version revision portvariants user_options
-    registry_deactivate $name "${version}_${revision}${portvariants}" [array get user_options]
+    global name version revision portvariants user_options registry.installtype
+    # we still want to be able to run this target in direct mode for the pre/post procs
+    if {${registry.installtype} == "image"}
+        registry_deactivate $name "${version}_${revision}${portvariants}" [array get user_options]
+    }
     return 0
 }

Modified: trunk/base/src/registry2.0/portuninstall.tcl
===================================================================
--- trunk/base/src/registry2.0/portuninstall.tcl	2010-06-10 15:37:31 UTC (rev 68696)
+++ trunk/base/src/registry2.0/portuninstall.tcl	2010-06-10 15:43:52 UTC (rev 68697)
@@ -147,7 +147,9 @@
                 ui_msg "For $portname @${v}: skipping deactivate (dry run)"
             } else {
                 if {[info exists options(ports_uninstall_no-exec)] || ![registry::run_target $port deactivate $optionslist]} {
-                    portimage::deactivate $portname $v [array get options]
+                    if {[$port installtype] == "image"} {
+                        portimage::deactivate $portname $v [array get options]
+                    }
                 }
             }
         }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100610/31d24753/attachment.html>


More information about the macports-changes mailing list