Ticket #289: portindex.tcl.2.diff

File portindex.tcl.2.diff, 2.8 KB (added by jpm@…, 22 years ago)

diff to catch interp exception

  • base/src/port/portindex.tcl

    RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port/portindex.tcl,v
    retrieving revision 1.12
    diff -u -r1.12 portindex.tcl
     
    3939
    4040proc pindex {portdir} {
    4141    global target fd directory archive outdir
    42     set interp [dportopen file://[file join $directory $portdir]]
    43     array set portinfo [dportinfo $interp]
    44     dportclose $interp
    45     set portinfo(portdir) $portdir
    46     puts "Adding port $portinfo(name)"
    47     if {$archive == "1"} {
    48         if ![file isdirectory [file join $outdir [file dirname $portdir]]] {
    49             if {[catch {file mkdir [file join $outdir [file dirname $portdir]]} result]} {
    50                 puts "$result"
     42    if {[catch {set interp [dportopen file://[file join $directory $portdir]]} result]} {
     43        puts "Skipping improperly formatted file: $portdir/Portfile"
     44    } else {       
     45        array set portinfo [dportinfo $interp]
     46        dportclose $interp
     47        set portinfo(portdir) $portdir
     48        puts "Adding port $portinfo(name)"
     49        if {$archive == "1"} {
     50            if ![file isdirectory [file join $outdir [file dirname $portdir]]] {
     51                if {[catch {file mkdir [file join $outdir [file dirname $portdir]]} result]} {
     52                    puts "$result"
     53                    exit 1
     54                }
     55            }
     56            set portinfo(portarchive) [file join [file dirname $portdir] [file tail $portdir]].tgz
     57            cd [file join $directory [file dirname $portinfo(portdir)]]
     58            puts "Archiving port $portinfo(name) to [file join $outdir $portinfo(portarchive)]"
     59            if {[catch {exec tar -cf - [file tail $portdir] | gzip -c >[file join $outdir $portinfo(portarchive)]} result]} {
     60                puts "Failed to create port archive $portinfo(portarchive): $result"
    5161                exit 1
    5262            }
    5363        }
    54         set portinfo(portarchive) [file join [file dirname $portdir] [file tail $portdir]].tgz
    55         cd [file join $directory [file dirname $portinfo(portdir)]]
    56         puts "Archiving port $portinfo(name) to [file join $outdir $portinfo(portarchive)]"
    57         if {[catch {exec tar -cf - [file tail $portdir] | gzip -c >[file join $outdir $portinfo(portarchive)]} result]} {
    58             puts "Failed to create port archive $portinfo(portarchive): $result"
    59             exit 1
    60         }
     64        set output [array get portinfo]
     65        set len [expr [string length $output] + 1]
     66        puts $fd "$portinfo(name) $len"
     67        puts $fd $output
    6168    }
    62     set output [array get portinfo]
    63     set len [expr [string length $output] + 1]
    64     puts $fd "$portinfo(name) $len"
    65     puts $fd $output
    6669}
    6770
    6871if {[expr $argc > 4]} {