[25975] trunk/base

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 7 21:38:40 PDT 2007


Revision: 25975
          http://trac.macosforge.org/projects/macports/changeset/25975
Author:   eridius at macports.org
Date:     2007-06-07 21:38:39 -0700 (Thu, 07 Jun 2007)

Log Message:
-----------
Fix the encoding issues. No more fconfigure, instead just set the system encoding to utf-8 in dportinit

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

Modified: trunk/base/ChangeLog
===================================================================
--- trunk/base/ChangeLog	2007-06-08 03:35:17 UTC (rev 25974)
+++ trunk/base/ChangeLog	2007-06-08 04:38:39 UTC (rev 25975)
@@ -6,6 +6,10 @@
 
 (unreleased)
 
+    - Handles encodings properly now. All Portfiles and .conf files are assumed
+      to be utf-8, and reading them or calling portindex(1) should now work
+      the same on all locales (ticket #11978, eridius r25975).
+
     - Add support for decoding of obscured maintainer addresses.
       We support two types of obscured addresses in Portfile maintainers field:
          (1) username ==> implies username at macports.org

Modified: trunk/base/src/darwinports1.0/darwinports.tcl
===================================================================
--- trunk/base/src/darwinports1.0/darwinports.tcl	2007-06-08 03:35:17 UTC (rev 25974)
+++ trunk/base/src/darwinports1.0/darwinports.tcl	2007-06-08 04:38:39 UTC (rev 25975)
@@ -266,6 +266,9 @@
    	global darwinports::variants_conf
    	global darwinports::xcodebuildcmd
    	global darwinports::xcodeversion
+    
+    # Set the system encoding to utf-8
+    encoding system utf-8
    	
     # Ensure that the macports user directory exists if HOME is defined
     if {[info exists env(HOME)]} {
@@ -298,7 +301,6 @@
 		if [file exists $file] {
 			set portconf $file
 			set fd [open $file r]
-			fconfigure $fd -encoding utf-8
 			while {[gets $fd line] >= 0} {
 				if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
 					if {[regexp {^"(.*)"[ \t]*$} $val match val2] == 1} {
@@ -320,7 +322,6 @@
 	set per_user "${macports_user_dir}/user.conf"
 	if [file exists $per_user] {
 		set fd [open $per_user r]
-		fconfigure $fd -encoding utf-8
 		while {[gets $fd line] >= 0} {
 			if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
 				if {[lsearch $user_options $option] >= 0} {
@@ -335,7 +336,6 @@
         return -code error "sources_conf must be set in $dports_conf_path/ports.conf or in $macports_user_dir/ports.conf"
     }
     set fd [open $sources_conf r]
-    fconfigure $fd -encoding utf-8
     while {[gets $fd line] >= 0} {
         set line [string trimright $line]
         if {![regexp {^\s*#|^$} $line]} {
@@ -363,7 +363,6 @@
 	if {[info exists variants_conf]} {
 		if {[file exist $variants_conf]} {
 			set fd [open $variants_conf r]
-			fconfigure $fd -encoding utf-8
 			while {[gets $fd line] >= 0} {
 				set line [string trimright $line]
 				if {![regexp {^[\ \t]*#.*$|^$} $line]} {
@@ -1290,7 +1289,6 @@
 			if {[catch {set fd [open [darwinports::getindex $source] r]} result]} {
 				ui_warn "Can't open index file for source: $source"
 			} else {
-			    fconfigure $fd -encoding utf-8
 				incr found 1
 				while {[gets $fd line] >= 0} {
 					array unset portinfo

Modified: trunk/base/src/port/portindex.tcl
===================================================================
--- trunk/base/src/port/portindex.tcl	2007-06-08 03:35:17 UTC (rev 25974)
+++ trunk/base/src/port/portindex.tcl	2007-06-08 04:38:39 UTC (rev 25975)
@@ -202,7 +202,6 @@
 
 puts "Creating software index in $outdir"
 set fd [open [file join $outdir PortIndex] w]
-fconfigure $fd -encoding utf-8
 dporttraverse pindex $directory
 close $fd
 puts "\nTotal number of ports parsed:\t$stats(total)\

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


More information about the macports-changes mailing list