src/utils/qa/removeAlphas 1.1

1.1 2009/06/16 21:54:31 rhead
Initial commit. Thanks, markd!
Index: src/utils/qa/removeAlphas
===================================================================
RCS file: src/utils/qa/removeAlphas
diff -N src/utils/qa/removeAlphas
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ src/utils/qa/removeAlphas	16 Jun 2009 21:54:31 -0000	1.1
@@ -0,0 +1,35 @@
+#!/usr/bin/awk -f
+
+# takes a list of tables and a trackDb.ra file, and removes the line
+# "release alpha" from the corresponding block.  Writes results to stdout.
+
+BEGIN {
+  if (ARGC != 3) {
+    print "wrong # args: removeAlphas tableList trackDb.ra" > "/dev/stderr"
+    exit 1
+  }
+  tblFile = ARGV[1]
+  ARGV[1] = ""
+  while ((status = getline tbl <tblFile) > 0) {
+    tables[tbl] = 1
+  }
+  if (status < 0) {
+    print "Error: cannot read " tblFile > "/dev/stderr"
+    exit 1
+  }
+  close(tblFile)
+  inTblBlock = 0
+}
+
+($1 == "track") && tables[$2] {
+  inTblBlock = 1
+}
+
+NF == 0 {
+  inTblBlock = 0
+}
+
+(inTblBlock && ($1 != "release") && ($2 != "alpha")) || !inTblBlock {
+  print $0
+}
+