Ticket #567: portindex.tcl.diff

File portindex.tcl.diff, 2.4 KB (added by Eric.C.Seidel@…, 21 years ago)

cvs diff -u output

  • portindex.tcl

    RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port/portindex.tcl,v
    retrieving revision 1.19
    diff -u -r1.19 portindex.tcl
     
    99# Globals
    1010set archive 0
    1111set depth 0
     12set symlink 0
    1213
    1314# UI Instantiations
    1415# ui_options(ports_debug) - If set, output debugging messages.
     
    7071    puts "-a:\tArchive port directories (for remote sites). Requires -o option"
    7172    puts "-o:\tOutput all files to specified directory"
    7273    puts "-d:\tOutput debugging information"
     74    puts "-s:\tRebuild catagory simlinks (can not be used with -a)"
    7375}
    7476
    7577proc port_traverse {func {dir .} {cwd ""}} {
     
    9799}
    98100
    99101proc pindex {portdir} {
    100     global target fd directory archive outdir
     102    global target fd directory archive outdir symlink
    101103    if {[catch {set interp [dportopen file://[file join $directory $portdir]]} result]} {
    102104        puts "Failed to parse file $portdir/Portfile: $result"
    103105    } else {       
     
    119121                puts "Failed to create port archive $portinfo(portarchive): $result"
    120122                exit 1
    121123            }
     124        } elseif {$symlink == "1"} {
     125            # Generate the catagory symlink hierarchy
     126            foreach cat $portinfo(categories) {
     127                set from $directory/$portdir
     128                set to   $directory/$cat/$portinfo(name)
     129                # this ignores when it's the same.
     130                if {$from != $to} {
     131                    puts "Symlinking $cat/$portinfo(name) to $portdir"
     132                    file mkdir $directory/$cat
     133                    catch {exec ln -sh $from $to}
     134                }
     135            }
    122136        }
    123137        set output [array get portinfo]
    124138        set len [expr [string length $output] + 1]
     
    143157            } elseif {$arg == "-o"} { # Set output directory
    144158                incr i
    145159                set outdir [lindex $argv $i]
     160            } elseif {$arg == "-s"} { # Turn on symlink construction
     161                set symlink 1
    146162            } else {
    147163                puts "Unknown option: $arg"
    148164                print_usage
     
    151167        }
    152168        default { set directory $arg }
    153169    }
     170}
     171
     172if {$archive == 1 && $symlink == 1} {
     173   puts "You may not use the -s and -a options simultaneously."
     174   print_usage
     175   exit 1
    154176}
    155177
    156178if {$archive == 1 && ![info exists outdir]} {