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