[24071] trunk/base

source_changes at macosforge.org source_changes at macosforge.org
Sun Apr 15 21:09:42 PDT 2007


Revision: 24071
          http://trac.macosforge.org/projects/macports/changeset/24071
Author:   jberry at macports.org
Date:     2007-04-15 21:09:41 -0700 (Sun, 15 Apr 2007)

Log Message:
-----------
Add per-user preferences in ~/.macports/user.conf. This will be used for submitter information.
Simplify selection of ports.conf file:
	- ~/.portsrc is no longer supported.
	- Search order for ports.conf is now:
		- PORTSRC
		- ~/.macports/ports.conf
		- ${prefix}/etc/ports.conf
	  Only the first file found will be parsed and used.

Modified Paths:
--------------
    trunk/base/ChangeLog
    trunk/base/src/darwinports1.0/darwinports.tcl

Modified: trunk/base/ChangeLog
===================================================================
--- trunk/base/ChangeLog	2007-04-16 03:46:31 UTC (rev 24070)
+++ trunk/base/ChangeLog	2007-04-16 04:09:41 UTC (rev 24071)
@@ -7,6 +7,15 @@
 	
 (unreleased):
 
+	- Add per-user preferences in ~/.macports/user.conf. This will be used
+	  for submitter information.
+	  Simplify selection of ports.conf file:
+	  	- ~/.portsrc is no longer supported.
+	  	- Search order for ports.conf is now:
+	  		- PORTSRC
+	  		- ~/.macports/ports.conf
+	  		- ${prefix}/etc/ports.conf
+	  	  Only the first file found will be parsed and used.
 
 Release 1.4.1 (14-Apr-2007):
 

Modified: trunk/base/src/darwinports1.0/darwinports.tcl
===================================================================
--- trunk/base/src/darwinports1.0/darwinports.tcl	2007-04-16 03:46:31 UTC (rev 24070)
+++ trunk/base/src/darwinports1.0/darwinports.tcl	2007-04-16 04:09:41 UTC (rev 24071)
@@ -36,9 +36,20 @@
 package require darwinports_index 1.0
 
 namespace eval darwinports {
-    namespace export bootstrap_options portinterp_options open_dports ui_priorities
-    variable bootstrap_options "portdbpath libpath binpath auto_path extra_env sources_conf prefix portdbformat portinstalltype portarchivemode portarchivepath portarchivetype portautoclean porttrace portverbose destroot_umask variants_conf rsync_server rsync_options rsync_dir startupitem_type xcodeversion xcodebuildcmd"
-    variable portinterp_options "portdbpath portpath portbuildpath auto_path prefix portsharepath registry.path registry.format registry.installtype portarchivemode portarchivepath portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server rsync_options rsync_dir startupitem_type"
+    namespace export bootstrap_options user_options portinterp_options open_dports ui_priorities
+    variable bootstrap_options "\
+    	portdbpath libpath binpath auto_path extra_env sources_conf prefix portdbformat \
+    	portinstalltype portarchivemode portarchivepath portarchivetype portautoclean \
+    	porttrace portverbose destroot_umask variants_conf rsync_server rsync_options \
+    	rsync_dir startupitem_type xcodeversion xcodebuildcmd"
+    variable user_options "submitter_name submitter_email submitter_key"
+    variable portinterp_options "\
+    	portdbpath portpath portbuildpath auto_path prefix portsharepath \
+    	registry.path registry.format registry.installtype portarchivemode portarchivepath \
+    	portarchivetype portautoclean porttrace portverbose destroot_umask rsync_server \
+    	rsync_options rsync_dir startupitem_type \
+    	$user_options"
+    	
     # deferred options are only computed when needed.
     # they are not exported to the trace thread.
     # they are not exported to the interpreter in system_options array.
@@ -172,6 +183,7 @@
 	global auto_path env
 	global darwinports::autoconf::dports_conf_path
 	global darwinports::bootstrap_options
+	global darwinports::user_options
 	global darwinports::extra_env
 	global darwinports::portconf
 	global darwinports::portdbpath
@@ -191,48 +203,46 @@
    	global darwinports::variants_conf
    	global darwinports::xcodebuildcmd
    	global darwinports::xcodeversion
-
-    # first look at PORTSRC for testing/debugging
+   	
+   	# Configure the search path for configuration files
+   	set conf_files ""
     if {[llength [array names env PORTSRC]] > 0} {
-	set PORTSRC [lindex [array get env PORTSRC] 1]
-	if {[file isfile ${PORTSRC}]} {
-	    set portconf ${PORTSRC}
-	    lappend conf_files ${portconf}
-	}
+		set PORTSRC [lindex [array get env PORTSRC] 1]
+		lappend conf_files ${PORTSRC}
     }
-
-    # then look in ~/.portsrc
-    if {![info exists portconf]} {
-	if {[llength [array names env HOME]] > 0} {
-	    set HOME [lindex [array get env HOME] 1]
-	    if {[file isfile [file join ${HOME} .portsrc]]} {
-		set portconf [file join ${HOME} .portsrc]
-		lappend conf_files ${portconf}
-	    }
+    lappend conf_files "~/.macports/ports.conf" "${dports_conf_path}/ports.conf"
+    
+    # Process the first configuration file we find on conf_files list
+	foreach file $conf_files {
+		if [file exists $file] {
+			set fd [open $file r]
+			while {[gets $fd line] >= 0} {
+				if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
+					if {[lsearch $bootstrap_options $option] >= 0} {
+						set darwinports::$option $val
+						global darwinports::$option
+					}
+				}
+			}
+			
+			break
+		}
 	}
-    }
-
-    # finally ${prefix}/etc/ports/ports.conf, or whatever path was configured
-    if {![info exists portconf]} {
-	if {[file isfile $dports_conf_path/ports.conf]} {
-	    set portconf $dports_conf_path/ports.conf
-	    lappend conf_files $dports_conf_path/ports.conf
+	
+	# Process per-user only settings
+	set per_user "~/.macports/user.conf"
+	if [file exists $per_user] {
+		set fd [open $per_user r]
+		while {[gets $fd line] >= 0} {
+			if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
+				if {[lsearch $user_options $option] >= 0} {
+					set darwinports::$option $val
+					global darwinports::$option
+				}
+			}
+		}
 	}
-    }
-    if {[info exists conf_files]} {
-	foreach file $conf_files {
-	    set fd [open $file r]
-	    while {[gets $fd line] >= 0} {
-		foreach option $bootstrap_options {
-		    if {[regexp "^$option\[ \t\]+(\[A-Za-z0-9_:,\./-\].+$)" $line match val] == 1} {
-			set darwinports::$option $val
-			global darwinports::$option
-		    }
-		}
-	    }
-        }
-    }
-
+	
     if {![info exists sources_conf]} {
         return -code error "sources_conf must be set in $dports_conf_path/ports.conf or in your ~/.portsrc"
     }

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-changes/attachments/20070415/19e6ebd8/attachment.html


More information about the macports-changes mailing list