[25006] trunk/base/src/port1.0

source_changes at macosforge.org source_changes at macosforge.org
Thu May 10 23:49:23 PDT 2007


Revision: 25006
          http://trac.macosforge.org/projects/macports/changeset/25006
Author:   eridius at macports.org
Date:     2007-05-10 23:49:22 -0700 (Thu, 10 May 2007)

Log Message:
-----------
Fix the $option-delete proc to handle multiple arguments properly. This was entirely my fault. Fixes #11929

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

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2007-05-11 06:39:22 UTC (rev 25005)
+++ trunk/base/src/port1.0/portutil.tcl	2007-05-11 06:49:22 UTC (rev 25006)
@@ -99,9 +99,9 @@
         proc ${option}-delete {args} [subst -nocommands {
             global $option user_options option_procs
             if {![info exists user_options($option)] && [info exists $option]} {
-                set temp $option
+                set temp [set $option]
                 foreach val \$args {
-                   set temp [ldelete \${$option} \$val]
+                   set temp [ldelete \$temp \$val]
                 }
                 if {\$temp eq ""} {
                     unset $option

Modified: trunk/base/src/port1.0/tests/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/tests/portutil.tcl	2007-05-11 06:39:22 UTC (rev 25005)
+++ trunk/base/src/port1.0/tests/portutil.tcl	2007-05-11 06:49:22 UTC (rev 25006)
@@ -59,6 +59,36 @@
     }
 }
 
+proc test_depends_lib-delete {} {
+    # tests depends_lib-delete
+    # actually tests all option-deletes
+    # but the bug was originally documented with depends_lib
+    
+    # depends_lib is intended to work from within a worker thread
+    # so we shall oblige
+    set workername [interp create]
+    darwinports::worker_init $workername {} [darwinports::getportbuildpath {}] {} {}
+    set body {
+        # load the current copy of portutil instead of the installed one
+        source [file dirname [info script]]/../portutil.tcl
+        package require port
+        
+        depends_lib port:foo port:bar port:blah
+        depends_lib-delete port:blah port:bar
+        array get PortInfo
+    }
+    if {[catch {$workername eval $body} result]} {
+        interp delete $workername
+        error $result $::errorInfo $::errorCode
+    } else {
+        interp delete $workername
+    }
+    array set temp $result
+    if {$temp(depends_lib) ne "port:foo"} {
+        error "depends_lib-delete did not delete properly"
+    }
+}
+
 proc test_touch {} {
     set root "/tmp/macports-portutil-touch"
     file delete -force $root

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070510/41ebf04c/attachment.html


More information about the macports-changes mailing list