summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2014-03-14 11:39:56 -0700
committerRoland McGrath <roland@hack.frob.com>2014-03-14 11:39:56 -0700
commit22dbc19dbb703bfeef8ef587fc4329aae8704a8e (patch)
tree6c2b96926d516e34be7d22d65920b8f48b745550 /scripts
parent498a22333b835a598ccaed4656e97a0ec3573665 (diff)
Get rid of Versions.def source file
Diffstat (limited to 'scripts')
-rw-r--r--scripts/versionlist.awk39
1 files changed, 39 insertions, 0 deletions
diff --git a/scripts/versionlist.awk b/scripts/versionlist.awk
new file mode 100644
index 0000000000..19fe672991
--- /dev/null
+++ b/scripts/versionlist.awk
@@ -0,0 +1,39 @@
+# Extract ordered list of version sets from Versions files.
+# Copyright (C) 2014 Free Software Foundation, Inc.
+
+BEGIN { in_lib = ""; in_version = 0 }
+
+!in_lib && NF == 2 && $2 == "{" { in_lib = $1; next }
+!in_lib { next }
+
+NF == 2 && $2 == "{" {
+ in_version = 1;
+ libs[in_lib] = libs[in_lib] " " $1 "\n";
+ lib_versions[in_lib, $1] = 1;
+ all_versions[$1] = 1;
+ next
+}
+
+in_version && $1 == "}" { in_version = 0; next }
+in_version { next }
+
+$1 == "}" { in_lib = ""; next }
+
+END {
+ nlibs = asorti(libs, libs_order);
+ for (i = 1; i <= nlibs; ++i) {
+ lib = libs_order[i];
+
+ for (v in all_versions) {
+ if (!((in_lib, v) in lib_versions)) {
+ libs[lib] = libs[lib] " " v "\n";
+ }
+ }
+
+ print lib, "{";
+ sort = "sort -u -t. -k 1,1 -k 2n,2n -k 3";
+ printf "%s", libs[lib] | sort;
+ close(sort);
+ print "}";
+ }
+}