From rom the Fedora-maintainers list
Code in question:
Le mardi 01 mars 2005 à 14:42 -0500, David Malcolm a écrit :
Some spec files try to uninstall the schema e.g. from evolution-connector: %preun export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` gconftool-2 --makefile-uninstall-rule \ %{_sysconfdir}/gconf/schemas/apps_evolution_exchange.schemas
/dev/null || :
The problem:
On Sat, 2005-03-12 at 15:11 +0100, Dams wrote: This is a packaging bug if you dont test the upgrade case. If you uninstall schemas you just *must* have an `if' statement surrounding the gconf schema un-installation in %preun, to test if
we're
being upgraded or un-installed.
Remember that, when upgrading, %preun of the old package is ran after the new package %post.
I think the intent is to remove the old schema from gconf before installing the new schema. So I think this %pre script would work:: %pre # For GConf apps if [ "$1" -gt 1]; then export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` gconftool-2 --makefile-uninstall-rule \ %{_sysconfdir}/gconf/schemas/%{name}.schemas >/dev/null || : fi
Is that wrong (or my assumption that we're trying to clean up the old schema?) If it's good, then maybe the scriptlets in the spectemplates (fedora-rpmdevtools) should be changed.
And anyway, we have a problem in cases like:
* foo-1 which has foo.schema is installed * you upgrade to foo-2 which has foo2.schema, but has no foo.schema.
foo.schema will never be uninstalled, as foo-2 knows nothing about it. (Yes, that sort of things has already happened).
The packager should know about foo.schema... So one inelegant solution would be to put uninstall rules for both foo.schema and foo2.schema with discarded error conditions into the %pre.
-Toshio
--
On Tue, 2005-03-15 at 08:42 -0500, Toshio wrote:
I think the intent is to remove the old schema from gconf before installing the new schema. So I think this %pre script would work:: %pre # For GConf apps if [ "$1" -gt 1]; then
Missing space between "1" and "]" :)
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` gconftool-2 --makefile-uninstall-rule \ %{_sysconfdir}/gconf/schemas/%{name}.schemas >/dev/null || :
fi
Is that wrong (or my assumption that we're trying to clean up the old schema?) If it's good, then maybe the scriptlets in the spectemplates (fedora-rpmdevtools) should be changed.
Based on a brief look, the above would fail if the schema filename has changed (or if the package has been renamed: %{name} is the name of the new package, not old).
On Tue, Mar 15, 2005 at 05:00:29PM +0200, Ville Skyttä wrote:
On Tue, 2005-03-15 at 08:42 -0500, Toshio wrote:
I think the intent is to remove the old schema from gconf before installing the new schema. So I think this %pre script would work:: %pre # For GConf apps if [ "$1" -gt 1]; then
Missing space between "1" and "]" :)
Noticed that when I started testing :-)
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` gconftool-2 --makefile-uninstall-rule \ %{_sysconfdir}/gconf/schemas/%{name}.schemas >/dev/null || :
fi
Is that wrong (or my assumption that we're trying to clean up the old schema?) If it's good, then maybe the scriptlets in the spectemplates (fedora-rpmdevtools) should be changed.
Based on a brief look, the above would fail if the schema filename has changed (or if the package has been renamed: %{name} is the name of the new package, not old).
Good point. So schema names would need to be hardcoded in. (This is related to the second point raised in anvil's email, yes?)
Testing has also revealed that the %preun will still need to have a gconf uninstall only rule to handle the uninstall case... %pre will only handle the upgrade case.
-Toshio
Okay -- this set of scripts seems to work and has the added benefit of sending a HUP to have gconfd-2 reload per Mark McLoughlin's suggestion on fedora-maintainers. (I don't know how gcond responded to HUP prior to 2.7.3 FC2 and earlier though.)
I don't know if there's anyway to work around the previous broken scripts, though....
%pre if [ "$1" -gt 1 ]; then export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` gconftool-2 --makefile-uninstall-rule \ %{_syscondir}/gconf/schemas/CURRENTSCHEMA.schemas > /dev/null || : # If applicable: # gconftool-2 --makefile-uninstall-rule \ # %{_sysconfdir}/gconf/schemas/OLDSCHEMA.schemas > /dev/null || : killall -HUP gconfd-2 fi
%post export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` gconftool-2 --makefile-install-rule \ /etc/gconf/schemas/CURRENTSCHEMA.schemas > /dev/null || : killall -HUP gconfd-2
%preun if [ "$1" -eq 0 ]; then export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source` gconftool-2 --makefile-uninstall-rule \ /etc/gconf/schemas/CURRENTSCHEMA.schemas > /dev/null || : killall -HUP gconfd-2 fi
-Toshio --
packaging@lists.fedoraproject.org