RCS file: /Volumes/src/cvs/od/proj/darwinports/base/src/port/portindex.tcl,v
retrieving revision 1.19
diff -u -r1.19 portindex.tcl
|
|
|
9 | 9 | # Globals |
10 | 10 | set archive 0 |
11 | 11 | set depth 0 |
| 12 | set symlink 0 |
12 | 13 | |
13 | 14 | # UI Instantiations |
14 | 15 | # ui_options(ports_debug) - If set, output debugging messages. |
… |
… |
|
70 | 71 | puts "-a:\tArchive port directories (for remote sites). Requires -o option" |
71 | 72 | puts "-o:\tOutput all files to specified directory" |
72 | 73 | puts "-d:\tOutput debugging information" |
| 74 | puts "-s:\tRebuild catagory simlinks (can not be used with -a)" |
73 | 75 | } |
74 | 76 | |
75 | 77 | proc port_traverse {func {dir .} {cwd ""}} { |
… |
… |
|
97 | 99 | } |
98 | 100 | |
99 | 101 | proc pindex {portdir} { |
100 | | global target fd directory archive outdir |
| 102 | global target fd directory archive outdir symlink |
101 | 103 | if {[catch {set interp [dportopen file://[file join $directory $portdir]]} result]} { |
102 | 104 | puts "Failed to parse file $portdir/Portfile: $result" |
103 | 105 | } else { |
… |
… |
|
119 | 121 | puts "Failed to create port archive $portinfo(portarchive): $result" |
120 | 122 | exit 1 |
121 | 123 | } |
| 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 | } |
122 | 136 | } |
123 | 137 | set output [array get portinfo] |
124 | 138 | set len [expr [string length $output] + 1] |
… |
… |
|
143 | 157 | } elseif {$arg == "-o"} { # Set output directory |
144 | 158 | incr i |
145 | 159 | set outdir [lindex $argv $i] |
| 160 | } elseif {$arg == "-s"} { # Turn on symlink construction |
| 161 | set symlink 1 |
146 | 162 | } else { |
147 | 163 | puts "Unknown option: $arg" |
148 | 164 | print_usage |
… |
… |
|
151 | 167 | } |
152 | 168 | default { set directory $arg } |
153 | 169 | } |
| 170 | } |
| 171 | |
| 172 | if {$archive == 1 && $symlink == 1} { |
| 173 | puts "You may not use the -s and -a options simultaneously." |
| 174 | print_usage |
| 175 | exit 1 |
154 | 176 | } |
155 | 177 | |
156 | 178 | if {$archive == 1 && ![info exists outdir]} { |