Remove obscure uses of shell redirections.

This patch makes the spec file slightly more friendly to non-shell
readers by changing "> foo" to "truncate -s 0 foo" and removes
the use of ">> foo". The use of ">> foo" is perhaps the most
interesting shell trick which is used to create a zero sized
debuginfocommon.filelist, but only if it doesn't already exist.
This allows the subsequent command to use debuginfocommon.filelist
without requiring it be wrapped in a check for
%{debuginfocommonarches}. That seems a little obtuse and certainly
confusing to the reader who expects such a check for anything
that is related to the debuginfo common package.
This commit is contained in:
Carlos O'Donell 2013-07-25 20:17:30 -04:00
parent 2eb150368a
commit 02e8252613
1 changed files with 13 additions and 11 deletions

View File

@ -895,17 +895,17 @@ install -m 644 releng/nscd.service releng/nscd.socket $RPM_BUILD_ROOT/lib/system
# Include ld.so.conf
echo 'include ld.so.conf.d/*.conf' > $RPM_BUILD_ROOT/etc/ld.so.conf
> $RPM_BUILD_ROOT/etc/ld.so.cache
truncate -size 0 $RPM_BUILD_ROOT/etc/ld.so.cache
chmod 644 $RPM_BUILD_ROOT/etc/ld.so.conf
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
%ifnarch %{auxarches}
mkdir -p $RPM_BUILD_ROOT/etc/sysconfig
> $RPM_BUILD_ROOT/etc/sysconfig/nscd
> $RPM_BUILD_ROOT/etc/gai.conf
truncate -size 0 $RPM_BUILD_ROOT/etc/sysconfig/nscd
truncate -size 0 $RPM_BUILD_ROOT/etc/gai.conf
%endif
# Include %{_prefix}/%{_lib}/gconv/gconv-modules.cache
> $RPM_BUILD_ROOT%{_prefix}/%{_lib}/gconv/gconv-modules.cache
truncate -size 0 $RPM_BUILD_ROOT%{_prefix}/%{_lib}/gconv/gconv-modules.cache
chmod 644 $RPM_BUILD_ROOT%{_prefix}/%{_lib}/gconv/gconv-modules.cache
##############################################################################
@ -1083,7 +1083,7 @@ sed -i -e '\|%{_prefix}/bin|d' \
##############################################################################
# Build the xen package file list (nosegneg.filelist)
##############################################################################
> nosegneg.filelist
truncate -size 0 nosegneg.filelist
%if %{xenpackage}
grep '/%{_lib}/%{nosegneg_subdir}' < rpm.filelist >> nosegneg.filelist
sed -i -e '\|/%{_lib}/%{nosegneg_subdir}|d' rpm.filelist
@ -1334,11 +1334,13 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
# Delete files that we do not intended to ship with the auxarch.
echo Cutting down the list of unpackaged files
>> debuginfocommon.filelist
sed -e '/%%dir/d;/%%config/d;/%%verify/d;s/%%lang([^)]*) //;s#^/*##' \
common.filelist devel.filelist static.filelist headers.filelist \
utils.filelist nscd.filelist debuginfocommon.filelist |
(cd $RPM_BUILD_ROOT; xargs --no-run-if-empty rm -f 2> /dev/null || :)
common.filelist devel.filelist static.filelist headers.filelist \
utils.filelist nscd.filelist \
%ifarch %{debuginfocommonarches}
debuginfocommon.filelist \
%endif
| (cd $RPM_BUILD_ROOT; xargs --no-run-if-empty rm -f 2> /dev/null || :)
# The auxarch doesn't install pt_chown.
rm -f $RPM_BUILD_ROOT%{_prefix}/libexec/pt_chown
@ -1352,11 +1354,11 @@ touch $RPM_BUILD_ROOT/var/run/nscd/{socket,nscd.pid}
%endif # %{auxarches}
%ifnarch %{auxarches}
> $RPM_BUILD_ROOT/%{_prefix}/lib/locale/locale-archive
truncate -size 0 $RPM_BUILD_ROOT/%{_prefix}/lib/locale/locale-archive
%endif
mkdir -p $RPM_BUILD_ROOT/var/cache/ldconfig
> $RPM_BUILD_ROOT/var/cache/ldconfig/aux-cache
truncate -size 0 $RPM_BUILD_ROOT/var/cache/ldconfig/aux-cache
%pre -p <lua>
-- Check that the running kernel is new enough