Last active
March 1, 2023 03:35
-
-
Save jmroot/2dcb49179e0f97971430f03eba2bf5e9 to your computer and use it in GitHub Desktop.
basic PortIndex lint script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env port-tclsh | |
| # check a PortIndex for duplicate portnames and malformed portinfo | |
| set fd [open [lindex $argv 0]] | |
| array set counts {} | |
| while {[gets $fd line] >= 0} { | |
| set name [string tolower [lindex $line 0]] | |
| incr counts($name) | |
| if {$counts($name) > 1} { | |
| puts stderr "Warning: $counts($name) occurrences of $name" | |
| } | |
| array unset portinfo | |
| set len [lindex $line 1] | |
| set infoline [read $fd $len] | |
| if {[catch {array set portinfo $infoline} result]} { | |
| puts stderr "Warning: failed to parse info for ${name}: $result" | |
| puts stderr "Info line for ${name}: $infoline" | |
| } | |
| } | |
| close $fd | |
| #foreach {n c} [array get counts] { | |
| # puts "$n $c" | |
| #} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment