spec: mangle /usr/bin/python shebangs to /usr/bin/python3

- From Fedora spec file
- Only for dom0 >= Fedora 31
This commit is contained in:
Frédéric Pierret (fepitre) 2019-11-23 11:11:48 +01:00
parent 18d5d66d02
commit fb9b485ccf
No known key found for this signature in database
GPG Key ID: 484010B5CDC576E2

View File

@ -150,6 +150,27 @@ cd linux-%upstream_version
# drop EXTRAVERSION - possible -rc suffix already included in %release # drop EXTRAVERSION - possible -rc suffix already included in %release
sed -i -e 's/^EXTRAVERSION = -rc.*/EXTRAVERSION =/' Makefile sed -i -e 's/^EXTRAVERSION = -rc.*/EXTRAVERSION =/' Makefile
%if 0%{?fedora} >= 31
# Mangle /usr/bin/python shebangs to /usr/bin/python3
# Mangle all Python shebangs to be Python 3 explicitly
# -p preserves timestamps
# -n prevents creating ~backup files
# -i specifies the interpreter for the shebang
# This fixes errors such as
# *** ERROR: ambiguous python shebang in /usr/bin/kvm_stat: #!/usr/bin/python. Change it to python3 (or python2) explicitly.
# We patch all sources below for which we got a report/error.
pathfix.py -i "%{__python3} %{py3_shbang_opts}" -p -n \
tools/kvm/kvm_stat/kvm_stat \
scripts/show_delta \
scripts/diffconfig \
scripts/bloat-o-meter \
tools/perf/tests/attr.py \
tools/perf/scripts/python/stat-cpi.py \
tools/perf/scripts/python/sched-migration.py \
Documentation \
scripts/gen_compile_commands.py
%endif
cd %kernel_build_dir cd %kernel_build_dir
# Create QubesOS config kernel # Create QubesOS config kernel
@ -266,6 +287,11 @@ fi
rm -rf %buildroot/lib/modules/%kernelrelease/build/Documentation rm -rf %buildroot/lib/modules/%kernelrelease/build/Documentation
# Remove useless scripts that creates ERROR with ambiguous shebang
# that are removed too in Fedora
rm -rf %buildroot/lib/modules/%kernelrelease/build/scripts/tracing
rm -f %buildroot/lib/modules/%kernelrelease/build/scripts/spdxcheck.py
# disable GCC plugins for external modules build, to not fail if different gcc # disable GCC plugins for external modules build, to not fail if different gcc
# version is used # version is used
sed -e 's/^\(CONFIG_GCC_PLUGIN.*\)=y/# \1 is not set/' .config > \ sed -e 's/^\(CONFIG_GCC_PLUGIN.*\)=y/# \1 is not set/' .config > \