8108N/AHow to package gconf schemas
8108N/A----------------------------
8283N/ASomewhere between GNOME 2.12 and 2.14 GConf changed the file format of
8283N/Aits xml backend. Previously, if you had a key called
8283N/AThese files were created using gconftool-2 by installing schemas files,
8283N/Aand translations of the key descriptions in all languages.
8283N/AThis became a performance issue, as it took several seconds to load
8283N/Athese files when gconfd-2 started. The new approach is using
8283N/Aone "merged" xml file that includes all key - value pairs.
8283N/ALocalisations were split into separate xml files, one for each locale.
8283N/AFirst a program called gconf-merge-tree was used to generate the
8283N/Amerged xml files from the directory structure. Once the merged xml
8283N/Afiles were created, gconfd-2 only read those and ignored the directory
8283N/Astructure. So we ended up with 2 gconf data bases which could become
8283N/Ainconsistent. Fortunately, gconftool-2 can now install the schemas
8283N/Astraight into the merged xml files. So the preferred way to install
8283N/AIn JDS3, we installed the schemas into $RPM_BUILD_ROOT during 'make install'
8283N/AThis was kinda broken as it wasn't possible for multiple packages to
8283N/Ainstall gconf keys in the same directory as they would have had to
8283N/AHowever, the format of the xml database changed to merged xml files
8283N/A(see the Background above), so we were forced to change the way we
8108N/AThe basic idea is similar to what Linux distributions do: we package the
8108N/Ascripts. The only difference is that we can't use gconftool-2 directly
8108N/Ain procedural package scripts because of problems with Live Upgrade and
8108N/ASo what we do is, use postrun to run gconftool-2 "as soon as possible".
8108N/AThe gconftool-2 command will install the schemas into the merged gconf
8108N/A1) Make sure that each -root sub package that delivers gconf schemas
8108N/A depends on SUNWgnome-config (gconf) and SUNWpostrun. Add these
8108N/A 2 lines to the end of the %package definition:
8108N/A Summary: %{summary} - / filesystem
8108N/A2) Make sure that %install does not include the directory based %
gconf.xml 8108N/A files. Note, if you use separate Linux and Solaris spec files and %use,
8108N/A these commands should go in the Linux spec file:
8108N/A export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
8108N/A make DESTDIR=$RPM_BUILD_ROOT install
8108N/A Some more explanations and historical details follow, skip to 3) if you
8108N/A In JDS3 and early JDS4 builds, we installed the schemas explicitely
8108N/A in the Solaris spec files' %install section like this:
8108N/A have otherwise appeared in multiple -root pkgs, which is a violation
8108N/A chmod -R a+rX $RPM_BUILD_ROOT/%{_sysconfdir}
8108N/A This was really broken, because if the package that includes the removed
8108N/A will not be found by gconfd-2. Worse, if, by mistake, no package
8283N/A Note, you need to list the schemas files in the %preun script.
8283N/A In the %post script we always install all schemas available on
8283N/A the system for performance reasons.
8108N/A echo ' echo "ERROR: gconftool-2 not found"';
8108N/A echo 'export GCONF_CONFIG_SOURCE';
8392N/A echo ' echo "WARNING: gconftool-2 not found; not uninstalling gconf schemas"';
8283N/A echo 'export GCONF_CONFIG_SOURCE GCONF_BACKEND_DIR LD_LIBRARY_PATH';
8283N/A echo 'schemas="$SDIR/###FILE1###.schemas';
8283N/A echo ' $SDIR/###FILE2###.schemas';
8283N/A echo ' $SDIR/###FILE3###.schemas';
8283N/A echo ' $SDIR/###FILEn###.schemas"';
8108N/A4) update %files root (or %files -n SUNWfoo-bar-root), it should look
8108N/A %attr (0755, root, sys) %dir %{_sysconfdir}
8108N/A Note: ###FILE1### ... ###FILEn### must match the list of lines in
8283N/A %preun. Please don't use *.schemas but list each schemas
8108N/A file so that when a new schemas file is added to the source tarball
8108N/A the build will break and we will notice that %post %preun and %files
8108N/AThat's it. If something is not clear, have questions or need a review,
8108N/Afeel free to email me at laca@sun.com.