Simplify the abilist format

Message ID 56323172.2060800@redhat.com
State Committed
Headers

Commit Message

Florian Weimer Oct. 29, 2015, 2:47 p.m. UTC
  This picks up an old idea, which had some support at the time:

  <https://sourceware.org/ml/libc-alpha/2015-03/msg00255.html>

The new format lists the version on each line, as in:

	VERSION SYMBOL TYPE [VALUE]

This makes it easier to process the files with line-oriented tools.

The abilist files were converted with this awk script:

/^[^ ]/ { version = $1 }
/^ / { print version, substr($0, 2) }

And sorted under the "C" locale with sort.

(The patch does not contain the automatically-generated part.)

I checked that “make update-abi” still works.

Florian
  

Comments

Florian Weimer Nov. 4, 2015, 8:01 p.m. UTC | #1
On 10/29/2015 03:47 PM, Florian Weimer wrote:
> This picks up an old idea, which had some support at the time:
> 
>   <https://sourceware.org/ml/libc-alpha/2015-03/msg00255.html>
> 
> The new format lists the version on each line, as in:
> 
> 	VERSION SYMBOL TYPE [VALUE]
> 
> This makes it easier to process the files with line-oriented tools.
> 
> The abilist files were converted with this awk script:
> 
> /^[^ ]/ { version = $1 }
> /^ / { print version, substr($0, 2) }
> 
> And sorted under the "C" locale with sort.
> 
> (The patch does not contain the automatically-generated part.)
> 
> I checked that “make update-abi” still works.

Ping?  I need to add some symbols soon, and this would be a welcome
simplifications (together with the update-all-abi patch).

Florian
  
Roland McGrath Nov. 5, 2015, 9:02 p.m. UTC | #2
I think that's fine.
  

Patch

2015-10-29  Florian Weimer  <fweimer@redhat.com>
 
	* scripts/abilist.awk: Collect descriptors in the descs variable.
	(emit): Write descs variable and sort it
	externally, with sort.
	* sysdeps/**/*.abilist: Convert to new format.

diff --git a/scripts/abilist.awk b/scripts/abilist.awk
index 52b5b32..bd740d4 100644
--- a/scripts/abilist.awk
+++ b/scripts/abilist.awk
@@ -100,17 +100,13 @@  $2 == "g" || $2 == "w" && (NF == 7 || NF == 8) {
   # Disabled -- weakness should not matter to shared library ABIs any more.
   #if (weak == "w") type = tolower(type);
   if (desc == "")
-    desc = " " symbol " " type size;
+    desc = symbol " " type size;
 
   if (combine)
     version = soname " " version (combine_fullname ? " " sofullname : "");
 
-  if (version in versions) {
-    versions[version] = versions[version] "\n" desc;
-  }
-  else {
-    versions[version] = desc;
-  }
+  # Append to the string which collects the results.
+  descs = descs version " " desc "\n";
   next;
 }
 
@@ -126,65 +122,20 @@  function emit(end) {
     return;
   tofile = parse_names && !combine;
 
-  nverslist = 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;
-  }
-
   if (tofile) {
     out = prefix soname ".symlist";
     if (soname in outfiles)
       out = out "." ++outfiles[soname];
     else
       outfiles[soname] = 1;
-    printf "" > out;
+    outpipe = "LC_ALL=C sort -u > " out;
+  } else {
+    outpipe = "LC_ALL=C sort -u";
   }
 
-  split(verslist, order, "\n");
-  for (i = 1; i <= nverslist; ++i) {
-    version = order[i];
-
-    if (tofile) {
-      print version >> out;
-      close(out);
-      outpipe = "sort >> " out;
-    }
-    else {
-      if (combine)
-	print "";
-      print prefix version;
-      outpipe = "sort";
-    }
-    print versions[version] | outpipe;
-    close(outpipe);
-
-    delete versions[version];
-  }
-  for (version in versions)
-    delete versions[version];
+  printf "%s", descs | outpipe;
+
+  descs = "";
 
   if (tofile)
     print "wrote", out, "for", sofullname;