aboutsummaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorOliver Eikemeier <eik@FreeBSD.org>2004-05-08 11:52:36 +0000
committerOliver Eikemeier <eik@FreeBSD.org>2004-05-08 11:52:36 +0000
commitfbb1a3869a1d753745579fd7e78bb683f5084453 (patch)
treea1a5e6af9345cc156befcfa767b59e1501129619 /Tools
parentfcc5e609e58dcc73fb5af7ffb704df4379a2d4c8 (diff)
downloadports-fbb1a3869a1d753745579fd7e78bb683f5084453.tar.gz
ports-fbb1a3869a1d753745579fd7e78bb683f5084453.zip
Notes
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/scripts/MOVEDlint.awk36
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)
}