- Add minor version to Python shebangs. (boo#1212476)

- Remove shebang and executable bit where not needed.

OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm18?expand=0&rev=20
This commit is contained in:
Aaron Puchert 2024-08-20 23:23:41 +00:00 committed by Git OBS Bridge
parent 7b38b2dadb
commit e8d8e6eaa8
2 changed files with 15 additions and 27 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Aug 20 21:20:37 UTC 2024 - Aaron Puchert <aaronpuchert@alice-dsl.net>
- Add minor version to Python shebangs. (boo#1212476)
- Remove shebang and executable bit where not needed.
-------------------------------------------------------------------
Sun Jun 30 17:44:44 UTC 2024 - Aaron Puchert <aaronpuchert@alice-dsl.net>
@ -12,12 +18,6 @@ Sun Jun 30 17:44:44 UTC 2024 - Aaron Puchert <aaronpuchert@alice-dsl.net>
goto labels in macro definitions.
- Rebase llvm-do-not-install-static-libraries.patch.
-------------------------------------------------------------------
Thu Jun 20 12:31:57 UTC 2024 - Matej Cepl <mcepl@cepl.eu>
- Fix shebang of the script to use the explicit version of Python
(bsc#1212476).
-------------------------------------------------------------------
Tue May 21 21:06:41 UTC 2024 - Aaron Puchert <aaronpuchert@alice-dsl.net>

View File

@ -1360,8 +1360,8 @@ cat > %{buildroot}%{_rpmconfigdir}/macros.d/macros.llvm <<EOF
%_llvm_with_lldb %{with lldb}
EOF
# Don't use env in shebangs, and prefer python3. (https://www.python.org/dev/peps/pep-0394/#for-python-runtime-distributors)
for script in %{buildroot}%{_bindir}/opt-{diff,stats,viewer} \
# Don't use env in shebangs, and prefer python3.X. (https://www.python.org/dev/peps/pep-0394/#for-python-runtime-distributors)
sed -i "1s|/usr/bin/env *|%{_bindir}/|;1s|/usr/bin/python\$|$(realpath /usr/bin/python3)|" \
%if %{_plv} == %{_sonum}
%{buildroot}%{_bindir}/{{analyze,intercept}-build,clang-{format,tidy}-diff,git-clang-format,hmaptool,run-{clang-tidy,find-all-symbols},scan-{build,build-py,view}} \
%{buildroot}%{_libexecdir}/{{analyze,intercept}-{c++,cc},{c++,ccc}-analyzer} \
@ -1369,13 +1369,16 @@ for script in %{buildroot}%{_bindir}/opt-{diff,stats,viewer} \
%ifarch aarch64 x86_64
%{buildroot}%{_libdir}/clang/%{_sonum}/bin/hwasan_symbolize \
%endif
%{buildroot}%{python3_sitelib}/optrecord.py; do
sed -i '1s|/usr/bin/env *|%{_bindir}/|;1s|/usr/bin/python$|%{_bindir}/python3|' $script
done
%{buildroot}%{_bindir}/opt-{diff,stats,viewer}
# Remove shebangs where not needed.
sed -i '1{ /^#!/d }' \
%{buildroot}%{python3_sitelib}/optrecord.py
%{buildroot}%{_datadir}/scan-view/{Reporter,startfile}.py
# Remove executable bit where not needed.
chmod -x \
%{buildroot}%{python3_sitelib}/optpmap.py \
%{buildroot}%{python3_sitelib}/opt{pmap,record}.py \
%{buildroot}%{_datadir}/opt-viewer/style.css \
%if %{_plv} == %{_sonum}
%{buildroot}%{_datadir}/bash-completion/completions/clang \
@ -1384,21 +1387,6 @@ chmod -x \
find %{buildroot}%{_libdir}/{libear,libscanbuild} -type f -executable -exec chmod -x {} +
%endif
# Fix shebang of Python scripts
%{python3_fix_shebang_path %{buildroot}%{python3_sitearch}/lldb/utils/*.py \
%{buildroot}%{python3_sitelib}/optrecord.py \
%{buildroot}%{_bindir}/opt-diff \
%{buildroot}%{_bindir}/opt-stats \
%{buildroot}%{_bindir}/opt-viewer \
%{buildroot}%{_libdir}/clang/%{_sonum}/bin/hwasan_symbolize \
%{buildroot}%{_datadir}/scan-view/*.py \
%{buildroot}%{_libexecdir}/*
%{buildroot}%{_bindir}/*
}
# Control
grep -r "^#!.*python" %{buildroot}/ | grep -v "$(realpath %{_bindir}/python3)"
%fdupes -s %{buildroot}%{_docdir}/llvm
%fdupes -s %{buildroot}%{_docdir}/llvm-clang
%fdupes %{_includedir}/%{name}/Host/