misc: experimental configure script

Type: make
Change-Id: Iaeb9d22eec9a7a763b63899814a44e78c8050f1f
Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:
Damjan Marion
2021-04-29 18:47:25 +02:00
committed by Andrew Yourtchenko
parent 10796899cf
commit 88b2e3682b
13 changed files with 215 additions and 28 deletions

33
src/scripts/compdb_cleanup.py Executable file
View File

@ -0,0 +1,33 @@
#!/usr/bin/env python3
import sys
import json
objects = json.load(sys.stdin)
for i in range(len(objects) - 1, -1, -1):
obj = objects[i]
# Remove everything except .c files
if not obj["file"].endswith(".c"):
objects.remove(obj)
continue
# remove duplicates introduced my multiarch
if "CLIB_MARCH_VARIANT" in obj["command"]:
objects.remove(obj)
continue
# remove if there is no command
if obj["command"] == "":
objects.remove(obj)
continue
# remove ccache prefix
s = str.split(obj["command"])
if s[0] == "ccache":
s.remove(s[0])
s[0] = s[0].split("/")[-1]
obj["command"] = " ".join(s)
json.dump(objects, sys.stdout, indent=2)