]> git.ipfire.org Git - thirdparty/glibc.git/blame - scripts/versionlist.awk
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / scripts / versionlist.awk
CommitLineData
22dbc19d 1# Extract ordered list of version sets from Versions files.
04277e02 2# Copyright (C) 2014-2019 Free Software Foundation, Inc.
22dbc19d
RM
3
4BEGIN { in_lib = ""; in_version = 0 }
5
a5e5f1e2
RM
6!in_lib && NF == 2 && $2 == "{" {
7 in_lib = $1;
8 all_libs[in_lib] = 1;
9 next
10}
22dbc19d
RM
11!in_lib { next }
12
13NF == 2 && $2 == "{" {
14 in_version = 1;
22dbc19d 15 lib_versions[in_lib, $1] = 1;
a5e5f1e2
RM
16 # Partition the version sets into GLIBC_* and others.
17 if ($1 ~ /GLIBC_/) {
18 libs[in_lib] = libs[in_lib] " " $1 "\n";
19 all_versions[$1] = 1;
20 }
21 else {
22 others_libs[in_lib] = others_libs[in_lib] " " $1 "\n";
23 others_all_versions[$1] = 1;
24 }
22dbc19d
RM
25 next
26}
27
28in_version && $1 == "}" { in_version = 0; next }
29in_version { next }
30
31$1 == "}" { in_lib = ""; next }
32
33END {
a5e5f1e2 34 nlibs = asorti(all_libs, libs_order);
22dbc19d
RM
35 for (i = 1; i <= nlibs; ++i) {
36 lib = libs_order[i];
37
38 for (v in all_versions) {
a5e5f1e2 39 if (!((lib, v) in lib_versions)) {
22dbc19d
RM
40 libs[lib] = libs[lib] " " v "\n";
41 }
42 }
43
a5e5f1e2
RM
44 for (v in others_all_versions) {
45 if (!((lib, v) in lib_versions)) {
46 others_libs[lib] = others_libs[lib] " " v "\n";
47 }
48 }
49
22dbc19d 50 print lib, "{";
a5e5f1e2
RM
51
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.
56
22dbc19d
RM
57 sort = "sort -u -t. -k 1,1 -k 2n,2n -k 3";
58 printf "%s", libs[lib] | sort;
59 close(sort);
a5e5f1e2
RM
60
61 sort = "sort -u -t. -k 1,1 -k 2n,2n -k 3";
62 printf "%s", others_libs[lib] | sort;
63 close(sort);
64
22dbc19d
RM
65 print "}";
66 }
67}