aboutsummaryrefslogtreecommitdiff
path: root/scripts/extract-abilist.awk
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-01-16 11:28:59 +0000
committerRoland McGrath <roland@gnu.org>2003-01-16 11:28:59 +0000
commit81043d1ad854ddd57fc4a7f398cbac5c7740ed09 (patch)
treef67ae1ffa69a1734d5e6c35bd13e698fe38042e0 /scripts/extract-abilist.awk
parente09edf23c2b9cadb988c5cdb69adf70eb418c907 (diff)
downloadglibc-81043d1ad854ddd57fc4a7f398cbac5c7740ed09.tar
glibc-81043d1ad854ddd57fc4a7f398cbac5c7740ed09.tar.gz
glibc-81043d1ad854ddd57fc4a7f398cbac5c7740ed09.tar.bz2
glibc-81043d1ad854ddd57fc4a7f398cbac5c7740ed09.zip
2003-01-16 Roland McGrath <roland@redhat.com>
Tweak merged .abilist file format to merge duplicate symbols in different sets into multi-version stanzas with new "| SET regexp..." header continuation lines. * scripts/merge-abilist.awk: Rewritten for new format. * scripts/extract-abilist.awk: Likewise.
Diffstat (limited to 'scripts/extract-abilist.awk')
-rw-r--r--scripts/extract-abilist.awk87
1 files changed, 69 insertions, 18 deletions
diff --git a/scripts/extract-abilist.awk b/scripts/extract-abilist.awk
index c5b76e1309..e4f466e6a9 100644
--- a/scripts/extract-abilist.awk
+++ b/scripts/extract-abilist.awk
@@ -2,43 +2,94 @@
# This must be passed run with awk -v config=TUPLE to specify the configuration
# tuple we will match. The merged file contains stanzas in the form:
# GLIBC_x.y regexp...
+# | GLIBC_x.y.z regexp...
+# | GLIBC_m.n regexp...
# function F
# variable D 0x4
# Each regexp is matched against TUPLE, and only matching stanzas go
-# into the output, with the regexp list removed. The result matches the
-# original .symlist file from abilist.awk that was fed into merge-abilist.awk.
+# into the output, with the regexp list removed. Multiple version lines
+# can match with the same regexp, meaning the stanza is duplicated in
+# multiple version sets. The result matches the original .symlist file
+# from abilist.awk that was fed into merge-abilist.awk.
BEGIN {
- outpipe = "";
+ inside = 0;
}
-/^ / { if (!ignore) print | outpipe; next; }
+/^ / {
+ inside = 1;
+ if (!ignore) {
+ for (version in current) {
+ if (version in versions)
+ versions[version] = versions[version] "\n" $0;
+ else
+ versions[version] = $0;
+ }
+ }
+ next;
+}
{
- for (i = 2; i <= NF; ++i) {
+ second = ($1 == "|");
+ if (second && inside) {
+ printf "%s:%d: bad input line inside stanza: %s\n", FILENAME, FNR, $0;
+ exit 1;
+ }
+ inside = 0;
+
+ for (i = second ? 3 : 2; i <= NF; ++i) {
regex = "^" $i "$";
if (match(config, regex) != 0) {
- if ($1 != version) {
- if (outpipe != "") {
- close(outpipe);
- }
- version = $1;
- print version;
- outpipe = "sort";
- }
+ if (!second || ignore)
+ # Clear old array.
+ split("", current);
+ current[second ? $2 : $1] = 1;
ignore = 0;
next;
}
}
- ignore = 1;
+
+ if (!second)
+ ignore = 1;
next;
}
END {
- if (outpipe == "") {
- print "No stanza matched", config > "/dev/stderr";
- exit 2;
+ nverlist = 0;
+ for (version in versions) {
+ if (nverslist == 0) {
+ verslist = version;
+ nverslist = 1;
+ continue;
+ }
+ split(verslist, s, "\n");
+ if (version < s[1]) {
+ verslist = version;
+ for (i = 1; i <= nverslist; ++i) {
+ verslist = verslist "\n" s[i];
+ }
+ }
+ else {
+ verslist = s[1];
+ for (i = 2; i <= nverslist; ++i) {
+ if (version < s[i]) break;
+ verslist = verslist "\n" s[i];
+ }
+ verslist = verslist "\n" version;
+ for (; i <= nverslist; ++i) {
+ verslist = verslist "\n" s[i];
+ }
+ }
+ ++nverslist;
}
- else
+
+ split(verslist, order, "\n");
+ for (i = 1; i <= nverslist; ++i) {
+ version = order[i];
+
+ print version;
+ outpipe = "sort";
+ print versions[version] | outpipe;
close(outpipe);
+ }
}