From 0e2b8a390e9c9b01920812a65ebd88e0fbad4d3a Mon Sep 17 00:00:00 2001
Message-Id: <0e2b8a390e9c9b01920812a65ebd88e0fbad4d3a.1542624780.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 1 Oct 2018 15:37:48 +0300
Subject: [PATCH] Take %_prefix into account when compressing man pages etc,
take II
brp-compress used to be all hardcoded around /usr for no good reason.
Support passing prefix as an argument and only look for things to
compress there. First attempt in 5e65f92b53ca07c6e30921688c1b84d0a6b41db7
had an embarrassing typo/thinko/case of missing brain in the assign syntax.
Based on feedback and work of Owen Taylor and Yanko Kaneti in PR #538
---
platform.in | 2 +-
scripts/brp-compress | 12 ++++++++----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/platform.in b/platform.in
index 6ccdaf23d..3eb67b55b 100644
--- a/platform.in
+++ b/platform.in
@@ -69,7 +69,7 @@
# Standard brp-macro naming:
# convert all '-' in basename to '_', add two leading underscores.
-%__brp_compress %{_rpmconfigdir}/brp-compress
+%__brp_compress %{_rpmconfigdir}/brp-compress %{?_prefix}
%__brp_java_gcjcompile %{_rpmconfigdir}/brp-java-bytecompile
%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
%__brp_strip %{_rpmconfigdir}/brp-strip %{__strip}
diff --git a/scripts/brp-compress b/scripts/brp-compress
index e6b69a9e4..e4307eff7 100755
--- a/scripts/brp-compress
+++ b/scripts/brp-compress
@@ -5,16 +5,20 @@ if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
+PREFIX=${1:-/usr}
+
cd "$RPM_BUILD_ROOT"
# Compress man pages
COMPRESS=${COMPRESS:-gzip -9 -n}
COMPRESS_EXT=${COMPRESS_EXT:-.gz}
-for d in ./usr/man/man* ./usr/man/*/man* ./usr/info \
- ./usr/share/man/man* ./usr/share/man/*/man* ./usr/share/info \
- ./usr/kerberos/man ./usr/X11R6/man/man* ./usr/lib/perl5/man/man* \
- ./usr/share/doc/*/man/man* ./usr/lib/*/man/man* ./usr/share/fish/man/man*
+for d in .${PREFIX}/man/man* .${PREFIX}/man/*/man* .${PREFIX}/info \
+ .${PREFIX}/share/man/man* .${PREFIX}/share/man/*/man* \
+ .${PREFIX}/share/info .${PREFIX}/kerberos/man \
+ .${PREFIX}/X11R6/man/man* .${PREFIX}/lib/perl5/man/man* \
+ .${PREFIX}/share/doc/*/man/man* .${PREFIX}/lib/*/man/man* \
+ .${PREFIX}/share/fish/man/man*
do
[ -d $d ] || continue
for f in `find $d -type f ! -name dir`
--
2.19.1