Switch 3 macros to bcond's

%with_rewheel -> rewheel
%with_debug_build -> debug_build
%run_selftest_suite -> tests
This commit is contained in:
Tomas Orsava 2017-08-02 15:30:21 +02:00
parent b726831413
commit 3cf18aa55e
1 changed files with 31 additions and 31 deletions

View File

@ -34,7 +34,7 @@
# rebuild after a python abi change:
# python-sphinx, pytest, python-requests, cloud-init, dnf, anaconda, abrt
%global with_rewheel 0
%bcond_without rewheel
%global pybasever 3.6
@ -85,7 +85,7 @@
%global py_INSTSONAME_optimized libpython%{LDVERSION_optimized}.so.%{py_SOVERSION}
%global py_INSTSONAME_debug libpython%{LDVERSION_debug}.so.%{py_SOVERSION}
%global with_debug_build 1
%bcond_without debug_build
%global with_gdb_hooks 1
@ -103,8 +103,7 @@
# Change from yes to no to turn this off
%global with_computed_gotos yes
# Turn this to 0 to turn off the "check" phase:
%global run_selftest_suite 1
%bcond_without tests
# We want to byte-compile the .py files within the packages using the new
# python3 binary.
@ -194,7 +193,7 @@ BuildRequires: valgrind-devel
BuildRequires: xz-devel
BuildRequires: zlib-devel
%if 0%{?with_rewheel}
%if %{with rewheel}
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%endif
@ -486,7 +485,7 @@ Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Obsoletes: python%{pyshortver}
Provides: python%{pyshortver} = %{version}-%{release}
%if 0%{with_rewheel}
%if %{with rewheel}
Requires: python3-setuptools
Requires: python3-pip
%endif
@ -610,7 +609,7 @@ in production.
You might want to install the python3-test package if you're developing
python code that uses more than just unittest and/or test_support.py.
%if 0%{?with_debug_build}
%if %{with debug_build}
%package debug
Summary: Debug version of the Python runtime
Group: Applications/System
@ -641,7 +640,7 @@ It shares installation directories with the standard Python runtime, so that
.py and .pyc files can be shared. All compiled extension modules gain a "_d"
suffix ("foo_d.so" rather than "foo.so") so that each Python implementation
can load its own extensions.
%endif # with_debug_build
%endif # with debug_build
# ======================================================
# The prep phase of the build:
@ -677,7 +676,7 @@ rm -r Modules/zlib || exit 1
# rm Modules/$f
#done
%if 0%{with_rewheel}
%if %{with rewheel}
%global pip_version 9.0.1
sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/ensurepip/__init__.py
%endif
@ -709,7 +708,7 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en
%patch186 -p1
%patch188 -p1
%if 0%{with_rewheel}
%if %{with rewheel}
%patch189 -p1
%endif
@ -744,10 +743,11 @@ sed --in-place \
# ======================================================
%build
echo "=================== DEBUG PRINT [HUGO] ==================="
echo "run_selftest_suite: %run_selftest_suite"
echo "with_debug_build: %with_debug_build"
echo "=================== DEBUG PRINT ==================="
echo "=================== DEBUG PRINT: values of macros ==================="
echo "with rewheel: %{withrewheel}"
echo "with tests: %{with tests}"
echo "with debug_build: %{with debug_build}"
echo "================= END DEBUG PRINT: values of macros ================="
topdir=$(pwd)
export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"
@ -815,7 +815,7 @@ BuildPython() {
# Use "BuildPython" to support building with different configurations:
%if 0%{?with_debug_build}
%if %{with debug_build}
BuildPython debug \
python-debug \
python%{pybasever}-debug \
@ -826,7 +826,7 @@ BuildPython debug \
%endif
false \
-O0
%endif # with_debug_build
%endif # with debug_build
BuildPython optimized \
python \
@ -901,11 +901,11 @@ make install DESTDIR=%{buildroot} INSTALL="install -p" EXTRA_CFLAGS="$MoreCFlags
# Use "InstallPython" to support building with different configurations:
# Install the "debug" build first, so that we can move some files aside
%if 0%{?with_debug_build}
%if %{with debug_build}
InstallPython debug \
%{py_INSTSONAME_debug} \
-O0
%endif # with_debug_build
%endif # with debug_build
# Now the optimized build:
InstallPython optimized \
@ -971,7 +971,7 @@ install -d -m 0755 %{buildroot}/%{_prefix}/lib/python%{pybasever}/site-packages/
%global SOABI_optimized cpython-%{pyshortver}%{ABIFLAGS_optimized}-%{_arch}-linux%{_gnu}
%global SOABI_debug cpython-%{pyshortver}%{ABIFLAGS_debug}-%{_arch}-linux%{_gnu}
%if 0%{?with_debug_build}
%if %{with debug_build}
%global PyIncludeDirs python%{LDVERSION_optimized} python%{LDVERSION_debug}
%else
@ -1096,7 +1096,7 @@ done
# Create "/usr/bin/python3-debug", a symlink to the python3 debug binary, to
# avoid the user having to know the precise version and ABI flags. (see
# e.g. rhbz#676748):
%if 0%{?with_debug_build}
%if %{with debug_build}
ln -s \
%{_bindir}/python%{LDVERSION_debug} \
%{buildroot}%{_bindir}/python3-debug
@ -1122,7 +1122,7 @@ sed \
%{_sourcedir}/libpython.stp \
> %{buildroot}%{tapsetdir}/%{libpython_stp_optimized}
%if 0%{?with_debug_build}
%if %{with debug_build}
# In Python 3, python3 and python3-debug don't point to the same binary,
# so we have to replace "python3" with "python3-debug" to get systemtap
# working with debug build
@ -1131,7 +1131,7 @@ sed \
-e 's|"python3"|"python3-debug"|' \
%{_sourcedir}/libpython.stp \
> %{buildroot}%{tapsetdir}/%{libpython_stp_debug}
%endif # with_debug_build
%endif # with debug_build
%endif # with_systemtap
@ -1143,7 +1143,7 @@ echo '[ $? -eq 127 ] && echo "Could not find python%{LDVERSION_optimized}-`uname
%{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
chmod +x %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config
%if 0%{?with_debug_build}
%if %{with debug_build}
# Rename the -debug script that differs on different arches to arch specific name
mv %{buildroot}%{_bindir}/python%{LDVERSION_debug}-{,`uname -m`-}config
echo -e '#!/bin/sh\nexec `dirname $0`/python%{LDVERSION_debug}-`uname -m`-config "$@"' > \
@ -1151,7 +1151,7 @@ echo -e '#!/bin/sh\nexec `dirname $0`/python%{LDVERSION_debug}-`uname -m`-config
echo '[ $? -eq 127 ] && echo "Could not find python%{LDVERSION_debug}-`uname -m`-config. Look around to see available arches." >&2' >> \
%{buildroot}%{_bindir}/python%{LDVERSION_debug}-config
chmod +x %{buildroot}%{_bindir}/python%{LDVERSION_debug}-config
%endif # with_debug_build
%endif # with debug_build
# System Python: Copy the executable to libexec
mkdir -p %{buildroot}%{_libexecdir}
@ -1212,15 +1212,15 @@ CheckPython() {
}
%if 0%{run_selftest_suite}
%if %{with tests}
# Check each of the configurations:
%if 0%{?with_debug_build}
%if %{with debug_build}
CheckPython debug
%endif # with_debug_build
%endif # with debug_build
CheckPython optimized
%endif # run_selftest_suite
%endif # with tests
# ======================================================
@ -1300,7 +1300,7 @@ fi
%{pylibdir}/ensurepip/__pycache__/*%{bytecode_suffixes}
%exclude %{pylibdir}/ensurepip/_bundled
%if 0%{?with_rewheel}
%if %{with rewheel}
%dir %{pylibdir}/ensurepip/rewheel/
%dir %{pylibdir}/ensurepip/rewheel/__pycache__/
%{pylibdir}/ensurepip/rewheel/*.py
@ -1568,7 +1568,7 @@ fi
# Hence the manifest is the combination of analogous files in the manifests of
# all of the other subpackages
%if 0%{?with_debug_build}
%if %{with debug_build}
%files debug
%defattr(-,root,root,-)
@ -1678,7 +1678,7 @@ fi
%{dynload_dir}/_testcapi.%{SOABI_debug}.so
%{dynload_dir}/_testimportmultiple.%{SOABI_debug}.so
%endif # with_debug_build
%endif # with debug_build
# We put the debug-gdb.py file inside /usr/lib/debug to avoid noise from
# ldconfig (rhbz:562980).