[105019] users/cal/base-rewrite/src/macports2.0

cal at macports.org cal at macports.org
Sun Apr 7 15:00:23 PDT 2013


Revision: 105019
          https://trac.macports.org/changeset/105019
Author:   cal at macports.org
Date:     2013-04-07 15:00:23 -0700 (Sun, 07 Apr 2013)
Log Message:
-----------
macports2.0: continue attempt to rewrite macports1.0

Modified Paths:
--------------
    users/cal/base-rewrite/src/macports2.0/macports.tcl
    users/cal/base-rewrite/src/macports2.0/private.tcl

Modified: users/cal/base-rewrite/src/macports2.0/macports.tcl
===================================================================
--- users/cal/base-rewrite/src/macports2.0/macports.tcl	2013-04-07 20:27:13 UTC (rev 105018)
+++ users/cal/base-rewrite/src/macports2.0/macports.tcl	2013-04-07 22:00:23 UTC (rev 105019)
@@ -63,99 +63,167 @@
 # \li <tt>darwintracelib 1.0</tt>, the implementation of the trace mode features
 #     in MacPorts providing isolation for builds
 namespace eval macports {
-	##
-	# Holds the architecture of the current system. Valid values are
-	# \li \c powerpc, for Power Macintosh systems
-	# \li \c i386, for Intel systems (\c i586, \c i686, \c x86_64)
-	variable os_arch [private::get_os_arch]
+    ##
+    # Holds the architecture of the current system. Valid values are
+    # \li \c powerpc, for Power Macintosh systems
+    # \li \c i386, for Intel systems (\c i586, \c i686, \c x86_64)
+    variable os_arch [private::get_os_arch]
 
-	##
-	# Contains the OS version, e.g. 12.2.0 for OS X 10.8.2 (remember Mountain
-	# Lion is darwin12)
-	variable os_version [private::get_os_version]
+    ##
+    # Contains the OS version, e.g. 12.2.0 for OS X 10.8.2 (remember Mountain
+    # Lion is darwin12)
+    variable os_version [private::get_os_version]
 
-	##
-	# Convenience variable holding the first part of \c os_version
-	variable os_major [private::get_os_major]
+    ##
+    # Convenience variable holding the first part of \c os_version
+    variable os_major [private::get_os_major]
 
-	##
-	# The endianess of the system, either \c little, or \c big, depending on the
-	# CPU type.
-	variable os_endian [private::get_os_endian]
+    ##
+    # The endianess of the system, either \c little, or \c big, depending on the
+    # CPU type.
+    variable os_endian [private::get_os_endian]
 
-	##
-	# The name of the OS of the current system in lowercase. See the output of
-	# <tt>uname -s</tt> on your system for possible values.
-	variable os_platform [private::get_os_platform]
+    ##
+    # The name of the OS of the current system in lowercase. See the output of
+    # <tt>uname -s</tt> on your system for possible values.
+    variable os_platform [private::get_os_platform]
 
-	##
-	# The OS X version number with two digits, e.g. 10.8 for Mountain Lion.
-	# Empty on platforms other than darwin.
-	variable macosx_version [private::get_macosx_version]
+    ##
+    # The OS X version number with two digits, e.g. 10.8 for Mountain Lion.
+    # Empty on platforms other than darwin.
+    variable macosx_version [private::get_macosx_version]
 
-	##
-	# The home directory of the user executing MacPorts, or a non-existant
-	# directory, if the executing user could not be determined.
-	variable user_home
+    ##
+    # The home directory of the user executing MacPorts, or a non-existant
+    # directory, if the executing user could not be determined.
+    variable user_home
 
-	##
-	# Initializes MacPorts and sets all required internal variables.
-	#
-	# \warning
-	# Call this before calling any other method in this namespace. If you call
-	# other methods or read variables without calling \c init first, the result
-	# is undefined.
-	proc init {} {
-		# set the system encoding to utf-8
-		encoding system utf-8
+    ##
+    # Initializes MacPorts and sets all required internal variables.
+    #
+    # \warning
+    # Call this before calling any other method in this namespace. If you call
+    # other methods or read variables without calling \c init first, the result
+    # is undefined.
+    proc init {} {
+        # set the system encoding to utf-8
+        encoding system utf-8
 
-		# initialize private data structures
-		private::init
+        # initialize private data structures
+        private::init
 
-		# Ensure that the macports user directory (i.e. ~/.macports) exists, if
-		# $HOME is defined. Also save $HOME for later use before replacing it
-		# with a custom home directory.
-		private::init_home
-	}
+        # Ensure that the macports user directory (i.e. ~/.macports) exists, if
+        # $HOME is defined. Also save $HOME for later use before replacing it
+        # with a custom home directory.
+        private::init_home
 
-	##
-	# Register a callback for UI communication with the client. If a callback
-	# was previously registered, it is replaced.
-	#
-	# @param[in] callback A callback function, accepting two parameters,
-	#                     priority and message. It will be called for every
-	#                     message MacPorts (or a Portfile) tries to pass to the
-	#                     user. Clients should appropriately filter by priority
-	#                     and display the message to the user.
-	proc register_ui_callback {callback} {
-		set private::ui_callback $callback
-	}
+        # Load configuration from files
+        private::init_configuration
+    }
 
-	##
-	# Frees all resources associated with this instance of MacPorts core, closes
-	# all files and releases all locks that might still be held. Just must call
-	# this after using this API.
-	#
-	# \warning
-	# Not calling this procedure might lead to memory leaks and inconsistent
-	# data in internal state files of MacPorts (e.g., the port registry).
-	proc release {} {}
+    ##
+    # Register a callback for UI communication with the client. If a callback
+    # was previously registered, it is replaced.
+    #
+    # @param[in] callback A callback function, accepting two parameters,
+    #                     priority and message. It will be called for every
+    #                     message MacPorts (or a Portfile) tries to pass to the
+    #                     user. Clients should appropriately filter by priority
+    #                     and display the message to the user.
+    proc register_ui_callback {callback} {
+        set private::ui_callback $callback
+    }
 
-	##
-	# Accessor method for UI settings
-	#
-	# @param[in] key a key identifying the setting to be queried
-	# @return 1, if the option is set, 0 otherwise
-	proc ui {key} {
-		return [util::bool private::ui_options($key)]
-	}
+    ##
+    # Frees all resources associated with this instance of MacPorts core, closes
+    # all files and releases all locks that might still be held. Just must call
+    # this after using this API.
+    #
+    # \warning
+    # Not calling this procedure might lead to memory leaks and inconsistent
+    # data in internal state files of MacPorts (e.g., the port registry).
+    proc release {} {}
 
-	##
-	# Accessor method for MacPorts settings
-	#
-	# @param[in] key a key indentifying the setting to be queried
-	# @return 1, if the option is set, 0 otherwise
-	proc option {key} {
-		return [util::bool private::global_options($key)]
-	}
+    ##
+    # Accessor method for boolean UI settings
+    #
+    # @param[in] key a key identifying the setting to be queried
+    # @return 1, if the option is set, 0 otherwise
+    proc ui_bool {key} {
+        return [util::bool [ui $key]]
+    }
+
+    ##
+    # Acessor method for UI settings
+    #
+    # @param[in] key a key identifying the setting to be queried
+    # @return the setting's value, if it exists or an empty value, if there is
+    #         no setting by that name
+    proc ui {key} {
+        if {[info exists private::ui_options($key)]} {
+            return private::ui_options($key)
+        }
+        return {}
+    }
+
+    ##
+    # Setter method for UI settings
+    #
+    # @param[in] key a key identifying the setting to be changed
+    # @param[in] value the new value to be associated with the given key
+    # @return the old value of the setting, if any. An empty value, if the key
+    #         wasn't associated with a value before
+    proc set_ui {key value} {
+        set old [ui $key]
+        set private::ui_options($key) $value
+        return $old
+    }
+
+    ##
+    # Accessor method for boolean MacPorts settings
+    #
+    # @param[in] key a key indentifying the setting to be queried
+    # @return 1, if the option is set, 0 otherwise
+    proc option_bool {key} {
+        return [util::bool [option $key]]
+    }
+
+    ##
+    # Acessor method for MacPorts settings
+    #
+    # @param[in] key a key identifying the setting to be queried
+    # @return the setting's value, if it exists or an empty value, if there is
+    #         no setting by that name
+    proc option {key} {
+        if {[info exists private::global_options($key)]} {
+            return private::global_options($key)
+        }
+        return {}
+    }
+
+    ##
+    # Setter method for MacPorts settings
+    #
+    # @param[in] key a key identifying the setting to be changed
+    # @param[in] value the new value to be associated with the key
+    # @return the setting's old value, if any, or an empty value, if the
+    #         setting was previously unset
+    proc set_option {key value} {
+        set old [option $key]
+        set private::global_options($key) $value
+        return $old
+    }
+
+    ##
+    # Acessor method for compile-time settings set by autoconf
+    #
+    # @param[in] key a key identifying the setting to be queried
+    # @return the setting's value, if it exists or an empty value, if there is
+    #         no setting by that name
+    proc autoconf {key} {
+        if {[info exists autoconf::$key]} {
+            return autoconf::$key
+        }
+        return {}
+    }
 }

