[25033] trunk/base

source_changes at macosforge.org source_changes at macosforge.org
Fri May 11 23:17:28 PDT 2007


Revision: 25033
          http://trac.macosforge.org/projects/macports/changeset/25033
Author:   eridius at macports.org
Date:     2007-05-11 23:17:27 -0700 (Fri, 11 May 2007)

Log Message:
-----------
Evaluate variants during dportopen instead of dportexec.
This ensures that querying an open port always contains the proper variant-modified information before any targets are executed.
It also prevents variants from being executed multiple times if multiple targets are executed separately (fixes #11296).

Modified Paths:
--------------
    trunk/base/ChangeLog
    trunk/base/src/darwinports1.0/darwinports.tcl
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/ChangeLog
===================================================================
--- trunk/base/ChangeLog	2007-05-12 05:20:23 UTC (rev 25032)
+++ trunk/base/ChangeLog	2007-05-12 06:17:27 UTC (rev 25033)
@@ -6,6 +6,11 @@
 
 (unreleased):
 
+    - Evaluate variants at dportopen instead of dportexec. This ensures that
+      the portfile represents the proper information if queried before targets
+      are executed. It also prevents variants from being executed twice if multiple
+      targets are executed separately on the portfile (ticket #11296, eridius r25033).
+
     - Fix copy and move commands (eridius r25024).
 
     - Passing multiple arguments to $option-delete now works as expected

Modified: trunk/base/src/darwinports1.0/darwinports.tcl
===================================================================
--- trunk/base/src/darwinports1.0/darwinports.tcl	2007-05-12 05:20:23 UTC (rev 25032)
+++ trunk/base/src/darwinports1.0/darwinports.tcl	2007-05-12 06:17:27 UTC (rev 25033)
@@ -813,6 +813,12 @@
     darwinports::worker_init $workername $portpath [darwinports::getportbuildpath $portpath] $options $variations
 
     $workername eval source Portfile
+    
+    # evaluate the variants
+	if {[$workername eval eval_variants variations] != 0} {
+	    dportclose $dport
+		error "Error evaluating variants"
+	}
 
     ditem_key $dport provides [$workername eval return \$portname]
 
@@ -1034,7 +1040,7 @@
 proc _dportexec {target dport} {
 	# xxx: set the work path?
 	set workername [ditem_key $dport workername]
-	if {![catch {$workername eval eval_variants variations $target} result] && $result == 0 &&
+	if {![catch {$workername eval check_variants variations $target} result] && $result == 0 &&
 		![catch {$workername eval eval_targets $target} result] && $result == 0} {
 		# If auto-clean mode, clean-up after dependency install
 		if {[string equal ${darwinports::portautoclean} "yes"]} {
@@ -1061,9 +1067,9 @@
     global darwinports::registry.installtype
 
 	set workername [ditem_key $dport workername]
-
-	# XXX: move this into dportopen?
-	if {[$workername eval eval_variants variations $target] != 0} {
+	
+	# check variants
+	if {[$workername eval check_variants variations $target] != 0} {
 		return 1
 	}
 	

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2007-05-12 05:20:23 UTC (rev 25032)
+++ trunk/base/src/port1.0/portutil.tcl	2007-05-12 06:17:27 UTC (rev 25033)
@@ -1365,10 +1365,9 @@
     return 0
 }
 
-proc eval_variants {variations target} {
+proc eval_variants {variations} {
     global all_variants ports_force PortInfo
     set dlist $all_variants
-    set result 0
     upvar $variations upvariations
     set chosen [choose_variants $dlist upvariations]
 	set portname $PortInfo(name)
@@ -1400,6 +1399,15 @@
 		return 1
     }
     
+    return 0
+}
+
+proc check_variants {variations target} {
+    global ports_force PortInfo
+    upvar $variations upvariations
+    set result 0
+    set portname $PortInfo(name)
+    
     # Make sure the variations match those stored in the statefile.
     # If they don't match, print an error indicating a 'port clean' 
     # should be performed.  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070511/54ec025a/attachment.html


More information about the macports-changes mailing list