config/ppc: fix build with GCC >= 10
[dpdk.git] / buildtools / gen-pmdinfo-cfile.py
index c60ecd7..58fe3ad 100644 (file)
@@ -7,13 +7,14 @@ import subprocess
 import sys
 import tempfile
 
-_, ar, archive, output, *pmdinfogen = sys.argv
-with tempfile.TemporaryDirectory() as temp:
-    proc = subprocess.run(
-        # Don't use "ar p", because its output is corrupted on Windows.
-        [ar, "xv", os.path.abspath(archive)], stdout=subprocess.PIPE, check=True, cwd=temp
+_, tmp_root, ar, archive, output, *pmdinfogen = sys.argv
+with tempfile.TemporaryDirectory(dir=tmp_root) as temp:
+    run_ar = lambda command: subprocess.run(
+        [ar, command, os.path.abspath(archive)],
+        stdout=subprocess.PIPE, check=True, cwd=temp
     )
-    lines = proc.stdout.decode().splitlines()
-    names = [line[len("x - ") :] for line in lines]
+    # Don't use "ar p", because its output is corrupted on Windows.
+    run_ar("x")
+    names = run_ar("t").stdout.decode().splitlines()
     paths = [os.path.join(temp, name) for name in names]
     subprocess.run(pmdinfogen + paths + [output], check=True)