[66923] trunk/base/src

jmr at macports.org jmr at macports.org
Sun Apr 25 17:04:03 PDT 2010


Revision: 66923
          http://trac.macports.org/changeset/66923
Author:   jmr at macports.org
Date:     2010-04-25 17:04:01 -0700 (Sun, 25 Apr 2010)
Log Message:
-----------
set up platform info variables in mportinit rather than portmain

Modified Paths:
--------------
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/port/port.tcl
    trunk/base/src/port1.0/portmain.tcl

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2010-04-25 23:47:54 UTC (rev 66922)
+++ trunk/base/src/macports1.0/macports.tcl	2010-04-26 00:04:01 UTC (rev 66923)
@@ -54,7 +54,8 @@
         portarchivetype portautoclean porttrace keeplogs portverbose destroot_umask rsync_server \
         rsync_options rsync_dir startupitem_type place_worksymlink macportsuser \
         mp_remote_url mp_remote_submit_url configureccache configuredistcc configurepipe buildnicevalue buildmakejobs \
-        applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch $user_options"
+        applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch \
+        os_arch os_endian os_version os_major os_platform macosx_version $user_options"
 
     # deferred options are only computed when needed.
     # they are not exported to the trace thread.
@@ -459,6 +460,12 @@
     global macports::buildmakejobs
     global macports::universal_archs
     global macports::build_arch
+    global macports::os_arch
+    global macports::os_endian
+    global macports::os_version
+    global macports::os_major
+    global macports::os_platform
+    global macports::macosx_version
 
     # Set the system encoding to utf-8
     encoding system utf-8
@@ -471,6 +478,21 @@
         set macports::macports_user_dir "/dev/null/NO_HOME_DIR"
     }
 
+    # set up platform info variables
+    set os_arch $tcl_platform(machine)
+    if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
+    if {$os_arch == "i586" || $os_arch == "i686" || $os_arch == "x86_64"} { set os_arch "i386" }
+    set os_version $tcl_platform(osVersion)
+    set os_major [lindex [split $os_version .] 0]
+    set os_platform [string tolower $tcl_platform(os)]
+    # Remove trailing "Endian"
+    set os_endian [string range $tcl_platform(byteOrder) 0 end-6]
+    set macosx_version {}
+    if {$os_platform == "darwin"} {
+        # This will probably break when Apple changes versioning
+        set macosx_version [expr 10.0 + ($os_major - 4) / 10.0]
+    }
+
     # Configure the search path for configuration files
     set conf_files ""
     lappend conf_files "${macports_conf_path}/macports.conf"
