From fdce9c67af952a8b957653f6e4e6cb2c1f65ce92 Mon Sep 17 00:00:00 2001 From: Ben Burton Date: Mon, 19 Apr 2021 21:02:49 +0200 Subject: [PATCH] Adapt macros and BRP scripts for %topdir with spaces Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1947416 --- brp-python-bytecompile | 10 +++++----- macros | 2 +- redhat-rpm-config.spec | 6 +++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/brp-python-bytecompile b/brp-python-bytecompile index ead7022..71f4d2d 100755 --- a/brp-python-bytecompile +++ b/brp-python-bytecompile @@ -38,7 +38,7 @@ function python_bytecompile() local options=$1 local python_binary=$2 local exclude=$3 - local python_libdir=$4 + local python_libdir="$4" local depth=$5 # 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 # -s strips $RPM_BUILD_ROOT from the path # -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 @@ -73,7 +73,7 @@ function python_bytecompile() # -x and -e together implements the same functionality as the Filter class below # -s strips $RPM_BUILD_ROOT from the path # -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 # # Python 3.3 and lower (incl. Python 2) @@ -119,9 +119,9 @@ fi export PYTHONHASHSEED=0 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 - python_binary=$(basename $python_libdir) + python_binary=$(basename "$python_libdir") real_libdir=${python_libdir/$RPM_BUILD_ROOT/} echo "Bytecompiling .py files below $python_libdir using $python_binary" diff --git a/macros b/macros index f7c4e37..2e3072d 100644 --- a/macros +++ b/macros @@ -226,7 +226,7 @@ print(result) %__spec_install_pre %{___build_pre}\ [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\ - mkdir -p `dirname "$RPM_BUILD_ROOT"`\ + mkdir -p "`dirname "$RPM_BUILD_ROOT"`"\ mkdir "$RPM_BUILD_ROOT"\ %{nil} diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 509376b..e95a2e6 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 188 +Version: 189 Release: 1%{?dist} # No version specified. License: GPL+ @@ -221,6 +221,10 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Mon Jun 28 2021 Ben Burton - 189-1 +- Adapt macros and BRP scripts for %%topdir with spaces +- Fixes rhbz#1947416 + * Tue Jun 22 2021 Panu Matilainen - 188-1 - Drop reference to now extinct brp-python-hardlink script