Move some of the rpm scriptlets back to %posttrans

This partially reverts commit 38d8a9c2.

glib-compile-schemas and gtk-update-icon-cache are deliberately split up
between %post and %posttrans to optimize the scriptlet run time with
multi-package transactions.

Instead of regenerating the whole icon cache after every single package
install (in %post), this splits it in two: in %post, there's just a
"touch %{_datadir}/icons/hicolor", and the icon cache is later
regenerated once after the whole transaction (in %posttrans). The very
first gtk-update-icon-cache call in %posttrans regenerates the cache,
and the subsequent ones are no-op because the icon files (and directory
timestamps) don't change during the sequential %posttrans runs.

http://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Icon_Cache
This commit is contained in:
Kalev Lember 2012-11-09 21:42:04 +01:00
parent 8d1dfda620
commit 97501a9135

View File

@ -3,7 +3,7 @@
Name: dconf
Version: 0.15.0
Release: 2%{?dist}
Release: 3%{?dist}
Summary: A configuration system
Group: System Environment/Base
@ -61,19 +61,20 @@ make install DESTDIR=$RPM_BUILD_ROOT
%post
/sbin/ldconfig
gio-querymodules-%{__isa_bits} %{_libdir}/gio/modules
glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
touch --no-create %{_datadir}/icons/hicolor >&/dev/null || :
gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null || :
%postun
/sbin/ldconfig
if [ $1 -eq 0 ] ; then
/sbin/ldconfig
gio-querymodules-%{__isa_bits} %{_libdir}/gio/modules
glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
touch --no-create %{_datadir}/icons/hicolor >&/dev/null || :
gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null || :
fi
%posttrans
glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null || :
%files -f dconf.lang
%doc COPYING
@ -109,6 +110,10 @@ fi
%{_mandir}/man1/dconf-editor.1.gz
%changelog
* Fri Nov 09 2012 Kalev Lember <kalevlember@gmail.com> - 0.15.0-3
- Move some of the rpm scriptlets back to %%posttrans
(glib-compile-schemas, icon cache)
* Thu Nov 8 2012 Marek Kasik <mkasik@redhat.com> - 0.15.0-2
- Move dconf-editor's man page to the dconf-editor sub-package