forked from derphilipp/macportsscripts
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlintportindex.tcl
More file actions
24 lines (24 loc) · 722 Bytes
/
lintportindex.tcl
File metadata and controls
24 lines (24 loc) · 722 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env port-tclsh
# check a PortIndex for duplicate portnames
set dumpall 0
set fd [open [lindex $argv 0]]
set counts [dict create]
while {[gets $fd line] >= 0} {
set name [string tolower [lindex $line 0]]
dict incr counts $name
if {[dict get $counts $name] > 1} {
puts stderr "Warning: [dict get $counts $name] occurrences of $name"
}
set len [lindex $line 1]
set portinfo [read $fd $len]
if {[catch {dict size $portinfo} result]} {
puts stderr "Warning: failed to parse info for ${name}: $result"
puts stderr "Info line for ${name}: $portinfo"
}
}
close $fd
if {$dumpall} {
dict for {n c} $counts {
puts "$n $c"
}
}