Adapt macros and BRP scripts for %topdir with spaces

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1947416
This commit is contained in:
Ben Burton 2021-04-19 21:02:49 +02:00 committed by Lumir Balhar
parent def9a339d2
commit fdce9c67af
3 changed files with 11 additions and 7 deletions

View File

@ -38,7 +38,7 @@ function python_bytecompile()
local options=$1 local options=$1
local python_binary=$2 local python_binary=$2
local exclude=$3 local exclude=$3
local python_libdir=$4 local python_libdir="$4"
local depth=$5 # Not used for Python >= 3.4 local depth=$5 # Not used for Python >= 3.4
local real_libdir=$6 # Not used for Python >= 3.4 local real_libdir=$6 # Not used for Python >= 3.4
@ -57,7 +57,7 @@ function python_bytecompile()
# -x and -e together implements the same functionality as the Filter class below # -x and -e together implements the same functionality as the Filter class below
# -s strips $RPM_BUILD_ROOT from the path # -s strips $RPM_BUILD_ROOT from the path
# -p prepends the leading slash to the path to make it absolute # -p prepends the leading slash to the path to make it absolute
$python_binary -B $options -m compileall -q -f $exclude -s $RPM_BUILD_ROOT -p / -e $RPM_BUILD_ROOT $python_libdir $python_binary -B $options -m compileall -q -f $exclude -s "$RPM_BUILD_ROOT" -p / -e "$RPM_BUILD_ROOT" "$python_libdir"
# #
# Python 3.4 and higher # Python 3.4 and higher
@ -73,7 +73,7 @@ function python_bytecompile()
# -x and -e together implements the same functionality as the Filter class below # -x and -e together implements the same functionality as the Filter class below
# -s strips $RPM_BUILD_ROOT from the path # -s strips $RPM_BUILD_ROOT from the path
# -p prepends the leading slash to the path to make it absolute # -p prepends the leading slash to the path to make it absolute
PYTHONPATH=/usr/lib/rpm/redhat/ $python_binary -B $options -m compileall2 -q -f $exclude -s $RPM_BUILD_ROOT -p / -e $RPM_BUILD_ROOT $python_libdir PYTHONPATH=/usr/lib/rpm/redhat/ $python_binary -B $options -m compileall2 -q -f $exclude -s "$RPM_BUILD_ROOT" -p / -e "$RPM_BUILD_ROOT" "$python_libdir"
else else
# #
# Python 3.3 and lower (incl. Python 2) # Python 3.3 and lower (incl. Python 2)
@ -119,9 +119,9 @@ fi
export PYTHONHASHSEED=0 export PYTHONHASHSEED=0
shopt -s nullglob shopt -s nullglob
for python_libdir in `find "$RPM_BUILD_ROOT" -type d|grep -E "/(usr|app)/lib(64)?/python[0-9]\.[0-9]+$"`; find "$RPM_BUILD_ROOT" -type d -print0|grep -z -E "/(usr|app)/lib(64)?/python[0-9]\.[0-9]+$" | while read -d "" python_libdir;
do do
python_binary=$(basename $python_libdir) python_binary=$(basename "$python_libdir")
real_libdir=${python_libdir/$RPM_BUILD_ROOT/} real_libdir=${python_libdir/$RPM_BUILD_ROOT/}
echo "Bytecompiling .py files below $python_libdir using $python_binary" echo "Bytecompiling .py files below $python_libdir using $python_binary"

2
macros
View File

@ -226,7 +226,7 @@ print(result)
%__spec_install_pre %{___build_pre}\ %__spec_install_pre %{___build_pre}\
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\ [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
mkdir -p `dirname "$RPM_BUILD_ROOT"`\ mkdir -p "`dirname "$RPM_BUILD_ROOT"`"\
mkdir "$RPM_BUILD_ROOT"\ mkdir "$RPM_BUILD_ROOT"\
%{nil} %{nil}

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config Name: redhat-rpm-config
Version: 188 Version: 189
Release: 1%{?dist} Release: 1%{?dist}
# No version specified. # No version specified.
License: GPL+ License: GPL+
@ -221,6 +221,10 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%{_rpmconfigdir}/macros.d/macros.kmp %{_rpmconfigdir}/macros.d/macros.kmp
%changelog %changelog
* Mon Jun 28 2021 Ben Burton <bab@debian.org> - 189-1
- Adapt macros and BRP scripts for %%topdir with spaces
- Fixes rhbz#1947416
* Tue Jun 22 2021 Panu Matilainen <pmatilai@redhat.com> - 188-1 * Tue Jun 22 2021 Panu Matilainen <pmatilai@redhat.com> - 188-1
- Drop reference to now extinct brp-python-hardlink script - Drop reference to now extinct brp-python-hardlink script