diff --git a/SuSEconfig.gtk2 b/SuSEconfig.gtk2 index 7ef2044..48adb28 100644 --- a/SuSEconfig.gtk2 +++ b/SuSEconfig.gtk2 @@ -17,23 +17,6 @@ fi test -n "$ROOT" && exit 0 -# do we need to check for loaders? only on RPM Update or new installation -if test -f /var/adm/SuSEconfig/run-gtk ; then - - test -d /etc/gtk-2.0 || mkdir /etc/gtk-2.0 - - if [ -x $r/usr/bin/gtk-query-immodules-2.0 ] ; then - /usr/bin/gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules - fi - - if [ -x $r/usr/bin/gtk-query-immodules-2.0-64 ] ; then - /usr/bin/gtk-query-immodules-2.0-64 > /etc/gtk-2.0/gtk64.immodules - fi - - rm /var/adm/SuSEconfig/run-gtk - -fi - # Remove all old icon cache files to prevent keeping of empty # directories with icon-theme.cache after removing themes. if test -f $r/var/cache/gtk-2.0/icon-theme.cache-list ; then diff --git a/gtk2.changes b/gtk2.changes index 17369d4..f16abae 100644 --- a/gtk2.changes +++ b/gtk2.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Aug 25 12:09:21 CEST 2010 - vuntz@opensuse.org + +- Add RPM macros (macros.gtk2) to make it easier to handle + installation of a GTK+ 2 IM module. +- Update SuSEconfig.gtk2 to stop handling the update of the IM + module cache. +- Do not touch var/adm/SuSEconfig/run-gtk in %post anymore. + ------------------------------------------------------------------- Tue Aug 17 11:07:28 CEST 2010 - dimstar@opensuse.org diff --git a/gtk2.spec b/gtk2.spec index 255fe58..162aa6d 100644 --- a/gtk2.spec +++ b/gtk2.spec @@ -32,6 +32,7 @@ Source1: SuSEconfig.gtk2 Source2: README.SuSE Source3: gtkrc Source4: baselibs.conf +Source5: macros.gtk2 # PATCH-FIX-OPENSUSE gtk64.patch sbrabec@novell.com - 64-bit dual install. See also the Fedora patch for a simpler way of doing this. Patch8: gtk64.patch # PATCH-FEATURE-UPSTREAM bugzilla-129753-gtk+-2.8.9-localize-font-style-name.diff bnc129753 bgo319484 mfabian@novell.com - Translate the font styles in the GUI @@ -208,15 +209,15 @@ mv $RPM_BUILD_ROOT%{_bindir}/gtk-query-immodules-2.0\ mv $RPM_BUILD_ROOT%{_sysconfdir}/gtk-2.0/gtk.immodules\ $RPM_BUILD_ROOT%{_sysconfdir}/gtk-2.0/gtk64.immodules %endif +# Install rpm macros +mkdir -p %{buildroot}%{_sysconfdir}/rpm +cp %{S:5} %{buildroot}%{_sysconfdir}/rpm %fdupes $RPM_BUILD_ROOT %clean rm -rf $RPM_BUILD_ROOT -%post -/sbin/ldconfig -test -d var/adm/SuSEconfig/ || mkdir -p var/adm/SuSEconfig/ -touch var/adm/SuSEconfig/run-gtk +%post -p /sbin/ldconfig %preun # Remove all old icon cache files created by SuSEconfig.gtk2. @@ -282,5 +283,6 @@ fi %{_libdir}/pkgconfig/*.pc %doc %{_mandir}/man*/* %doc %{_datadir}/gtk-doc/html/* +%{_sysconfdir}/rpm/macros.gtk2 %changelog diff --git a/macros.gtk2 b/macros.gtk2 new file mode 100644 index 0000000..3a68350 --- /dev/null +++ b/macros.gtk2 @@ -0,0 +1,35 @@ +# RPM macros for packages installing a GTK+ IM module +# +### +# +# When a package installs a GTK+ IM module, it should use all +# three macros: +# +# - %gtk2_immodule_requires in the preamble +# - %gtk2_immodule_post in %post +# - %gtk2_immodule_postun in %postun +# +### + +%gtk2_immodule_requires \ +Requires(post): gtk2 \ +Requires(postun): gtk2 + +# On install, update the cache +%gtk2_immodule_post \ +%if "%_lib" == "lib64" \ + %{_bindir}/gtk-query-immodules-2.0-64 > {_sysconfdir}/gtk.immodules \ +%else \ + %{_bindir}/gtk-query-immodules-2.0 > {_sysconfdir}/gtk64.immodules \ +%endif + +# On uninstall, update the cache. Note: we ignore upgrades (already +# handled in %post of the new package). +%gtk2_immodule_postun \ +if [ $1 -eq 0 ]; then \ + %if "%_lib" == "lib64" \ + %{_bindir}/gtk-query-immodules-2.0-64 > {_sysconfdir}/gtk.immodules \ + %else \ + %{_bindir}/gtk-query-immodules-2.0 > {_sysconfdir}/gtk64.immodules \ + %endif \ +fi