Changeset 25157


Ignore:
Timestamp:
May 15, 2007, 6:05:13 AM (13 years ago)
Author:
eridius@…
Message:

I don't think we have any ports that use non-ASCII charas in their description, but just to be safe explicitly declare open file descriptors to be utf-8.
Also remove some completely useless catch statements - why catch when you re-raise the error on the next line with no processing?

Location:
trunk/base/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/darwinports1.0/darwinports.tcl

    r25146 r25157  
    292292                        set portconf $file
    293293                        set fd [open $file r]
     294                        fconfigure $fd -encoding utf-8
    294295                        while {[gets $fd line] >= 0} {
    295296                                if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
     
    313314        if [file exists $per_user] {
    314315                set fd [open $per_user r]
     316                fconfigure $fd -encoding utf-8
    315317                while {[gets $fd line] >= 0} {
    316318                        if {[regexp {^(\w+)([ \t]+(.*))?$} $line match option ignore val] == 1} {
     
    326328        return -code error "sources_conf must be set in $dports_conf_path/ports.conf or in $macports_user_dir/ports.conf"
    327329    }
    328     if {[catch {set fd [open $sources_conf r]} result]} {
    329         return -code error "$result"
    330     }
     330    set fd [open $sources_conf r]
     331    fconfigure $fd -encoding utf-8
    331332    while {[gets $fd line] >= 0} {
    332333        set line [string trimright $line]
     
    345346        if {[info exists variants_conf]} {
    346347                if {[file exist $variants_conf]} {
    347                         if {[catch {set fd [open $variants_conf r]} result]} {
    348                                 return -code error "$result"
    349                         }
     348                        set fd [open $variants_conf r]
     349                        fconfigure $fd -encoding utf-8
    350350                        while {[gets $fd line] >= 0} {
    351351                                set line [string trimright $line]
     
    715715    set fetchdir [file join $portdbpath portdirs]
    716716    set fetchfile [file tail $url]
    717     if {[catch {file mkdir $fetchdir} result]} {
    718         return -code error $result
    719     }
     717    file mkdir $fetchdir
    720718    if {![file writable $fetchdir]} {
    721719        return -code error "Port remote fetch failed: You do not have permission to write to $fetchdir"
     
    724722        return -code error "Port remote fetch failed: $result"
    725723    }
    726     if {[catch {cd $fetchdir} result]} {
    727         return -code error $result
    728     }
     724    cd $fetchdir
    729725    if {[catch {exec tar -zxf $fetchfile} result]} {
    730726        return -code error "Port extract failed: $result"
     
    12171213                                set destdir [file dirname [darwinports::getindex $source]]
    12181214
    1219                                 if {[catch {file mkdir $destdir} result]} {
    1220                                         return -code error $result
    1221                                 }
     1215                                file mkdir $destdir
    12221216
    12231217                                # Keep rsync happy with a trailing slash
     
    12361230                        {^https?$|^ftp$} {
    12371231                                set indexfile [darwinports::getindex $source]
    1238                                 if {[catch {file mkdir [file dirname $indexfile]} result]} {
    1239                                         return -code error $result
    1240                                 }
     1232                                file mkdir [file dirname $indexfile]
    12411233                                exec curl -L -s -S -o $indexfile $source/PortIndex
    12421234                        }
     
    12601252                                ui_warn "Can't open index file for source: $source"
    12611253                        } else {
     1254                            fconfigure $fd -encoding utf-8
    12621255                                incr found 1
    12631256                                while {[gets $fd line] >= 0} {
  • trunk/base/src/port/portindex.tcl

    r24631 r25157  
    203203puts "Creating software index in $outdir"
    204204set fd [open [file join $outdir PortIndex] w]
     205fconfigure $fd -encoding utf-8
    205206dporttraverse pindex $directory
    206207close $fd
Note: See TracChangeset for help on using the changeset viewer.