Changeset 1421 for trunk/base


Ignore:
Timestamp:
Dec 13, 2002, 1:47:02 AM (17 years ago)
Author:
jpm
Message:

add a seat belt to prevent evil portfiles from preveting generation of an
index - all nefarious files are now skipped.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/base/src/port/portindex.tcl

    r1351 r1421  
    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 "Failed to parse file $portdir/Portfile: $result"
     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
Note: See TracChangeset for help on using the changeset viewer.