@@ -768,7 +790,7 @@
 
     # Default mp universal options
     if {![info exists macports::universal_archs]} {
-        if {[lindex [split $tcl_platform(osVersion) .] 0] >= 10} {
+        if {$os_major >= 10} {
             set macports::universal_archs {x86_64 i386}
         } else {
             set macports::universal_archs {i386 ppc}
@@ -779,15 +801,15 @@
     
     # Default arch to build for
     if {![info exists macports::build_arch]} {
-        if {$tcl_platform(os) == "Darwin"} {
-            if {[lindex [split $tcl_platform(osVersion) .] 0] >= 10} {
+        if {$os_platform == "darwin"} {
+            if {$os_major >= 10} {
                 if {[sysctl hw.cpu64bit_capable] == 1} {
                     set macports::build_arch x86_64
                 } else {
                     set macports::build_arch i386
                 }
             } else {
-                if {$tcl_platform(machine) == "Power Macintosh"} {
+                if {$os_arch == "powerpc"} {
                     set macports::build_arch ppc
                 } else {
                     set macports::build_arch i386

Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl	2010-04-25 23:47:54 UTC (rev 66922)
+++ trunk/base/src/port/port.tcl	2010-04-26 00:04:01 UTC (rev 66923)
@@ -721,9 +721,6 @@
     # Now process the list, keeping only those ports that are outdated
     set results {}
     if { [llength $ilist] > 0 } {
-        global tcl_platform
-        set os_platform [string tolower $tcl_platform(os)]
-        set os_major [lindex [split $tcl_platform(osVersion) .] 0]
         foreach i $ilist {
 
             # Get information about the installed port
@@ -779,7 +776,7 @@
                 set os_major_installed [registry::property_retrieve $regref os_major]
                 if {$os_platform_installed != "" && $os_platform_installed != 0
                     && $os_major_installed != "" && $os_major_installed != 0
-                    && ($os_platform_installed != $os_platform || $os_major_installed != $os_major)} {
+                    && ($os_platform_installed != ${macports::os_platform} || $os_major_installed != ${macports::os_major})} {
                     set comp_result -1
                 }
             }
@@ -2463,16 +2460,7 @@
 
 
 proc action_platform { action portlist opts } {
-#   global os.platform os.major os.arch 
-    global tcl_platform
-    set os_platform [string tolower $tcl_platform(os)]
-    set os_version $tcl_platform(osVersion)
-    set os_arch $tcl_platform(machine)
-    if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
-    if {$os_arch == "i586" || $os_arch == "i686"} { set os_arch "i386" }
-    set os_major [lindex [split $tcl_platform(osVersion) .] 0]
-#   puts "Platform: ${os.platform} ${os.major} ${os.arch}"
-    puts "Platform: ${os_platform} ${os_major} ${os_arch}"
+    puts "Platform: ${macports::os_platform} ${macports::os_major} ${macports::os_arch}"
     return 0
 }
 
@@ -2931,9 +2919,6 @@
 
     set num_outdated 0
     if { [llength $ilist] > 0 } {
-        global tcl_platform
-        set os_platform [string tolower $tcl_platform(os)]
-        set os_major [lindex [split $tcl_platform(osVersion) .] 0]
         foreach i $ilist {
         
             # Get information about the installed port
@@ -2995,9 +2980,9 @@
                 set os_major_installed [registry::property_retrieve $regref os_major]
                 if {$os_platform_installed != "" && $os_platform_installed != 0
                     && $os_major_installed != "" && $os_major_installed != 0
-                    && ($os_platform_installed != $os_platform || $os_major_installed != $os_major)} {
+                    && ($os_platform_installed != ${macports::os_platform} || $os_major_installed != ${macports::os_major})} {
                     set comp_result -1
-                    set reason { (platform $os_platform_installed $os_major_installed != $os_platform $os_major)}
+                    set reason { (platform $os_platform_installed $os_major_installed != ${macports::os_platform} ${macports::os_major})}
                 }
             }
             

Modified: trunk/base/src/port1.0/portmain.tcl
===================================================================
--- trunk/base/src/port1.0/portmain.tcl	2010-04-25 23:47:54 UTC (rev 66922)
+++ trunk/base/src/port1.0/portmain.tcl	2010-04-26 00:04:01 UTC (rev 66923)
@@ -84,25 +84,14 @@
 default install.group {${portutil::autoconf::install_group}}
 
 # Platform Settings
-set os_arch $tcl_platform(machine)
-if {$os_arch == "Power Macintosh"} { set os_arch "powerpc" }
-if {$os_arch == "i586" || $os_arch == "i686" || $os_arch == "x86_64"} { set os_arch "i386" }
-set os_version $tcl_platform(osVersion)
-set os_major [lindex [split $os_version .] 0]
-set os_platform [string tolower $tcl_platform(os)]
-
 default os.platform {$os_platform}
 default os.version {$os_version}
 default os.major {$os_major}
 default os.arch {$os_arch}
-# Remove trailing "Endian"
-default os.endian {[string range $tcl_platform(byteOrder) 0 end-6]}
+default os.endian {$os_endian}
 
-set macosx_version {}
 set macosx_version_text {}
-if {$os_platform == "darwin"} {
-    # This will probably break when Apple changes versioning
-    set macosx_version [expr 10.0 + ($os_major - 4) / 10.0]
+if {[option os.platform] == "darwin"} {
     set macosx_version_text "(Mac OS X ${macosx_version}) "
 }
 ui_debug "OS [option os.platform]/[option os.version] ${macosx_version_text}arch [option os.arch]"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100425/47c6a82c/attachment.html>


More information about the macports-changes mailing list