From a6ce2feb07349aaf749c2f35f3460976ee3f7940 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Wed, 21 Sep 2005 13:02:01 +0000
Subject: [PATCH] 	Watch changes to the queue of the RFC editor. 	*
 rfc-editor-watch.sh: New file. 	* rfc-editor-split.awk: New file.

---
 ChangeLog            |   5 ++
 rfc-editor-split.awk | 147 +++++++++++++++++++++++++++++++++++++++++++
 rfc-editor-watch.sh  |  24 +++++++
 3 files changed, 176 insertions(+)
 create mode 100644 ChangeLog
 create mode 100644 rfc-editor-split.awk
 create mode 100755 rfc-editor-watch.sh

diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..e9ec7ba
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,5 @@
+2005-09-21  Per Cederqvist  <ceder@moria.cederqvist>
+
+	Watch changes to the queue of the RFC editor.
+	* rfc-editor-watch.sh: New file.
+	* rfc-editor-split.awk: New file.
diff --git a/rfc-editor-split.awk b/rfc-editor-split.awk
new file mode 100644
index 0000000..2ded0a2
--- /dev/null
+++ b/rfc-editor-split.awk
@@ -0,0 +1,147 @@
+BEGIN {
+  state = 0;
+  category = "";
+  fn = 0
+}
+
+FILENAME != fn {
+  if (fn != 0)
+  {
+    for (i in entries) {
+      old[i] = entries[i];
+      delete entries[i];
+    }
+  }
+  fn = FILENAME;
+  state = 0;
+  category = "";
+}
+
+/^-----*$/ {
+  state = 1 - state
+  next
+}
+
+state == 1 && /^IAB DOCUMENTS/ {
+  category = gensub("..by date received.", "", $0) # iab
+  next
+}
+
+state == 1 && /^WORKING GROUP STANDARDS TRACK/ {
+  category = gensub("..by date received.", "", $0) # "wg-std"
+  next
+}
+
+state == 1 && /^NON-WORKING GROUP STANDARDS TRACK/ {
+  category = gensub("..by date received.", "", $0) # "non-wg-std"
+  next
+}
+
+state == 1 && /^WORKING GROUP INFORMATION/ {
+  category = gensub("..by date received.", "", $0) # "wg-info"
+  next
+}
+
+state == 1 && /^NON-WORKING GROUP INFORMATION/ {
+  category = gensub("..by date received.", "", $0) # "non-wg-info"
+  next
+}
+
+state == 1 && /^INDEPENDENT/ {
+  category = gensub("..by date received.", "", $0) # "indep"
+  next
+}
+
+state == 1 {
+  print "Unknown category heading found: " $0 > "/dev/stderr"
+  exit 1
+}
+
+category == "" {
+  next
+}
+
+$1 == "</PRE>" {
+  state = 2
+}
+
+state == 2 {
+  next
+}
+
+/^<a name=".*">$/ {
+  name = gensub(/^<a name="(.*)">$/, "\\1", $0)
+  entries[category, name] = "@category: " category "\n@draft: " name;
+  next
+}
+
+/a href/ {
+  re = "(.*)<a href=\"(.*)\">(.*)</a>";
+  h_date = gensub(re, "\\1", $0);
+  h_url = gensub(re, "\\2", $0);
+  h_name = gensub(re, "\\3", $0);
+  entries[category, name] = entries[category, name] "\n" h_name "\n<" h_url ">\n" h_date;
+  next
+}
+  
+{
+  entries[category, name] = entries[category, name] "\n" $0;
+}
+
+END {
+
+  need_heading = 1
+  n = asorti(entries, sort_indir);
+  for (i = 1; i <= n; i++) {
+    split(sort_indir[i], separate, SUBSEP);
+    category = separate[1];
+    name = separate[2];
+    if ((category, name) in old) {
+    } else {
+      if (need_heading) {
+	print "New entries\n==========\n" > "head-rfcew.txt"
+	need_heading = 0;
+      }
+      # print "NEW", category, name;
+      print entries[category, name] > "head-rfcew.txt";
+    }
+  }
+
+  need_heading = 1
+  n = asorti(old, sort_indir);
+  for (i = 1; i <= n; i++) {
+    split(sort_indir[i], separate, SUBSEP);
+    category = separate[1];
+    name = separate[2];
+    if ((category, name) in entries) {
+    } else {
+      if (need_heading) {
+	print "Removed entries\n==============\n" > "head-rfcew.txt";
+	need_heading = 0;
+      }
+      # print "REMOVED", category, name;
+      print old[category, name] > "head-rfcew.txt";
+    }
+  }
+  printf "" > "head-rfcew.txt";
+  printf "" > "old-rfcew.txt";
+  printf "" > "new-rfcew.txt";
+
+  need_heading = 1
+  n = asorti(entries, sort_indir);
+  for (i = 1; i <= n; i++) {
+    split(sort_indir[i], separate, SUBSEP);
+    category = separate[1];
+    name = separate[2];
+    if ((category, name) in old && entries[category, name] != old[category, name]) {
+      if (need_heading) {
+	print "Changed entries\n=============\n" > "head-rfcew.txt";
+	need_heading = 0;
+      }
+      # print "CHANGED", category, name;
+      print old[category, name] > "old-rfcew.txt";
+      print entries[category, name] > "new-rfcew.txt";
+    }
+  }
+
+}
diff --git a/rfc-editor-watch.sh b/rfc-editor-watch.sh
new file mode 100755
index 0000000..1316cdb
--- /dev/null
+++ b/rfc-editor-watch.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+PATH=/bin:/usr/bin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3.5:/opt/Acrobat5:/usr/X11R6/bin:/opt/blackdown-jdk-1.4.2.01/bin:/opt/blackdown-jdk-1.4.2.01/jre/bin:/usr/qt/3/bin:/usr/kde/3.3/bin:/usr/kde/3.2/bin:/usr/kde/3.1/bin:/usr/qt/2/bin:/usr/games/bin:/sbin:/usr/sbin:/sbin:/usr/sbin:/sbin:/usr/sbin
+export PATH
+
+cd /home/ceder/rcvs/kernelwatch || exit 1
+
+wget -q -O rfc-queue http://www.rfc-editor.org/queue.html || exit 1
+
+rm -f head-rfcew.txt old-rfcew.txt new-rfcew.txt
+awk -f rfc-editor-split.awk rfc-queue.old rfc-queue || exit 1
+cat head-rfcew.txt > report-rfcew.txt
+diff -U10000 old-rfcew.txt new-rfcew.txt | sed 1,3d >> report-rfcew.txt
+
+if [ -s report-rfcew.txt ]
+then
+    cat report-rfcew.txt \
+    | (cd ~/rcvs/anon/python-lyskom && \
+	 ./komsend --to="ceder per cederqvist" \
+	   --subject="RFC Editor queue changes" \
+	   ) 2> komsend-rfcew.out \
+    || exit 1
+    mv -f rfc-queue rfc-queue.old
+fi
-- 
GitLab