summaryrefslogtreecommitdiff
path: root/mesonbuild/scripts/scanbuild.py
diff options
context:
space:
mode:
authorAndrew McNulty <amcn102@gmail.com>2023-10-31 16:42:30 +0100
committerEli Schwartz <eschwartz93@gmail.com>2023-11-02 18:41:51 -0400
commit74712f2dbc3e0f04e6458c6ffe129187dd4726bf (patch)
tree335868a9dc205411eb89d35854c104809f664372 /mesonbuild/scripts/scanbuild.py
parent06b9d1e75a142bb54282042a993bef5f9aa57138 (diff)
downloadmeson-74712f2dbc3e0f04e6458c6ffe129187dd4726bf.tar.gz
scan-build: Exclude subprojects from scan-build report
When a user invokes the scan-build target that Meson generates all subprojects are included in the resulting report. This commit modifies the invocation of scan-build to exclude all bugs that scan-build finds in the subprojects from the final report. A release note has also been added describing the changed behaviour.
Diffstat (limited to 'mesonbuild/scripts/scanbuild.py')
-rw-r--r--mesonbuild/scripts/scanbuild.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/mesonbuild/scripts/scanbuild.py b/mesonbuild/scripts/scanbuild.py
index 9cfc75dc3..be60024da 100644
--- a/mesonbuild/scripts/scanbuild.py
+++ b/mesonbuild/scripts/scanbuild.py
@@ -24,12 +24,12 @@ import typing as T
from ast import literal_eval
import os
-def scanbuild(exelist: T.List[str], srcdir: Path, blddir: Path, privdir: Path, logdir: Path, args: T.List[str]) -> int:
+def scanbuild(exelist: T.List[str], srcdir: Path, blddir: Path, privdir: Path, logdir: Path, subprojdir: Path, args: T.List[str]) -> int:
# In case of problems leave the temp directory around
# so it can be debugged.
scandir = tempfile.mkdtemp(dir=str(privdir))
meson_cmd = exelist + args
- build_cmd = exelist + ['-o', str(logdir)] + detect_ninja() + ['-C', scandir]
+ build_cmd = exelist + ['--exclude', str(subprojdir), '-o', str(logdir)] + detect_ninja() + ['-C', scandir]
rc = subprocess.call(meson_cmd + [str(srcdir), scandir])
if rc != 0:
return rc
@@ -41,8 +41,9 @@ def scanbuild(exelist: T.List[str], srcdir: Path, blddir: Path, privdir: Path, l
def run(args: T.List[str]) -> int:
srcdir = Path(args[0])
bldpath = Path(args[1])
+ subprojdir = srcdir / Path(args[2])
blddir = args[1]
- meson_cmd = args[2:]
+ meson_cmd = args[3:]
privdir = bldpath / 'meson-private'
logdir = bldpath / 'meson-logs' / 'scanbuild'
shutil.rmtree(str(logdir), ignore_errors=True)
@@ -63,4 +64,4 @@ def run(args: T.List[str]) -> int:
print('Could not execute scan-build "%s"' % ' '.join(exelist))
return 1
- return scanbuild(exelist, srcdir, bldpath, privdir, logdir, meson_cmd)
+ return scanbuild(exelist, srcdir, bldpath, privdir, logdir, subprojdir, meson_cmd)