aboutsummaryrefslogtreecommitdiff
path: root/scripts/extract-abilist.awk
blob: c5b76e1309f1671991e317dd89bbadfe0f24854c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# awk script to extract a config-specific .symlist file from a merged file.
# 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...
#	 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.

BEGIN {
  outpipe = "";
}

/^ / { if (!ignore) print | outpipe; next; }

{
  for (i = 2; i <= NF; ++i) {
    regex = "^" $i "$";
    if (match(config, regex) != 0) {
      if ($1 != version) {
	if (outpipe != "") {
	  close(outpipe);
	}
	version = $1;
	print version;
	outpipe = "sort";
      }
      ignore = 0;
      next;
    }
  }
  ignore = 1;
  next;
}

END {
  if (outpipe == "") {
    print "No stanza matched", config > "/dev/stderr";
    exit 2;
  }
  else
    close(outpipe);
}