2022-12-02 15:17:05 +01:00
|
|
|
--- scripts/brp-compress.orig 2022-04-07 11:13:19.072518377 +0000
|
|
|
|
+++ scripts/brp-compress 2022-12-02 13:12:31.239774558 +0000
|
2019-10-02 15:28:11 +02:00
|
|
|
@@ -5,6 +5,9 @@ if [ -z "$RPM_BUILD_ROOT" ] || [ "$RPM_B
|
2006-12-19 00:17:44 +01:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
+LC_ALL=
|
|
|
|
+LANG=
|
|
|
|
+LC_TIME=POSIX
|
2019-10-02 15:28:11 +02:00
|
|
|
PREFIX=${1:-/usr}
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2019-10-02 15:28:11 +02:00
|
|
|
cd "$RPM_BUILD_ROOT"
|
2020-10-27 11:36:01 +01:00
|
|
|
@@ -13,6 +16,30 @@ cd "$RPM_BUILD_ROOT"
|
2017-01-19 16:41:55 +01:00
|
|
|
COMPRESS=${COMPRESS:-gzip -9 -n}
|
|
|
|
COMPRESS_EXT=${COMPRESS_EXT:-.gz}
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2015-01-23 18:36:17 +01:00
|
|
|
+check_for_hard_link()
|
2006-12-19 00:17:44 +01:00
|
|
|
+{
|
|
|
|
+ dir=$1
|
|
|
|
+ b=$2
|
|
|
|
+
|
|
|
|
+ inode=`ls -i $b | awk '{ print $1 }'`
|
|
|
|
+ others=`find $dir -type f -inum $inode`
|
|
|
|
+ for afile in $others ; do
|
2011-05-16 18:07:44 +02:00
|
|
|
+ [ "$afile" != "$b" ] && rm -f "$afile"
|
2006-12-19 00:17:44 +01:00
|
|
|
+ done
|
|
|
|
+
|
2010-03-26 11:56:28 +01:00
|
|
|
+ case $b in
|
|
|
|
+ *.Z|*.gz) gunzip $b ;;
|
|
|
|
+ *.bz2) bunzip2 $b ;;
|
2011-05-16 18:07:44 +02:00
|
|
|
+ *.xz|*.lzma) unxz $b ;;
|
2020-10-27 11:36:01 +01:00
|
|
|
+ *.zst|*.zstd) unzstd --rm $b ;;
|
2006-12-19 00:17:44 +01:00
|
|
|
+ esac
|
|
|
|
+
|
2010-03-26 11:56:28 +01:00
|
|
|
+ type=${b##*.}
|
2006-12-19 00:17:44 +01:00
|
|
|
+ for afile in $others ; do
|
|
|
|
+ [ "${afile%.$type}" != "${b%.$type}" ] && ln ${b%.$type} ${afile%.$type}
|
|
|
|
+ done
|
|
|
|
+}
|
|
|
|
+
|
2019-10-02 15:28:11 +02:00
|
|
|
for d in .${PREFIX}/man/man* .${PREFIX}/man/*/man* .${PREFIX}/info \
|
2022-12-02 15:17:05 +01:00
|
|
|
.${PREFIX}/share/man/man* .${PREFIX}/share/man/*/man* \
|
|
|
|
.${PREFIX}/share/info .${PREFIX}/kerberos/man \
|
|
|
|
@@ -26,10 +53,10 @@ do
|
|
|
|
[ -f "$f" ] || continue
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2022-12-02 15:17:05 +01:00
|
|
|
case "$f" in
|
|
|
|
- *.gz|*.Z) gunzip -f "$f"; b=`echo "$f" | sed -e 's/\.\(gz\|Z\)$//'`;;
|
|
|
|
- *.bz2) bunzip2 -f "$f"; b=`echo "$f" | sed -e 's/\.bz2$//'`;;
|
|
|
|
- *.xz|*.lzma) unxz -f "$f"; b=`echo "$f" | sed -e 's/\.\(xz\|lzma\)$//'`;;
|
|
|
|
- *.zst|*.zstd) unzstd -f --rm $f; b=`echo "$f" | sed -e 's/\.\(zst\|zstd\)$//'`;;
|
|
|
|
+ *.gz|*.Z) gunzip -f "$f"; check_for_hard_link $d "$f"; b=`echo "$f" | sed -e 's/\.\(gz\|Z\)$//'`;;
|
|
|
|
+ *.bz2) bunzip2 -f "$f"; check_for_hard_link $d "$f"; b=`echo "$f" | sed -e 's/\.bz2$//'`;;
|
|
|
|
+ *.xz|*.lzma) unxz -f "$f"; check_for_hard_link $d "$f"; b=`echo "$f" | sed -e 's/\.\(xz\|lzma\)$//'`;;
|
|
|
|
+ *.zst|*.zstd) unzstd -f --rm $f; check_for_hard_link $d "$f"; b=`echo "$f" | sed -e 's/\.\(zst\|zstd\)$//'`;;
|
|
|
|
*) b="$f";;
|
|
|
|
esac
|
2006-12-19 00:17:44 +01:00
|
|
|
|
2022-12-02 15:17:05 +01:00
|
|
|
@@ -38,7 +65,7 @@ do
|
|
|
|
others="`find $d -type f -inum $inode`"
|
|
|
|
if [ -n "$others" ]; then
|
2010-12-08 15:59:30 +01:00
|
|
|
for afile in $others ; do
|
|
|
|
- [ "$afile" != "$b" ] && rm -f $afile
|
|
|
|
+ [ "$afile" != "$b" ] && rm -f "$afile"
|
|
|
|
done
|
2022-12-02 15:17:05 +01:00
|
|
|
$COMPRESS -f "$b"
|
2010-12-08 15:59:30 +01:00
|
|
|
for afile in $others ; do
|
2022-12-02 15:17:05 +01:00
|
|
|
@@ -52,9 +79,9 @@ do
|
2010-12-08 15:59:30 +01:00
|
|
|
|
2022-12-02 15:17:05 +01:00
|
|
|
find $d -type l -print0 |
|
|
|
|
while IFS= read -r -d '' f; do
|
|
|
|
- l=`ls -l $f | sed -e 's/.* -> //' -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\|zst\|zstd\)$//'`
|
|
|
|
- rm -f $f
|
|
|
|
- b=`echo $f | sed -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\|zst\|zstd\)$//'`
|
|
|
|
+ l=`ls -l "$f" | sed -e 's/.* -> //' -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\|zst\|zstd\)$//'`
|
|
|
|
+ rm -f "$f"
|
|
|
|
+ b=`echo "$f" | sed -e 's/\.\(gz\|Z\|bz2\|xz\|lzma\|zst\|zstd\)$//'`
|
|
|
|
ln -sf "$l$COMPRESS_EXT" "$b$COMPRESS_EXT"
|
2020-10-27 16:27:01 +01:00
|
|
|
done
|
|
|
|
done
|