[113478] trunk/base

raimue at macports.org raimue at macports.org
Sun Nov 17 04:54:58 PST 2013


Revision: 113478
          https://trac.macports.org/changeset/113478
Author:   raimue at macports.org
Date:     2013-11-17 04:54:58 -0800 (Sun, 17 Nov 2013)
Log Message:
-----------
Check if the current platform is compatible

If the platform is not the same as confgure was run on, error out and refer to
the migration instructions in the wiki.

https://lists.macosforge.org/pipermail/macports-dev/2013-November/024948.html

Modified Paths:
--------------
    trunk/base/aclocal.m4
    trunk/base/configure
    trunk/base/configure.ac
    trunk/base/src/macports1.0/macports.tcl
    trunk/base/src/macports1.0/macports_autoconf.tcl.in

Modified: trunk/base/aclocal.m4
===================================================================
--- trunk/base/aclocal.m4	2013-11-17 12:11:06 UTC (rev 113477)
+++ trunk/base/aclocal.m4	2013-11-17 12:54:58 UTC (rev 113478)
@@ -1150,3 +1150,29 @@
 	CPPFLAGS=$mp_check_sqlite_version_cppflags_save
 ])
 
+#------------------------------------------------------------------------
+# MP_TCL_PLATFORM --
+#
+#       Export target platform and major version
+#
+# Arguments:
+#       none.
+#
+# Requires:
+#       TCLSH must be set.
+#
+# Depends:
+#       none.
+#
+# Results:
+#       Defines OS_PLATFORM and OS_MAJOR.
+#
+#------------------------------------------------------------------------
+AC_DEFUN([MP_TCL_PLATFORM],[
+        AC_MSG_CHECKING([for Tcl target platform])
+        OS_PLATFORM=`echo 'puts -nonewline [[string tolower \$tcl_platform(os)]]' | $TCLSH`
+        OS_MAJOR=`echo 'puts -nonewline [[lindex [split \$tcl_platform(osVersion) .] 0]]' | $TCLSH`
+        AC_MSG_RESULT($OS_PLATFORM $OS_MAJOR)
+        AC_SUBST(OS_PLATFORM)
+        AC_SUBST(OS_MAJOR)
+])

Modified: trunk/base/configure
===================================================================
--- trunk/base/configure	2013-11-17 12:11:06 UTC (rev 113477)
+++ trunk/base/configure	2013-11-17 12:54:58 UTC (rev 113478)
@@ -647,6 +647,8 @@
 LDFLAGS_LIBCURL
 CFLAGS_LIBCURL
 CURL_CONFIG
+OS_MAJOR
+OS_PLATFORM
 TCLSH
 TCL_INCLUDES
 TCL_STUB_LIB_SPEC
@@ -9360,6 +9362,18 @@
 
 
 
+# Substitute Tcl platform for base compatibility check
+
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Tcl target platform" >&5
+$as_echo_n "checking for Tcl target platform... " >&6; }
+        OS_PLATFORM=`echo 'puts -nonewline [string tolower \$tcl_platform(os)]' | $TCLSH`
+        OS_MAJOR=`echo 'puts -nonewline [lindex [split \$tcl_platform(osVersion) .] 0]' | $TCLSH`
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OS_PLATFORM $OS_MAJOR" >&5
+$as_echo "$OS_PLATFORM $OS_MAJOR" >&6; }
+
+
+
+
 # Check for Tcl package path
 
 

Modified: trunk/base/configure.ac
===================================================================
--- trunk/base/configure.ac	2013-11-17 12:11:06 UTC (rev 113477)
+++ trunk/base/configure.ac	2013-11-17 12:54:58 UTC (rev 113478)
@@ -284,6 +284,9 @@
 # Check for tclsh binary
 MP_PROG_TCLSH
 
+# Substitute Tcl platform for base compatibility check
+MP_TCL_PLATFORM
+
 # Check for Tcl package path
 MP_TCL_PACKAGE_DIR
 

Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl	2013-11-17 12:11:06 UTC (rev 113477)
+++ trunk/base/src/macports1.0/macports.tcl	2013-11-17 12:54:58 UTC (rev 113478)
@@ -600,6 +600,13 @@
         set macosx_version [exec sw_vers -productVersion | cut -f1,2 -d.]
     }
 
+    # Check that the current platform is the one we were configured for, otherwise need to do migration
+    if {($os_platform != $macports::autoconf::os_platform) || ($os_major != $macports::autoconf::os_major)} {
+        ui_error "Current platform \"$os_platform $os_major\" does not match expected platform \"$macports::autoconf::os_platform $macports::autoconf::os_major\""
+        ui_error "If you upgraded your OS, please follow the migration instructions: https://trac.macports.org/wiki/Migration"
+        return -code error "OS platform mismatch"
+    }
+
     # Ensure that the macports user directory (i.e. ~/.macports) exists if HOME is defined.
     # Also save $HOME for later use before replacing it with our own.
     if {[info exists env(HOME)]} {

Modified: trunk/base/src/macports1.0/macports_autoconf.tcl.in
===================================================================
--- trunk/base/src/macports1.0/macports_autoconf.tcl.in	2013-11-17 12:11:06 UTC (rev 113477)
+++ trunk/base/src/macports1.0/macports_autoconf.tcl.in	2013-11-17 12:54:58 UTC (rev 113478)
@@ -53,4 +53,6 @@
     variable xar_path "@XAR@"
     variable xcode_select_path "@XCODE_SELECT@"
     variable xcodebuild_path "@XCODEBUILD@"
+    variable os_platform "@OS_PLATFORM@"
+    variable os_major "@OS_MAJOR@"
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20131117/d21c604e/attachment.html>


More information about the macports-changes mailing list