about summary refs log tree commit diff
path: root/scripts/firstversions.awk
blob: 89bbe5e8716b12a51cd9d39fcb1d0aa99d7bd8ad (plain) (blame)
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
# Script to preprocess Versions.all lists based on "earliest version"
# specifications in the shlib-versions file.

NF > 2 && $2 == ":" {
  for (i = 0; i <= NF - 3; ++i)
    firstversion[$1, i] = $(3 + i);
  idx[$1] = 0;
  next;
}

NF == 2 && $2 == "{" { thislib = $1; print; next }

$1 == "}" {
  if (firstversion[thislib, idx[thislib]]) {
    # We haven't seen the stated version, but have produced
    # others pointing to it, so we synthesize it now.
    printf "  %s\n", firstversion[thislib, idx[thislib]];
    idx[thislib]++;
  }
  print;
  next;
}

/GLIBC_PRIVATE/ { print; next }

{
  if ((thislib, idx[thislib]) in firstversion) {
    v = firstversion[thislib, idx[thislib]];
    if ($1 == v) {
      print;
      firstversion[thislib, idx[thislib]] = 0;
      idx[thislib]++;
    }
    else
      print $1, "=", v;
  }
  else
    print;
}