Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions make-srpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ BuildRequires: help2man

%if 0%{?rhel} == 7
%global python3_pkgversion 36

# needed for /usr/share/csmock/scripts/convert-clippy.py
%global _python_bytecompile_errors_terminate_build 0
%global __python %{python3}
%endif

BuildRequires: python%{python3_pkgversion}-GitPython
Expand Down Expand Up @@ -325,7 +323,10 @@ This package contains the unicontrol plug-in for csmock.
%{python3_sitelib}/csmock/plugins/__pycache__/clang.*

%files -n csmock-plugin-clippy
%{_datadir}/csmock/scripts/convert-clippy.py
%{_datadir}/csmock/scripts/convert-clippy.py*
%if 0%{?rhel} == 7
%{_datadir}/csmock/scripts/__pycache__/convert-clippy.*
%endif
%{_datadir}/csmock/scripts/inject-clippy.sh
%{python3_sitelib}/csmock/plugins/clippy.py*
%{python3_sitelib}/csmock/plugins/__pycache__/clippy.*
Expand All @@ -344,6 +345,9 @@ This package contains the unicontrol plug-in for csmock.

%files -n csmock-plugin-infer
%{_datadir}/csmock/scripts/filter-infer.py*
%if 0%{?rhel} == 7
%{_datadir}/csmock/scripts/__pycache__/filter-infer.*
%endif
%{_datadir}/csmock/scripts/install-infer.sh
%{python3_sitelib}/csmock/plugins/infer.py*
%{python3_sitelib}/csmock/plugins/__pycache__/infer.*
Expand Down Expand Up @@ -384,6 +388,9 @@ This package contains the unicontrol plug-in for csmock.

%files -n csmock-plugin-unicontrol
%{_datadir}/csmock/scripts/find-unicode-control.py*
%if 0%{?rhel} == 7
%{_datadir}/csmock/scripts/__pycache__/find-unicode-control.*
%endif
%{python3_sitelib}/csmock/plugins/unicontrol.py*
%{python3_sitelib}/csmock/plugins/__pycache__/unicontrol.*
EOF
Expand Down
2 changes: 1 addition & 1 deletion py/plugins/clippy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def install_clippy_hook(results, mock):
def convert_hook(results):
src = f"{results.dbgdir_raw}{CLIPPY_OUTPUT}"
dst = f"{results.dbgdir_uni}/clippy-capture.err"
cmd = f'{RUN_CLIPPY_CONVERT} < {src} | csgrep --remove-duplicates > {dst}'
cmd = f'set -o pipefail; {RUN_CLIPPY_CONVERT} < {src} | csgrep --remove-duplicates > {dst}'
return results.exec_cmd(cmd, shell=True)

props.post_process_hooks += [convert_hook]
13 changes: 8 additions & 5 deletions scripts/convert-clippy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@
PACKAGE_ID_PATTERN = r"path\+file://(.*)\)"
# eg -- "package_id":"path+file:///builddir/build/BUILD/stratisd-3.6.5#stratisd@3.6.5"
PACKAGE_ID_PATTERN2 = r"^path\+file:\/\/([^#]+)(?:#([^@]*))?(?:@(.+))?$"
PACKAGE_ID_PATTERNS = [PACKAGE_ID_PATTERN, PACKAGE_ID_PATTERN2]

def main():
for line in sys.stdin:
try:
item = json.loads(line)
except Exception as e:
sys.stderr.write(f"rust-clippy: Error while converting results: {e}\n")
sys.stderr.flush()
continue
print("rust-clippy: Error while converting results:", e, file=sys.stderr)
sys.exit(1)

if item["reason"] != "compiler-message":
continue

if (not (match := re.search(PACKAGE_ID_PATTERN, item["package_id"])) and
not (match := re.search(PACKAGE_ID_PATTERN2, item["package_id"]))):
for pattern in PACKAGE_ID_PATTERNS:
match = re.search(pattern, item["package_id"])
if match:
break
if not match:
continue

package_path = match.group(1)
Expand Down