Modified: users/cal/base-rewrite/src/macports2.0/private.tcl
===================================================================
--- users/cal/base-rewrite/src/macports2.0/private.tcl	2013-04-07 20:27:13 UTC (rev 105018)
+++ users/cal/base-rewrite/src/macports2.0/private.tcl	2013-04-07 22:00:23 UTC (rev 105019)
@@ -47,259 +47,402 @@
 #
 # All variables and procedures are subject to change without notice.
 namespace eval macports::private {
-	##
-	# Callback function to be called for all messages printed using
-	# ui_$priority, where $priority is one of the macports::priority::*
-	# constants. Default: none.
-	variable ui_callback {}
+    ##
+    # Callback function to be called for all messages printed using
+    # ui_$priority, where $priority is one of the macports::priority::*
+    # constants. Default: none.
+    variable ui_callback {}
 
-	##
-	# Initialize private variables and other state. If you allocate any
-	# resources here, make sure to free them again in \c private::release.
-	proc init {} {
-	}
+    ##
+    # List of port trees that can be used to install software. An entry in this
+    # list is a tuple of the source URI and a list of flags for this source.
+    # Currently valid flags are default and nosync.
+    variable sources [list]
 
-	##
-	# Teardown method cleaning up any resources allocated in \c private::init.
-	proc release {} {
-	}
+    ##
+    # The default port tree in the same format as the \c sources variable.
+    variable default_source {}
 
-	##
-	# Initialize macports::user_home with the path to the calling user's home
-	# and set the $HOME environment variable so commands using it will not
-	# clutter the user's home, but instead a temporary path created by
-	# MacPorts.
-	proc init_home {} {
-		if {[info exists env(HOME)]} {
-			set macports::user_home $env(HOME)
-			set macports::macports_user_dir \
-				[file normalize $macports::autoconf::macports_user_dir]
-		} elseif {[info exists env(SUDO_USER)] && [get_os_platform] == "darwin"} {
-			set macports::user_home \
-				[exec dscl -q . -read /Users/$env(SUDO_USER) NFSHomeDirectory | cut -d ' ' -f 2]
-			set macports::macports_user_dir \
-				[file join $macports::user_home $macports::autoconf::macports_user_subdir]
-		} elseif {[exec id -u] != 0 && [get_os_platform] == "darwin"} {
-			set macports::user_home \
-				[exec dscl -q . -read /Users/[exec id -un] NFSHomeDirectory | cut -d ' ' -f 2]
-			set macports::macports_user_dir \
-				[file join $macports::user_home $macports::autoconf::macports_user_subdir]
-		} else {
-			# Otherwise define the user directory as a directory that will never exist
-			set macports::user_home         "/dev/null/NO_HOME_DIR"
-			set macports::macports_user_dir "/dev/null/NO_HOME_DIR"
-		}
-	}
+    ##
+    # Initialize private variables and other state. If you allocate any
+    # resources here, make sure to free them again in \c private::release.
+    proc init {} {
+    }
 
-	##
-	# Returns an architecture string from the \c $::tcl_platform array after
-	# some mangling to bring it to a canonical format.
-	#
-	# @return \c powerpc on systems with a PPC CPU, i386 on systems with
-	#          a Intel CPU. Return value on other systems is undefined at the
-	#          moment.
-	proc get_os_arch {} {
-		if {[info exists macports::os_arch]} {
-			return $macports::os_arch
-		}
-		switch -exact -- $::tcl_platform(machine) {
-			x86_64 -
-			i686 -
-			i586 {
-				return i386
-			}
-			{Power Macintosh} {
-				return powerpc
-			}
-		}
-		return $::tcl_platform(machine)
-	}
+    ##
+    # Teardown method cleaning up any resources allocated in \c private::init.
+    proc release {} {
+    }
 
-	##
-	# Returns the OS version from the \c $::tcl_platform array.
-	#
-	# @return a version string representing the OS X version, e.g. \c 12.2.0
-	#         for OS X 10.8.2 (because Mountain Lion is darwin 12)
-	proc get_os_version {} {
-		if {[info exists macports::os_version]} {
-			return $macports::os_version
-		}
-		return $::tcl_platform(osVersion)
-	}
+    ##
+    # Initialize macports::option user_home with the path to the calling user's
+    # home and set the $HOME environment variable so commands using it will not
+    # clutter the user's home, but instead a temporary path created by
+    # MacPorts.
+    proc init_home {} {
+        if {[info exists env(HOME)]} {
+            macports::set_option user_home $env(HOME)
+            macports::set_option user_dir [file normalize [macports::autoconf user_dir]]
+        } elseif {[info exists env(SUDO_USER)] && [get_os_platform] == "darwin"} {
+            macports::set_option user_home \
+                [exec dscl -q . -read /Users/$env(SUDO_USER) NFSHomeDirectory | cut -d ' ' -f 2]
+            macports::set_option user_dir \
+                [file join [macports::option user_home] [macports::autoconf user_subdir]]
+        } elseif {[exec id -u] != 0 && [get_os_platform] == "darwin"} {
+            macports::set_option user_home \
+                [exec dscl -q . -read /Users/[exec id -un] NFSHomeDirectory | cut -d ' ' -f 2]
+            macports::set_option user_dir \
+                [file join [macports::option user_home] [macports::autoconf user_subdir]]
+        } else {
+            # Otherwise define the user directory as a directory that will never exist
+            macports::set_option user_home "/dev/null/NO_HOME_DIR"
+            macports::set_option user_dir  "/dev/null/NO_HOME_DIR"
+        }
+    }
 
-	##
-	# Returns the major version number of the OS version from the \c
-	# $::tcl_platform array.
-	#
-	# @return the result of \c get_os_version cut off at the first dot
-	proc get_os_major {} {
-		if {[info exists macports::os_major]} {
-			return $macports::os_major
-		}
-		return [lindex [split [get_os_version] .] 0]
-	}
+    ##
+    # Locate and load any configuration files.
+    proc init_configuration {} {
+        # Run configuration files in conf_path and user_dir
+        set global_conf_file "[macports::autoconf conf_path]/macports.conf"
+        set user_conf_file "[macports::option user_dir]/macports.conf"
+        load_config_file $bootstrap_options $global_conf_file
+        load_config_file $bootstrap_options $user_conf_file
 
-	##
-	# Returns the endianess of the system from the \c $::tcl_platform array.
-	# Valid return values are either \c little or \c big.
-	#
-	# @return one of the strings \c little and \c big
-	proc get_os_endian {} {
-		if {[info exists macports::os_endian]} {
-			return $macports::os_endian
-		}
-		return [string map {Endian {}} $::tcl_platform(byteOrder)]
-	}
+        # Load the user configuration file, if it exists
+        load_conf_file $user_options "[macports::option user_dir]/user.conf"
 
-	##
-	# Returns the platform (i.e., the OS name) of the current system in
-	# lowercase. Some common values are:
-	# \li \c darwin, for OS X
-	# \li \c freebsd, for Free BSD
-	# \li \c linux, for Linux
-	#
-	# @return the value of <tt>uname -s</tt> in lowercase
-	proc get_os_platform {} {
-		if {[info exists macports::os_platform]} {
-			return $macports::os_platform
-		}
-		return [string tolower $::tcl_platform(os)]
-	}
+        # Load the sources.conf and thus the available port trees
+        load_sources
+    }
 
-	##
-	# Returns the OS X version number with two digits of accuracy, e.g. "10.8"
-	# on Mountain Lion systems. On systems other than darwin, returns an empty
-	# string.
-	#
-	# @return OS X version number or empty string
-	proc get_macosx_version {} {
-		if {[info exists macports::macosx_version]} {
-			return $macports::macosx_version
-		}
-		if {[get_os_platform] != "darwin"} {
-			return {}
-		}
-		return [expr 10.0 + ([get_os_major] - 4) / 10.0]
-	}
+    ##
+    # Load a given configuration file and process its options, if they are in
+    # valid_options. Will raise a warning when a file exists but could not be
+    # opened for reading, or a file contains an invalid option.
+    #
+    # @param[in] valid_options list of valid configuration options for the
+    #                          given configuration file. A warning is
+    #                          generated, if a configuration option was not in
+    #                          the list of accepted options.
+    # @param[in] file name of a possible configuration file. Will be ignored if
+    #                 it doesn't exist.
+    # @return 1, if the file doesn't exist or could not be opened, 0 otherwise.
+    proc load_config_file {valid_options file} {
+        if {![file exists $file]} {
+            return 1
+        }
+        if {[catch {set fd [open $file r]} result]} {
+            macports::msg \
+                macports::priority::warn \
+                "Could not open configuration file %s for reading: %s" \
+                $file $result
+            return 1
+        }
+        set lineno 0
+        while {[gets $fd line] >= 0} {
+            incr lineno
+            if {[regexp {^(\w+)(?:[ \t]+(.*))?$} $line match option val] == 1} {
+                if {[lsearch -exact $valid_options $option] >= 0} {
+                    macports::set_option $option [string trim $val]
+                } else {
+                    macports::msg \
+                        macports::priority::warn \
+                        "Ignoring unknown configuration option `%s' in configuration file %s:%d." \
+                        $option $file $lineno
+                }
+            }
+        }
+        close $fd
+        return 0
+    }
 
-	variable bootstrap_options [list\
-		portdbpath\
-		libpath\
-		binpath\
-		auto_path\
-		extra_env\
-		sources_conf\
-		prefix\
-		portdbformat\
-		portarchivetype\
-		portautoclean\
-		porttrace\
-		portverbose\
-		keeplogs\
-		destroot_umask\
-		variants_conf\
-		rsync_server\
-		rsync_options\
-		rsync_dir\
-		startupitem_type\
-		startupitem_install\
-		place_worksymlink\
-		xcodeversion\
-		xcodebuildcmd\
-		configureccache\
-		ccache_dir\
-		ccache_size\
-		configuredistcc\
-		configurepipe\
-		buildnicevalue\
-		buildmakejobs\
-		applications_dir\
-		frameworks_dir\
-		developer_dir\
-		universal_archs\
-		build_arch\
-		macosx_deployment_target\
-		macportsuser\
-		proxy_override_env\
-		proxy_http\
-		proxy_https\
-		proxy_ftp\
-		proxy_rsync\
-		proxy_skip\
-		master_site_local\
-		patch_site_local\
-		archive_site_local\
-		buildfromsource\
-		revupgrade_autorun\
-		revupgrade_mode\
-		revupgrade_check_id_loadcmds\
-		host_blacklist\
-		preferred_hosts\
-		packagemaker_path\
-		default_compilers\
-	]
+    ##
+    # Load the list of sources from the sources_conf specified in MacPorts
+    # options and initializes the \c sources and \c default_source variables.
+    # Throws after printing an error message, if the \c sources_conf isn't set
+    # or empty or the file cannot be opened. Also prints an error message and
+    # throws, if no sources are configured.
+    proc load_sources {} {
+        variable sources
+        variable default_source
 
-	variable user_options [list]
+        if {[macports::option sources_conf] == {}} {
+            macports::msg macports::priority::error \
+                "sources_conf must be set in %s or %s." \
+                $global_conf_file $user_conf_file
+            error "sources_conf not set"
+        }
 
-	variable portinterp_options [concat user_options [list\
-		portdbpath\
-		porturl\
-		portpath\
-		portbuildpath\
-		auto_path\
-		prefix\
-		prefix_frozen\
-		portsharepath\
-		registry.path\
-		registry.format\
-		user_home\
-		portarchivetype\
-		archivefetch_pubkeys\
-		portautoclean\
-		porttrace\
-		keeplogs\
-		portverbose\
-		destroot_umask\
-		rsync_server\
-		rsync_options\
-		rsync_dir\
-		startupitem_type\
-		startupitem_install\
-		place_worksymlink\
-		macportsuser\
-		configureccache\
-		ccache_dir\
-		ccache_size\
-		configuredistcc\
-		configurepipe\
-		buildnicevalue\
-		buildmakejobs\
-		applications_dir\
-		current_phase\
-		frameworks_dir\
-		developer_dir\
-		universal_archs\
-		build_arch\
-		os_arch\
-		os_endian\
-		os_version\
-		os_major\
-		os_platform\
-		macosx_version\
-		macosx_deployment_target\
-		packagemaker_path\
-		default_compilers\
-	]]
+        # Load sources_conf
+        if {catch {set fd [open [macports::option sources_conf] r]} result} {
+            macports::msg macports::priority::error \
+                "Can't open sources_conf %s: %s." \
+                [macports::option sources_conf] $result
+            error "error opening sources_conf"
+        }
 
-	variable deferred_options [list\
-		xcodeversion\
-		xcodebuildcmd\
-		developer_dir\
-	]
+        set lineno 0
+        while {[gets $fd line] >= 0} {
+            incr lineno
+            set line [string trim $line]
+            if {[regexp {^#|^$} $line]} {
+                # ignore comment lines
+                continue
+            }
+            if {[regexp {^(\w+://\S+)(?:\s+\[(\w+(?:, *\w+)*)\])?\s*$} $line -> url flags]} {
+                set flags [split $flags ", "]
+                foreach flag $flags {
+                    if {[lsearch -exact [list nosync default] $flag] == -1} {
+                        macports::msg macports::priority::warning \
+                            "Invalid source flag `%s' in %s:%d." \
+                            $flag [macports::option sources_conf] $lineno
+                    }
+                    if {$flag == "default"} {
+                        if {$default_source != {}} {
+                            macports::msg macports::priority::warning \
+                                "Multiple default sources specified in %s:%d." \
+                                [macports::option sources_conf] $lineno
+                            set default_source [concat [list $url] $flags]
+                        }
+                    }
+                }
+                lappend sources [concat [list $url] $flags]
+            } else {
+                macports::msg macports::priority::warning \
+                    "Ignoring invalid source `%s' in %s:%d." \
+                    $line [macports::option sources_conf] $lineno
+            }
+        }
+        close $fd
 
-	variable open_ports {}
+        # Throw an error when no sources are defined.
+        if {[llength $sources] == 0} {
+            macports::msg macports::priority::error \
+                "No sources are defined in %s. Cannot continue without a ports tree." \
+                [macports::options sources_conf]
+            error "no port sources available"
+        }
 
-	variable ui_priorities {error warn msg notice info debug any}
-	variable ui_prefix {---> }
-	variable current_phase {main}
+        # Make sure the default port source is defined. Otherwise
+        # macports::getportresourcepath fails when the first source doesn't
+        # contain _resources.
+        if {$default_source == {}} {
+            macports::msg macports::priority::warning \
+                "No default port source specified in %s, using last source as default." \
+                [macports::options sources_conf]
+            set default_source [lindex $sources end]
+        }
+    }
+
+    ##
+    # Returns an architecture string from the \c $::tcl_platform array after
+    # some mangling to bring it to a canonical format.
+    #
+    # @return \c powerpc on systems with a PPC CPU, i386 on systems with
+    #          a Intel CPU. Return value on other systems is undefined at the
+    #          moment.
+    proc get_os_arch {} {
+        if {[info exists macports::os_arch]} {
+            return $macports::os_arch
+        }
+        switch -exact -- $::tcl_platform(machine) {
+            x86_64 -
+            i686 -
+            i586 {
+                return i386
+            }
+            {Power Macintosh} {
+                return powerpc
+            }
+        }
+        return $::tcl_platform(machine)
+    }
+
+    ##
+    # Returns the OS version from the \c $::tcl_platform array.
+    #
+    # @return a version string representing the OS X version, e.g. \c 12.2.0
+    #         for OS X 10.8.2 (because Mountain Lion is darwin 12)
+    proc get_os_version {} {
+        if {[info exists macports::os_version]} {
+            return $macports::os_version
+        }
+        return $::tcl_platform(osVersion)
+    }
+
+    ##
+    # Returns the major version number of the OS version from the \c
+    # $::tcl_platform array.
+    #
+    # @return the result of \c get_os_version cut off at the first dot
+    proc get_os_major {} {
+        if {[info exists macports::os_major]} {
+            return $macports::os_major
+        }
+        return [lindex [split [get_os_version] .] 0]
+    }
+
+    ##
+    # Returns the endianess of the system from the \c $::tcl_platform array.
+    # Valid return values are either \c little or \c big.
+    #
+    # @return one of the strings \c little and \c big
+    proc get_os_endian {} {
+        if {[info exists macports::os_endian]} {
+            return $macports::os_endian
+        }
+        return [string map {Endian {}} $::tcl_platform(byteOrder)]
+    }
+
+    ##
+    # Returns the platform (i.e., the OS name) of the current system in
+    # lowercase. Some common values are:
+    # \li \c darwin, for OS X
+    # \li \c freebsd, for Free BSD
+    # \li \c linux, for Linux
+    #
+    # @return the value of <tt>uname -s</tt> in lowercase
+    proc get_os_platform {} {
+        if {[info exists macports::os_platform]} {
+            return $macports::os_platform
+        }
+        return [string tolower $::tcl_platform(os)]
+    }
+
+    ##
+    # Returns the OS X version number with two digits of accuracy, e.g. "10.8"
+    # on Mountain Lion systems. On systems other than darwin, returns an empty
+    # string.
+    #
+    # @return OS X version number or empty string
+    proc get_macosx_version {} {
+        if {[info exists macports::macosx_version]} {
+            return $macports::macosx_version
+        }
+        if {[get_os_platform] != "darwin"} {
+            return {}
+        }
+        return [expr 10.0 + ([get_os_major] - 4) / 10.0]
+    }
+
+    variable bootstrap_options [list\
+        portdbpath\
+        libpath\
+        binpath\
+        auto_path\
+        extra_env\
+        sources_conf\
+        prefix\
+        portdbformat\
+        portarchivetype\
+        portautoclean\
+        porttrace\
+        portverbose\
+        keeplogs\
+        destroot_umask\
+        variants_conf\
+        rsync_server\
+        rsync_options\
+        rsync_dir\
+        startupitem_type\
+        startupitem_install\
+        place_worksymlink\
+        xcodeversion\
+        xcodebuildcmd\
+        configureccache\
+        ccache_dir\
+        ccache_size\
+        configuredistcc\
+        configurepipe\
+        buildnicevalue\
+        buildmakejobs\
+        applications_dir\
+        frameworks_dir\
+        developer_dir\
+        universal_archs\
+        build_arch\
+        macosx_deployment_target\
+        macportsuser\
+        proxy_override_env\
+        proxy_http\
+        proxy_https\
+        proxy_ftp\
+        proxy_rsync\
+        proxy_skip\
+        master_site_local\
+        patch_site_local\
+        archive_site_local\
+        buildfromsource\
+        revupgrade_autorun\
+        revupgrade_mode\
+        revupgrade_check_id_loadcmds\
+        host_blacklist\
+        preferred_hosts\
+        packagemaker_path\
+        default_compilers\
+    ]
+
+    variable user_options [list]
+
+    variable portinterp_options [concat user_options [list\
+        portdbpath\
+        porturl\
+        portpath\
+        portbuildpath\
+        auto_path\
+        prefix\
+        prefix_frozen\
+        portsharepath\
+        registry.path\
+        registry.format\
+        user_home\
+        portarchivetype\
+        archivefetch_pubkeys\
+        portautoclean\
+        porttrace\
+        keeplogs\
+        portverbose\
+        destroot_umask\
+        rsync_server\
+        rsync_options\
+        rsync_dir\
+        startupitem_type\
+        startupitem_install\
+        place_worksymlink\
+        macportsuser\
+        configureccache\
+        ccache_dir\
+        ccache_size\
+        configuredistcc\
+        configurepipe\
+        buildnicevalue\
+        buildmakejobs\
+        applications_dir\
+        current_phase\
+        frameworks_dir\
+        developer_dir\
+        universal_archs\
+        build_arch\
+        os_arch\
+        os_endian\
+        os_version\
+        os_major\
+        os_platform\
+        macosx_version\
+        macosx_deployment_target\
+        packagemaker_path\
+        default_compilers\
+    ]]
+
+    variable deferred_options [list\
+        xcodeversion\
+        xcodebuildcmd\
+        developer_dir\
+    ]
+
+    variable open_ports {}
+
+    variable ui_prefix {---> }
+    variable current_phase {main}
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130407/57570fcf/attachment-0001.html>


More information about the macports-changes mailing list