diff options
author | eik <eik@FreeBSD.org> | 2004-05-08 19:52:36 +0800 |
---|---|---|
committer | eik <eik@FreeBSD.org> | 2004-05-08 19:52:36 +0800 |
commit | 84fa66248c092540ae9d7e2a8a971e9dcb3595c0 (patch) | |
tree | 3f37bd6787bc7f93db48bbe2ce2726168885541b /Tools/scripts | |
parent | 4dc285eecbbc409987d31979eb56558e8cf28393 (diff) | |
download | freebsd-ports-gnome-84fa66248c092540ae9d7e2a8a971e9dcb3595c0.tar.gz freebsd-ports-gnome-84fa66248c092540ae9d7e2a8a971e9dcb3595c0.tar.zst freebsd-ports-gnome-84fa66248c092540ae9d7e2a8a971e9dcb3595c0.zip |
- don't flag empty lines
- callable without arguments:
/usr/ports/Tools/scripts/MOVEDlint.awk
- do CVS annotate when called with env CVS=yes
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-x | Tools/scripts/MOVEDlint.awk | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/Tools/scripts/MOVEDlint.awk b/Tools/scripts/MOVEDlint.awk index cd852675c52f..cf5a1a634edd 100755 --- a/Tools/scripts/MOVEDlint.awk +++ b/Tools/scripts/MOVEDlint.awk @@ -30,38 +30,48 @@ # MOVEDlint - check MOVED for consistency # # Usage: -# [env PORTSDIR=/usr/ports] awk -f MOVEDlint.awk /usr/ports/MOVED +# [env PORTSDIR=/usr/ports CVS=yes] /usr/ports/Tools/scripts/MOVEDlint.awk # BEGIN { FS = "|" portsdir = ENVIRON["PORTSDIR"] ? ENVIRON["PORTSDIR"] : "/usr/ports" + if (ARGC == 1) { + ARGV[ARGC++] = portsdir "/MOVED" + if (ENVIRON["CVS"] && !system("test -d " portsdir "/CVS")) + annotate = "cd " portsdir "; cvs -R annotate MOVED 2>/dev/null" + } sort = "/usr/bin/sort -n" lastdate="1999-12-31" } -/^#/ { +/^(#|$)/ { next } NF != 4 { - printf "%5d: illegal format\n", NR | sort + printf "%5d: format is from|to|date|reason, detected %d field(s) \n", NR, NF | sort + error[NR] = 1 next } $1 !~ /^[^\/]+\/[^\/]+$/ || $2 !~ /^([^\/]+\/[^\/]+)?$/ { printf "%5d: source and destination must be category/port\n", NR | sort + error[NR] = 1 next } $3 !~ /^20[0-3][0-9]-[01][0-9]-[0-3][0-9]$/ { printf "%5d: missing YYYY-MM-DD date\n", NR | sort + error[NR] = 1 next } { - if (lastdate > $3) + if (lastdate > $3) { printf "%5d: date going backwards from %s to %s\n", NR, lastdate, $3 | sort + error[NR] = 1 + } lastdate = $3 if (system("test -f " portsdir "/" $1 "/Makefile")) @@ -77,11 +87,25 @@ $3 !~ /^20[0-3][0-9]-[01][0-9]-[0-3][0-9]$/ { } END { - for (port in resurrected) + for (port in resurrected) { printf "%5d: %s must be marked as resurrected\n", resurrected[port], port | sort + error[resurrected[port]] = 1 + } - for (port in missing) + for (port in missing) { printf "%5d: %s not found\n", missing[port], port | sort + error[missing[port]] = 1 + } + + if (annotate) { + line = 1 + while (annotate | getline) { + if (error[line]) + printf "%5d\n%5d! %s\n", line, line, $0 | sort + line++ + } + close(annotate) + } close(sort) } |