Drop brp-* scripts needlessly duplicated with rpm

One possible incompatibility, hopefully non-issue: our brp-strip*
allowed setting strip and objdump to use via args and STRIP and
OBJDUMP env vars whereas the rpm ones allow it through args only
(i.e. %{__strip} and %{__objdump} as far as specfiles are concerned).
This commit is contained in:
Ville Skyttä 2014-04-27 16:53:45 +03:00
parent 20c7e01657
commit 82a41dfa6a
8 changed files with 8 additions and 162 deletions

View File

@ -1,56 +0,0 @@
#!/bin/sh
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
cd $RPM_BUILD_ROOT
# Compress man pages
COMPRESS="gzip -9 -n"
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*
do
[ -d $d ] || continue
for f in `find $d -type f`
do
[ -f "$f" ] || continue
[ "`basename $f`" = "dir" ] && continue
case "$f" in
*.Z) gunzip -f $f; b=`echo $f | sed -e 's/\.Z$//'`;;
*.gz) gunzip -f $f; b=`echo $f | sed -e 's/\.gz$//'`;;
*.bz2) bunzip2 -f $f; b=`echo $f | sed -e 's/\.bz2$//'`;;
*) b=$f;;
esac
$COMPRESS $b </dev/null 2>/dev/null || {
inode=`ls -i $b | awk '{ print $1 }'`
others=`find $d -type f -inum $inode`
if [ -n "$others" ]; then
for afile in $others ; do
[ "$afile" != "$b" ] && rm -f $afile
done
$COMPRESS -f $b
for afile in $others ; do
[ "$afile" != "$b" ] && ln $b$COMPRESS_EXT $afile$COMPRESS_EXT
done
else
$COMPRESS -f $b
fi
}
done
for f in `find $d -type l`
do
l=`ls -l $f | sed -e 's/.* -> //' -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
rm -f $f
b=`echo $f | sed -e 's/\.gz$//' -e 's/\.bz2$//' -e 's/\.Z$//'`
ln -sf $l$COMPRESS_EXT $b$COMPRESS_EXT
done
done

View File

@ -1,19 +0,0 @@
#!/bin/sh
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
# Hardlink identical *.pyc and *.pyo, originally from PLD's rpm-build-macros
# Modified to use sha1sum instead of cmp to avoid a diffutils dependency.
find "$RPM_BUILD_ROOT" -type f -name "*.pyc" | while read pyc ; do
pyo="$(echo $pyc | sed -e 's/.pyc$/.pyo/')"
if [ -f "$pyo" ] ; then
csha="$(sha1sum -b "$pyc" | cut -d' ' -f 1)" && \
osha="$(sha1sum -b "$pyo" | cut -d' ' -f 1)" && \
if [ "$csha" = "$osha" ] ; then
ln -f "$pyc" "$pyo"
fi
fi
done

View File

@ -1,14 +0,0 @@
#!/bin/sh
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
[ -z "$STRIP" ] && STRIP=strip
# Strip ELF binaries
for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
grep -v ' shared object,' | \
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
$STRIP -g "$f" || :
done

View File

@ -1,23 +0,0 @@
#!/bin/sh
# If using normal root, avoid changing anything.
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
[ -z "$OBJDUMP" -a -n "$2" ] && OBJDUMP="$2"
[ -z "$STRIP" ] && STRIP=strip
[ -z "$OBJDUMP" ] && OBJDUMP=objdump
# Strip .comment and .note sections (the latter only if it is not allocated)
# for already stripped elf files in the build root
for f in `find $RPM_BUILD_ROOT -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped/\1/p'`; do
note="-R .note"
if $OBJDUMP -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
grep ALLOC >/dev/null; then
note=
fi
$STRIP -R .comment $note "$f" || :
done

View File

@ -1,20 +0,0 @@
#!/bin/sh
# Conectiva brp - strip shared libraries. Based on Red Hat's brp-strip.
# Thu Apr 20 - Guilherme Manika <gwm@conectiva.com.br>
# Created file
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
[ -z "$STRIP" ] && STRIP=strip
# Strip ELF shared objects
# Please note we don't restrict our search to executable files because
# our libraries are not (should not be, at least) +x.
for f in `find $RPM_BUILD_ROOT -type f -a -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
grep ' shared object,' | \
sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped/\1/p'`; do
$STRIP --strip-unneeded "$f"
done

View File

@ -1,16 +0,0 @@
#!/bin/sh
if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then
exit 0
fi
[ -z "$STRIP" -a -n "$1" ] && STRIP="$1"
[ -z "$STRIP" ] && STRIP=strip
# Strip static libraries.
for f in `find $RPM_BUILD_ROOT -name \*.a -a -exec file {} \; | \
grep -v "^${RPM_BUILD_ROOT}/\?usr/lib/debug" | \
grep 'current ar archive' | \
sed -n -e 's/^\(.*\):[ ]*current ar archive/\1/p'`; do
$STRIP -g "$f"
done

10
macros
View File

@ -85,14 +85,14 @@
%__arch_install_post /usr/lib/rpm/check-buildroot %__arch_install_post /usr/lib/rpm/check-buildroot
%__os_install_post \ %__os_install_post \
/usr/lib/rpm/redhat/brp-compress \ /usr/lib/rpm/brp-compress \
%{!?__debug_package:\ %{!?__debug_package:\
/usr/lib/rpm/redhat/brp-strip %{__strip} \ /usr/lib/rpm/brp-strip %{__strip} \
/usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \ /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump} \
} \ } \
/usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \ /usr/lib/rpm/brp-strip-static-archive %{__strip} \
/usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} \ /usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} \
/usr/lib/rpm/redhat/brp-python-hardlink \ /usr/lib/rpm/brp-python-hardlink \
%{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \ %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \
%{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: 18 Version: 19
Release: 1%{?dist} Release: 1%{?dist}
# No version specified. # No version specified.
License: GPL+ License: GPL+
@ -36,14 +36,8 @@ Source150: macros.dwz
Source151: macros.kmp Source151: macros.kmp
# Build policy scripts # Build policy scripts
Source200: brp-compress
Source201: brp-implant-ident-static Source201: brp-implant-ident-static
Source202: brp-java-repack-jars Source202: brp-java-repack-jars
Source203: brp-python-hardlink
Source204: brp-strip
Source205: brp-strip-comment-note
Source206: brp-strip-shared
Source207: brp-strip-static-archive
# Dependency generator scripts (deprecated) # Dependency generator scripts (deprecated)
Source300: find-provides Source300: find-provides
@ -142,8 +136,8 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov
%{_rpmconfigdir}/macros.d/macros.kmp %{_rpmconfigdir}/macros.d/macros.kmp
%changelog %changelog
* Sun Apr 27 2014 Ville Skyttä <ville.skytta@iki.fi> * Sun Apr 27 2014 Ville Skyttä <ville.skytta@iki.fi> - 19-1
- Drop bunch of macro definitions needlessly duplicated with rpm - Drop bunch of duplicated-with-rpm macro definitions and brp-* scripts
* Tue Apr 15 2014 Panu Matilainen <pmatilai@redhat.com> - 18-1 * Tue Apr 15 2014 Panu Matilainen <pmatilai@redhat.com> - 18-1
- Temporarily bring back find-requires and -provides scripts to rrc-side - Temporarily bring back find-requires and -provides scripts to rrc-side