[66268] trunk/base

jmr at macports.org jmr at macports.org
Wed Apr 7 22:01:30 PDT 2010


Revision: 66268
          http://trac.macports.org/changeset/66268
Author:   jmr at macports.org
Date:     2010-04-07 22:01:29 -0700 (Wed, 07 Apr 2010)
Log Message:
-----------
remove implicit variants, 'platform' now acts like a fancy 'if' statement

Modified Paths:
--------------
    trunk/base/portmgr/jobs/mirror_macports.sh
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/port/port.tcl
    trunk/base/src/port1.0/portlint.tcl
    trunk/base/src/port1.0/portmain.tcl
    trunk/base/src/port1.0/portutil.tcl

Modified: trunk/base/portmgr/jobs/mirror_macports.sh
===================================================================
--- trunk/base/portmgr/jobs/mirror_macports.sh	2010-04-08 04:59:00 UTC (rev 66267)
+++ trunk/base/portmgr/jobs/mirror_macports.sh	2010-04-08 05:01:29 UTC (rev 66268)
@@ -49,6 +49,16 @@
     $PORT mirror $P +$V; 
   done
 
+  # mirror with each platform (can exclude the one the server is running)
+  for VERS in "8 9 10";
+  do
+    for ARCH in "i386 powerpc";
+    do
+      echo "Mirroring ${P} with platform darwin ${VERS} ${ARCH}"
+      $PORT mirror $P os.major=${VERS} os.arch=${ARCH}
+    done
+  done
+
   # clean up the work area
   $PORT clean --work $P;
 

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2010-04-08 04:59:00 UTC (rev 66267)
+++ trunk/base/src/macports1.0/macports.tcl	2010-04-08 05:01:29 UTC (rev 66268)
@@ -571,7 +571,7 @@
         }
     }
     global macports::global_variations
-    array set macports::global_variations [mport_filtervariants [array get variations] yes]
+    array set macports::global_variations [array get variations]
 
     if {![info exists portdbpath]} {
         return -code error "portdbpath must be set in ${macports_conf_path}/macports.conf or in your ${macports_user_dir}/macports.conf"
@@ -1185,37 +1185,6 @@
 }
 
 
-# mport_filtervariants
-# returns the given list of variants with implicitly-set ones removed
-proc mport_filtervariants {variations {warn yes}} {
-    # Iterate through the variants, filtering out
-    # implicit ones. At the moment, the only implicit variants are
-    # platform variants.
-    set filteredvariations {}
-
-    foreach {variation value} $variations {
-        switch -regexp $variation {
-            ^(pure)?darwin         -
-            ^(free|net|open){1}bsd -
-            ^i386                  -
-            ^linux                 -
-            ^macosx                -
-            ^powerpc               -
-            ^solaris               -
-            ^sunos {
-                if {$warn} {
-                    ui_warn "Implicit variants should not be explicitly set or unset. $variation will be ignored."
-                }
-            }
-            default {
-                lappend filteredvariations $variation $value
-            }
-        }
-    }
-    return $filteredvariations
-}
-
-
 # mportopen
 # Opens a MacPorts portfile specified by a URL.  The Portfile is
 # opened with the given list of options and variations.  The result
@@ -1311,7 +1280,6 @@
     foreach v $minusvariant {
         lappend variations $v "-"
     }
-    set variations [mport_filtervariants $variations no]
     
     return [mportopen "file://${portfile_dir}/" $options $variations]
 }
@@ -2676,8 +2644,6 @@
         set macports::global_options(ports_nodeps) yes
         set orig_nodeps no
     }
-    # filter out implicit variants from the explicitly set/unset variants.
-    set variationslist [mport_filtervariants $variationslist yes]
     
     # run the actual upgrade
     set status [macports::_upgrade $portname $dspec $variationslist $optionslist depscache]
@@ -2883,8 +2849,6 @@
     foreach v $minusvariant {
         lappend oldvariantlist $v "-"
     }
-    # remove implicit variants, without printing warnings
-    set oldvariantlist [mport_filtervariants $oldvariantlist no]
 
     # merge in the old variants
     foreach {variation value} $oldvariantlist {

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2010-04-08 04:59:00 UTC (rev 66267)
+++ trunk/base/src/port/port.tcl	2010-04-08 05:01:29 UTC (rev 66268)
@@ -3575,26 +3575,13 @@
             array set portinfo [lindex $res 1]
             set porturl $portinfo(porturl)
         }
-        
+
         # use existing variants iff none were explicitly requested
         if {[array get requested_variations] == "" && [array get variations] != ""} {
             array unset requested_variations
             array set requested_variations [array get variations]
-            set filtered_variations [mport_filtervariants [array get variations] no]
-        } else {
-            set filtered_variations [mport_filtervariants [array get requested_variations] yes]
         }
