numam-dpdk/buildtools/gen-pmdinfo-cfile.py
Bruce Richardson c78471cd06 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: e6e9730c70 ("buildtools: support object file extraction for Windows")
Cc: stable@dpdk.org

Reported-by: Michal Berger <michallinuxstuff@gmail.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2021-11-03 14:16:29 +01:00

22 lines
769 B
Python

#!/usr/bin/env python3
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2020 Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
import os
import subprocess
import sys
import tempfile
_, tmp_root, ar, archive, output, *pmdinfogen = sys.argv
with tempfile.TemporaryDirectory(dir=tmp_root) as temp:
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)