Skip to content

Commit b9390cd

Browse files
committed
csmock --embed-context: use csgrep-static in chroot
... so that `csdiff` does not need to be available in build repos Related: csutils/csdiff#239
1 parent 25cddf0 commit b9390cd

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

csmock/csmock

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ CSMOCK_DATADIR = "/usr/share/csmock"
4949

5050
CWE_MAP_FILE = CSMOCK_DATADIR + "/cwe-map.csv"
5151

52+
# path to the csgrep-static executable
53+
CSGREP_STATIC = "/usr/libexec/csgrep-static"
54+
5255
CSMOCK_SCRIPTS = CSMOCK_DATADIR + "/scripts"
5356

5457
CHROOT_FIXUPS = CSMOCK_SCRIPTS + "/chroot-fixups"
@@ -958,8 +961,8 @@ exceeds the specified limit (defaults to 1024).")
958961
props.kfp_git_url = args.kfp_git_url
959962

960963
if props.embed_context > 0:
961-
# we need 'csgrep --embed-context' to work in the chroot for --embed-context
962-
props.install_opt_pkgs += ["csdiff"]
964+
# we need csgrep-static in the chroot for --embed-context
965+
props.copy_in_files += [CSGREP_STATIC]
963966

964967
if args.warning_rate_limit > 0:
965968
props.results_limits_opts += [f"--warning-rate-limit={args.warning_rate_limit}"]
@@ -1289,7 +1292,7 @@ cd %%s*/ || cd *\n\
12891292
if props.embed_context > 0:
12901293
# embed context lines from source program files
12911294
tmp_file = f"{all_file}.tmp"
1292-
csgrep_cmd = f"csgrep --mode=json --embed-context {props.embed_context}"
1295+
csgrep_cmd = f"{CSGREP_STATIC} --mode=json --embed-context {props.embed_context}"
12931296

12941297
if props.results_limits_opts:
12951298
# apply results limits already while embedding context to avoid creating excessively huge output

make-srpm.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ Tool for plugging static analyzers into the build process, free of mock.
125125
%package common
126126
Summary: Core of csmock (a mock wrapper for Static Analysis tools)
127127
Requires: csdiff > 3.5.1
128+
Requires: csdiff-static
128129
Requires: csgcca
129130
Requires: cswrap
130131
Requires: mock >= 5.7

0 commit comments

Comments
 (0)