1 # Extract ordered list of version sets from Versions files.
2 # Copyright (C) 2014 Free Software Foundation, Inc.
4 BEGIN { in_lib = ""; in_version = 0 }
6 !in_lib && NF == 2 && $2 == "{" {
13 NF == 2 && $2 == "{" {
15 lib_versions[in_lib, $1] = 1;
16 # Partition the version sets into GLIBC_* and others.
18 libs[in_lib] = libs[in_lib] " " $1 "\n";
22 others_libs[in_lib] = others_libs[in_lib] " " $1 "\n";
23 others_all_versions[$1] = 1;
28 in_version && $1 == "}" { in_version = 0; next }
31 $1 == "}" { in_lib = ""; next }
34 nlibs = asorti(all_libs, libs_order);
35 for (i = 1; i <= nlibs; ++i) {
38 for (v in all_versions) {
39 if (!((lib, v) in lib_versions)) {
40 libs[lib] = libs[lib] " " v "\n";
44 for (v in others_all_versions) {
45 if (!((lib, v) in lib_versions)) {
46 others_libs[lib] = others_libs[lib] " " v "\n";
52 # Sort and print all the GLIBC_* sets first, then all the others.
53 # This is not really generically right, but it suffices
54 # for the cases we have so far. e.g. GCC_3.0 is "later than"
55 # all GLIBC_* sets that matter for purposes of Versions files.
57 sort = "sort -u -t. -k 1,1 -k 2n,2n -k 3";
58 printf "%s", libs[lib] | sort;
61 sort = "sort -u -t. -k 1,1 -k 2n,2n -k 3";
62 printf "%s", others_libs[lib] | sort;