summaryrefslogtreecommitdiffstats
path: root/checknow.awk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:53:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:53:43 +0000
commitf873a6ab324edf3c9a66d29ba3ab0e3dc6c21e0a (patch)
treed99dab2786b89a9ca35f59f4c88749649ad859e7 /checknow.awk
parentInitial commit. (diff)
downloadtzdata-0ed7b066f80c02da0e5871bad316c54cfa89da3a.tar.xz
tzdata-0ed7b066f80c02da0e5871bad316c54cfa89da3a.zip
Adding upstream version 2024a.upstream/2024aupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'checknow.awk')
-rw-r--r--checknow.awk54
1 files changed, 54 insertions, 0 deletions
diff --git a/checknow.awk b/checknow.awk
new file mode 100644
index 0000000..57ff3c0
--- /dev/null
+++ b/checknow.awk
@@ -0,0 +1,54 @@
+# Check zonenow.tab for consistency with primary data.
+
+# Contributed by Paul Eggert. This file is in the public domain.
+
+function record_zone(zone, data) {
+ if (zone) {
+ zone_data[zone] = data
+ zones[data] = zones[data] " " zone
+ }
+}
+
+BEGIN {
+ while (getline <zdump_table) {
+ if ($0 ~ /^TZ/) {
+ record_zone(zone, data)
+ zone = $0
+ sub(/.*\.dir\//, "", zone)
+ sub(/\/\//, "/", zone)
+ sub(/"/, "", zone)
+ data = ""
+ } else if ($0 ~ /./)
+ data = data $0 "\n"
+ }
+ record_zone(zone, data)
+ FS = "\t"
+}
+
+/^[^#]/ {
+ zone = $3
+ data = zone_data[zone]
+ if (!data) {
+ printf "%s: no data\n", zone
+ status = 1
+ } else {
+ zone2 = zonenow[data]
+ if (zone2) {
+ printf "zones %s and %s identical from now on\n", zone, zone2
+ status = 1
+ } else
+ zonenow[data] = zone
+ }
+}
+
+END {
+ for (zone in zone_data) {
+ data = zone_data[zone]
+ if (!zonenow[data]) {
+ printf "zonenow.tab should have one of:%s\n", zones[data]
+ zonenow[data] = zone # This suppresses duplicate diagnostics.
+ status = 1
+ }
+ }
+ exit status
+}