2014-03-14 19:39:56 +01:00
|
|
|
# Extract ordered list of version sets from Versions files.
|
2015-01-02 17:28:19 +01:00
|
|
|
# Copyright (C) 2014-2015 Free Software Foundation, Inc.
|
2014-03-14 19:39:56 +01:00
|
|
|
|
|
|
|
BEGIN { in_lib = ""; in_version = 0 }
|
|
|
|
|
2014-03-25 19:16:51 +01:00
|
|
|
!in_lib && NF == 2 && $2 == "{" {
|
|
|
|
in_lib = $1;
|
|
|
|
all_libs[in_lib] = 1;
|
|
|
|
next
|
|
|
|
}
|
2014-03-14 19:39:56 +01:00
|
|
|
!in_lib { next }
|
|
|
|
|
|
|
|
NF == 2 && $2 == "{" {
|
|
|
|
in_version = 1;
|
|
|
|
lib_versions[in_lib, $1] = 1;
|
2014-03-25 19:16:51 +01:00
|
|
|
# Partition the version sets into GLIBC_* and others.
|
|
|
|
if ($1 ~ /GLIBC_/) {
|
|
|
|
libs[in_lib] = libs[in_lib] " " $1 "\n";
|
|
|
|
all_versions[$1] = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
others_libs[in_lib] = others_libs[in_lib] " " $1 "\n";
|
|
|
|
others_all_versions[$1] = 1;
|
|
|
|
}
|
2014-03-14 19:39:56 +01:00
|
|
|
next
|
|
|
|
}
|
|
|
|
|
|
|
|
in_version && $1 == "}" { in_version = 0; next }
|
|
|
|
in_version { next }
|
|
|
|
|
|
|
|
$1 == "}" { in_lib = ""; next }
|
|
|
|
|
|
|
|
END {
|
2014-03-25 19:16:51 +01:00
|
|
|
nlibs = asorti(all_libs, libs_order);
|
2014-03-14 19:39:56 +01:00
|
|
|
for (i = 1; i <= nlibs; ++i) {
|
|
|
|
lib = libs_order[i];
|
|
|
|
|
|
|
|
for (v in all_versions) {
|
2014-03-25 19:16:51 +01:00
|
|
|
if (!((lib, v) in lib_versions)) {
|
2014-03-14 19:39:56 +01:00
|
|
|
libs[lib] = libs[lib] " " v "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-25 19:16:51 +01:00
|
|
|
for (v in others_all_versions) {
|
|
|
|
if (!((lib, v) in lib_versions)) {
|
|
|
|
others_libs[lib] = others_libs[lib] " " v "\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-14 19:39:56 +01:00
|
|
|
print lib, "{";
|
2014-03-25 19:16:51 +01:00
|
|
|
|
|
|
|
# Sort and print all the GLIBC_* sets first, then all the others.
|
|
|
|
# This is not really generically right, but it suffices
|
|
|
|
# for the cases we have so far. e.g. GCC_3.0 is "later than"
|
|
|
|
# all GLIBC_* sets that matter for purposes of Versions files.
|
|
|
|
|
2014-03-14 19:39:56 +01:00
|
|
|
sort = "sort -u -t. -k 1,1 -k 2n,2n -k 3";
|
|
|
|
printf "%s", libs[lib] | sort;
|
|
|
|
close(sort);
|
2014-03-25 19:16:51 +01:00
|
|
|
|
|
|
|
sort = "sort -u -t. -k 1,1 -k 2n,2n -k 3";
|
|
|
|
printf "%s", others_libs[lib] | sort;
|
|
|
|
close(sort);
|
|
|
|
|
2014-03-14 19:39:56 +01:00
|
|
|
print "}";
|
|
|
|
}
|
|
|
|
}
|