-        # Filter out implicit variants from the explicitly set/unset variants.
-        # Except we need to keep them for some targets to work right...
-        switch -exact $target {
-            distfiles -
-            mirror {}
-            default {
-                array unset requested_variations
-                array set requested_variations $filtered_variations
-            }
-        }
-        
+
         # Add any global_variations to the variations
         # specified for the port
         foreach { variation value } [array get global_variations] {

Modified: trunk/base/src/port1.0/portlint.tcl
===================================================================
--- trunk/base/src/port1.0/portlint.tcl	2010-04-08 04:59:00 UTC (rev 66267)
+++ trunk/base/src/port1.0/portlint.tcl	2010-04-08 05:01:29 UTC (rev 66268)
@@ -243,7 +243,7 @@
         if {[string match "platform\[ \t\]*" $line]} {
             regexp {platform\s+(?:\w+\s+(?:\w+\s+)?)?(\w+)} $line -> platform_arch
             if {$platform_arch == "ppc"} {
-                ui_error "Arch 'ppc' in platform variant on line $lineno should be 'powerpc'"
+                ui_error "Arch 'ppc' in platform on line $lineno should be 'powerpc'"
                 incr errors
             }
         }

Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl	2010-04-08 04:59:00 UTC (rev 66267)
+++ trunk/base/src/port1.0/portmain.tcl	2010-04-08 05:01:29 UTC (rev 66268)
@@ -111,22 +111,18 @@
 
 default universal_variant yes
 
-default compiler.cpath {${prefix}/include}
-default compiler.library_path {${prefix}/lib}
-
-# Select implicit variants
-if {[info exists os.platform] && ![info exists variations(${os.platform})]} { variant_set ${os.platform}}
-if {[info exists os.arch] && ![info exists variations(${os.arch})]} { variant_set ${os.arch} }
-if {[info exists os.platform] && (${os.platform} == "darwin") && ![file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(puredarwin)]} { variant_set puredarwin }
-if {[info exists os.platform] && (${os.platform} == "darwin") && [file isdirectory /System/Library/Frameworks/Carbon.framework] && ![info exists variations(macosx)]} { variant_set macosx }
-if {[info exists variations(macosx)] && $variations(macosx) == "+"} {
+# check if we're on Mac OS X and can therefore build universal
+if {${os.platform} == "darwin" && [file isdirectory /System/Library/Frameworks/Carbon.framework]} {
     # the universal variant itself is now created in
-    # add_default_universal_variant, which is called from mportopen
+    # universal_setup, which is called from mportopen
     default os.universal_supported yes
 } else {
     default os.universal_supported no
 }
 
+default compiler.cpath {${prefix}/include}
+default compiler.library_path {${prefix}/lib}
+
 # start gsoc08-privileges
 
 # Record initial euid/egid

Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl	2010-04-08 04:59:00 UTC (rev 66267)
+++ trunk/base/src/port1.0/portutil.tcl	2010-04-08 05:01:29 UTC (rev 66268)
@@ -675,23 +675,21 @@
     }
 }
 
-# platform <os> [<release>] [<arch>]
+# platform [<os> [<release>]] [<arch>]
 # Portfile level procedure to provide support for declaring platform-specifics
-# Basically, just wrap 'variant', so that Portfiles' platform declarations can
+# Basically, just a fancy 'if', so that Portfiles' platform declarations can
 # be more readable, and support arch and version specifics
 proc platform {args} {
-    global all_variants PortInfo os.platform os.arch os.version os.major
+    global os.platform os.arch os.major
 
     set len [llength $args]
     if {$len < 2} {
-        return -code error "Malformed platform variant specification"
+        return -code error "Malformed platform specification"
     }
     set code [lindex $args end]
     set os [lindex $args 0]
     set args [lrange $args 1 [expr $len - 2]]
 
-    set ditem [variant_new "temp-variant"]
-
     foreach arg $args {
         if {[regexp {(^[0-9]+$)} $arg match result]} {
             set release $result
@@ -700,27 +698,28 @@
         }
     }
 
-    # Add the variant for this platform
-    set platform $os
-    if {[info exists release]} { set platform ${platform}_${release} }
-    if {[info exists arch]} { set platform ${platform}_${arch} }
-
-    # Pick up a unique name.
-    if {[variant_exists $platform]} {
-        set suffix 1
-        while {[variant_exists "${platform}_${suffix}"]} {
-            incr suffix
+    # sub-platforms of darwin
+    if {${os.platform} == "darwin"} {
+        if {[file isdirectory /System/Library/Frameworks/Carbon.framework]} {
+            set subplatform macosx
+        } else {
+            set subplatform puredarwin
         }
+    }
 
-        set platform "${platform}_${suffix}"
+    set match 0
+    # 'os' could be a platform or an arch when it's alone
+    if {$len == 2 && ($os == ${os.platform} || ([info exists subplatform] && $os == $subplatform) || $os == ${os.arch})} {
+        set match 1
+    } elseif {($os == ${os.platform} || ([info exists subplatform] && $os == $subplatform))
+              && (![info exists release] || ${os.major} == $release)
+              && (![info exists arch] || ${os.arch} == $arch)} {
+        set match 1
     }
-    variant $platform $code
 
-    # Set the variant if this platform matches the platform we're on
-    if {([info exists os.platform] && ${os.platform} == $os)
-            && !([info exists os.major] && [info exists release] && ${os.major} != $release)
-            && !([info exists arch] && [info exists os.arch] && ${os.arch} != $arch)} {
-        variant_set $platform
+    # Execute the code if this platform matches the platform we're on
+    if {$match} {
+        uplevel #0 $code
     }
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100407/ce85104c/attachment-0001.html>


More information about the macports-changes mailing list