From c78471cd061a0f64db006c538be34536bc66c12a Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Mon, 1 Nov 2021 17:03:26 +0000 Subject: [PATCH] buildtools: fix build with Meson 0.60 Meson 0.60 switched the format of uninstalled static libraries to thin archives, that is, they contain only paths to object files, not the files themselves. Files cannot be extracted in this case, resulting in build errors: ar: `x' cannot be used on thin archives. Handle thin archives when invoking pmdinfogen by directly using the files referenced in the archive, when they already exist, and extracting them if not. Bugzilla ID: 836 Fixes: e6e9730c7066 ("buildtools: support object file extraction for Windows") Cc: stable@dpdk.org Reported-by: Michal Berger Signed-off-by: Dmitry Kozlyuk Signed-off-by: Bruce Richardson --- buildtools/gen-pmdinfo-cfile.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/buildtools/gen-pmdinfo-cfile.py b/buildtools/gen-pmdinfo-cfile.py index 58fe3ad152..5fbd51658a 100644 --- a/buildtools/gen-pmdinfo-cfile.py +++ b/buildtools/gen-pmdinfo-cfile.py @@ -9,12 +9,13 @@ import tempfile _, 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 - ) - # 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] + paths = [] + for name in subprocess.run([ar, "t", archive], stdout=subprocess.PIPE, + check=True).stdout.decode().splitlines(): + if os.path.exists(name): + paths.append(name) + else: + subprocess.run([ar, "x", os.path.abspath(archive), name], + check=True, cwd=temp) + paths.append(os.path.join(temp, name)) subprocess.run(pmdinfogen + paths + [output], check=True) -- 2.39.5