SHA256
1
0
forked from pool/llvm17

- 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/llvm17?expand=0&rev=29
This commit is contained in:
Aaron Puchert 2024-08-23 00:42:45 +00:00 committed by Git OBS Bridge
parent 9172813bd9
commit 88610a9c69
2 changed files with 17 additions and 24 deletions

View File

@ -1,8 +1,8 @@
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Jun 11 19:14:57 UTC 2024 - Matej Cepl <mcepl@cepl.eu> Tue Aug 20 21:20:37 UTC 2024 - Aaron Puchert <aaronpuchert@alice-dsl.net>
- Add %python3_fix_shebang_path to fix binaries dependency on - Add minor version to Python shebangs. (boo#1212476)
/usr/bin/python3 (bsc#1212476). - Remove shebang and executable bit where not needed.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Apr 3 20:18:07 UTC 2024 - Aaron Puchert <aaronpuchert@alice-dsl.net> Wed Apr 3 20:18:07 UTC 2024 - Aaron Puchert <aaronpuchert@alice-dsl.net>

View File

@ -1328,8 +1328,8 @@ cat > %{buildroot}%{_rpmconfigdir}/macros.d/macros.llvm <<EOF
%_llvm_with_lldb %{with lldb} %_llvm_with_lldb %{with lldb}
EOF EOF
# Don't use env in shebangs, and prefer python3. (https://www.python.org/dev/peps/pep-0394/#for-python-runtime-distributors) # Don't use env in shebangs, and prefer python3.X. (https://www.python.org/dev/peps/pep-0394/#for-python-runtime-distributors)
for script in %{buildroot}%{_bindir}/opt-{diff,stats,viewer} \ sed -i -E "1s|/usr/bin/env *|/usr/bin/|; 1s|/usr/bin/python3?\$|$(realpath /usr/bin/python3)|" \
%if %{_plv} == %{_sonum} %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}%{_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} \ %{buildroot}%{_libexecdir}/{{analyze,intercept}-{c++,cc},{c++,ccc}-analyzer} \
@ -1337,13 +1337,21 @@ for script in %{buildroot}%{_bindir}/opt-{diff,stats,viewer} \
%ifarch aarch64 x86_64 %ifarch aarch64 x86_64
%{buildroot}%{_libdir}/clang/%{_sonum}/bin/hwasan_symbolize \ %{buildroot}%{_libdir}/clang/%{_sonum}/bin/hwasan_symbolize \
%endif %endif
%{buildroot}%{python3_sitelib}/optrecord.py; do %{buildroot}%{_bindir}/opt-{diff,stats,viewer}
sed -i '1s|/usr/bin/env *|%{_bindir}/|;1s|/usr/bin/python$|%{_bindir}/python3|' $script
done # Remove shebangs where not needed.
sed -i '1{ /^#!/d }' \
%if %{_plv} == %{_sonum}
%{buildroot}%{_datadir}/scan-view/{Reporter,startfile}.py \
%endif
%if %{with lldb_python}
%{buildroot}%{python3_sitearch}/lldb/utils/{in_call_stack,symbolication}.py \
%endif
%{buildroot}%{python3_sitelib}/optrecord.py
# Remove executable bit where not needed. # Remove executable bit where not needed.
chmod -x \ chmod -x \
%{buildroot}%{python3_sitelib}/optpmap.py \ %{buildroot}%{python3_sitelib}/opt{pmap,record}.py \
%{buildroot}%{_datadir}/opt-viewer/style.css \ %{buildroot}%{_datadir}/opt-viewer/style.css \
%if %{_plv} == %{_sonum} %if %{_plv} == %{_sonum}
%{buildroot}%{_datadir}/bash-completion/completions/clang \ %{buildroot}%{_datadir}/bash-completion/completions/clang \
@ -1432,21 +1440,6 @@ python3 bin/llvm-lit -sv projects/libcxxabi/test/
%endif %endif
popd popd
# 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)"
# Remove files that won't be needed anymore. # Remove files that won't be needed anymore.
# This reduces the total amount of disk space used during build. (bnc#1074625) # This reduces the total amount of disk space used during build. (bnc#1074625)
# This is meant to happen after build, install and check, but before # This is meant to happen after build, install and check, but before