[opensuse-packaging] Desktop-related macros for scriptlets
Hi, Something I probably failed to document properly in 11.4 is the new macros that got introduced for desktop-related things (some of them being, arguably, GTK+-only). They were introduced to fix various issues, and move away from the SuSEconfig scripts. With rpm 4.9, we might be able to use another solution. In that case, the macros listed below will just expand to an empty string and do nothing. So it won't harm to use them either. Desktop-related macros ====================== a) Package installs a .desktop file in /usr/share/applications Macros: %desktop_database_post/%desktop_database_postun What it does: calls update-desktop-database to update a cache mapping MIME types to apps handling them. This is needed to make the desktops aware that an app can handle a MIME type. b) Package installs a MIME definition (in /usr/share/mime): Macros: %mime_database_post/%mime_database_postun What it does: calls update-mime-database to update the database containing information about all MIME definitions. c) Package installs an icon in hicolor (/usr/share/icons/hicolor): Macros: %icon_theme_cache_post/%icon_theme_cache_postun What it does: calls gtk-update-icon-cache (if existing) to update the GTK+ icon cache for hicolor, as specified by the spec. This is needed to make the icon visible to GTK+ apps. d) Package installs an icon in another icon theme (let's say "geeko" theme, /usr/share/icons/geeko) Macros: %icon_theme_cache_post geeko / %icon_theme_cache_postun geeko What it does: calls gtk-update-icon-cache (if existing) to update the GTK+ icon cache for geeko. This is needed to make the icon visible to GTK+ apps. e) Package installs a GSettings schema (in /usr/share/glib-2.0/schemas): Macros: %glib2_gsettings_schema_post/%glib2_gsettings_schema_postun %glib2_gsettings_schema_requires (similar to %py_requires) What it does: calls glib-compile-schemas to build the blob containing the data for all schemas. This is needed to have your app not crash :-) f) Package installs a gio module (in /usr/lib/gio/modules): Macros: %glib2_gio_module_post/%glib2_gio_module_postun %glib2_gio_module_requires (similar to %py_requires) What it does: calls gio-querymodules to update a cache listing all gio modules and the extension points they are using. This is needed to make the gio module known to gio. g) Package installs a gdk-pixbuf loader (in /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders): Macros: %gdk_pixbuf_loader_post/%gdk_pixbuf_loader_postun %gdk_pixbuf_loader_requires (similar to %py_requires) What it does: calls gdk-pixbuf-query-loaders to update a cache listing all gdk-pixbuf loaders and their abilities. This is needed to make the gdk-pixbuf loader known to gdk-pixbuf. h) Package installs a GTK+ (2 or 3) IM module (in /usr/lib/gtk-2.0/2.10.0/immodules or /usr/lib/gtk-3.0/3.0.0/immodules): Macros: %gtk2_immodule_post/%gtk2_immodule_postun %gtk2_immodule_requires %gtk3_immodule_post/%gtk3_immodule_postun %gtk3_immodule_requires What it does: calls gtk-query-immodules-2.0/gtk-query-immodules-3.0 to build a cache listing all IM modules and the locale/language they apply to. You obviously need to only call the gtk2/gtk3 version, depending on which version of GTK+ you target. This is needed to make the IM module known to GTK+. i) Package installs a pango module (in /usr/lib/pango/1.6.0/modules): Macros: %pango_module_post/%pango_module_postun %pango_module_requires (similar to %py_requires) What it does: calls pango-querymodules to update a cache listing all pango modules and information about what they handle. This is needed to make the module known to pango. Thanks, Vincent -- Les gens heureux ne sont pas pressés. -- Les gens heureux ne sont pas pressés. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
2011/5/2 Vincent Untz <vuntz@opensuse.org>:
Something I probably failed to document properly in 11.4 is the new macros that got introduced for desktop-related things (some of them being, arguably, GTK+-only). They were introduced to fix various issues, and move away from the SuSEconfig scripts.
Any plan to make rpmlint complain about these? IIRC you already had the checks months ago, true? -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Le lundi 02 mai 2011, à 17:31 +0200, Cristian Morales Vega a écrit :
2011/5/2 Vincent Untz <vuntz@opensuse.org>:
Something I probably failed to document properly in 11.4 is the new macros that got introduced for desktop-related things (some of them being, arguably, GTK+-only). They were introduced to fix various issues, and move away from the SuSEconfig scripts.
Any plan to make rpmlint complain about these? IIRC you already had the checks months ago, true?
I don't think we should make rpmlint complain about that, until we know what the plan is with rpm 4.9: the new solution with the new rpm might require us to do an additional change to .spec files, and I don't want to force people to fix things twice. So the most urgent topic is to find out what the solution with latest rpm would be, imho. Vincent -- Les gens heureux ne sont pas pressés. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
2011/5/3 Vincent Untz <vuntz@opensuse.org>:
Le lundi 02 mai 2011, à 17:31 +0200, Cristian Morales Vega a écrit :
2011/5/2 Vincent Untz <vuntz@opensuse.org>:
Something I probably failed to document properly in 11.4 is the new macros that got introduced for desktop-related things (some of them being, arguably, GTK+-only). They were introduced to fix various issues, and move away from the SuSEconfig scripts.
Any plan to make rpmlint complain about these? IIRC you already had the checks months ago, true?
I don't think we should make rpmlint complain about that, until we know what the plan is with rpm 4.9: the new solution with the new rpm might require us to do an additional change to .spec files, and I don't want to force people to fix things twice.
So the most urgent topic is to find out what the solution with latest rpm would be, imho.
From http://lists.opensuse.org/opensuse-factory/2011-04/msg00339.html it seems to me that ZYpp is not going to change its behavior anytime soon. And with the current 1 package <-> 1 transaction behavior there is nothing new rpm versions can do to help us here. So either we convince ZYpp guys there is a strong enough need for a change of behavior or we can just forget about this being fixed at RPM/ZYpp level. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Hi Vincent, this is exactly, what I would have needed before the weekend, since I attempted to build a current GTK/GTK+ v.2 for Evergreen 11.1: home:frispete:gtk A note, which package installs which macros would have spared me some additional hours... Pete On Monday 02 May 2011, 12:24:57 Vincent Untz wrote:
Hi,
Something I probably failed to document properly in 11.4 is the new macros that got introduced for desktop-related things (some of them being, arguably, GTK+-only). They were introduced to fix various issues, and move away from the SuSEconfig scripts.
With rpm 4.9, we might be able to use another solution. In that case, the macros listed below will just expand to an empty string and do nothing. So it won't harm to use them either.
Desktop-related macros ======================
a) Package installs a .desktop file in /usr/share/applications
Macros: %desktop_database_post/%desktop_database_postun
What it does: calls update-desktop-database to update a cache mapping MIME types to apps handling them. This is needed to make the desktops aware that an app can handle a MIME type.
b) Package installs a MIME definition (in /usr/share/mime):
Macros: %mime_database_post/%mime_database_postun
What it does: calls update-mime-database to update the database containing information about all MIME definitions.
c) Package installs an icon in hicolor (/usr/share/icons/hicolor):
Macros: %icon_theme_cache_post/%icon_theme_cache_postun
What it does: calls gtk-update-icon-cache (if existing) to update the GTK+ icon cache for hicolor, as specified by the spec. This is needed to make the icon visible to GTK+ apps.
d) Package installs an icon in another icon theme (let's say "geeko" theme, /usr/share/icons/geeko)
Macros: %icon_theme_cache_post geeko / %icon_theme_cache_postun geeko
What it does: calls gtk-update-icon-cache (if existing) to update the GTK+ icon cache for geeko. This is needed to make the icon visible to GTK+ apps.
e) Package installs a GSettings schema (in /usr/share/glib-2.0/schemas):
Macros: %glib2_gsettings_schema_post/%glib2_gsettings_schema_postun %glib2_gsettings_schema_requires (similar to %py_requires)
What it does: calls glib-compile-schemas to build the blob containing the data for all schemas. This is needed to have your app not crash
:-)
f) Package installs a gio module (in /usr/lib/gio/modules):
Macros: %glib2_gio_module_post/%glib2_gio_module_postun %glib2_gio_module_requires (similar to %py_requires)
What it does: calls gio-querymodules to update a cache listing all gio modules and the extension points they are using. This is needed to make the gio module known to gio.
g) Package installs a gdk-pixbuf loader (in /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders):
Macros: %gdk_pixbuf_loader_post/%gdk_pixbuf_loader_postun %gdk_pixbuf_loader_requires (similar to %py_requires)
What it does: calls gdk-pixbuf-query-loaders to update a cache listing all gdk-pixbuf loaders and their abilities. This is needed to make the gdk-pixbuf loader known to gdk-pixbuf.
h) Package installs a GTK+ (2 or 3) IM module (in /usr/lib/gtk-2.0/2.10.0/immodules or /usr/lib/gtk-3.0/3.0.0/immodules):
Macros: %gtk2_immodule_post/%gtk2_immodule_postun %gtk2_immodule_requires %gtk3_immodule_post/%gtk3_immodule_postun %gtk3_immodule_requires
What it does: calls gtk-query-immodules-2.0/gtk-query-immodules-3.0 to build a cache listing all IM modules and the locale/language they apply to. You obviously need to only call the gtk2/gtk3 version, depending on which version of GTK+ you target. This is needed to make the IM module known to GTK+.
i) Package installs a pango module (in /usr/lib/pango/1.6.0/modules):
Macros: %pango_module_post/%pango_module_postun %pango_module_requires (similar to %py_requires)
What it does: calls pango-querymodules to update a cache listing all pango modules and information about what they handle. This is needed to make the module known to pango.
Thanks,
Vincent
-- Les gens heureux ne sont pas pressés.
-- Les gens heureux ne sont pas pressés.
-- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Le mardi 03 mai 2011, à 11:10 +0200, Hans-Peter Jansen a écrit :
Hi Vincent,
this is exactly, what I would have needed before the weekend, since I attempted to build a current GTK/GTK+ v.2 for Evergreen 11.1:
home:frispete:gtk
A note, which package installs which macros would have spared me some additional hours...
Well, next time, just ask :-) Packages providing the macros: desktop-file-utils: %desktop_database_post/%desktop_database_postun (update-desktop-files will bring it in, so you can use update-desktop-files as BuildRequires) shared-mime-info: %mime_database_post/%mime_database_postun hicolor-icon-theme: %icon_theme_cache_post/%icon_theme_cache_postun glib2-devel: %glib2_gsettings_schema_post/%glib2_gsettings_schema_postun glib2-devel: %glib2_gio_module_post/%glib2_gio_module_postun gdk-pixbuf-devel: %gdk_pixbuf_loader_post/%gdk_pixbuf_loader_postun gtk2-devel: %gtk2_immodule_post/%gtk2_immodule_postun gtk3-devel: %gtk3_immodule_post/%gtk3_immodule_postun pango-devel: %pango_module_post/%pango_module_postun Vincent -- Les gens heureux ne sont pas pressés. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Saturday 22 October 2011 On Mon, 2 May 2011 12:24:57 +0200 Vincent Untz wrote:
a) Package installs a .desktop file in /usr/share/applications
Macros: %desktop_database_post/%desktop_database_postun
What it does: calls update-desktop-database to update a cache mapping MIME types to apps handling them. This is needed to make the desktops aware that an app can handle a MIME type.
Building a package in Factory I see warnings: (update-desktop-database:3634): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Failed to create file '/usr/local/share/applications/gnome-defaults.list.ADL53V': No such file or directory (update-desktop-database:3634): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Failed to create file '/usr/local/share/applications/kde-defaults.list.JIL53V': No such file or directory What is wrong? -- WBR Kyrill -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
Le samedi 22 octobre 2011, à 12:22 +0400, Kyrill Detinov a écrit :
Saturday 22 October 2011
On Mon, 2 May 2011 12:24:57 +0200 Vincent Untz wrote:
a) Package installs a .desktop file in /usr/share/applications
Macros: %desktop_database_post/%desktop_database_postun
What it does: calls update-desktop-database to update a cache mapping MIME types to apps handling them. This is needed to make the desktops aware that an app can handle a MIME type.
Building a package in Factory I see warnings:
(update-desktop-database:3634): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Failed to create file '/usr/local/share/applications/gnome-defaults.list.ADL53V': No such file or directory
(update-desktop-database:3634): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: Failed to create file '/usr/local/share/applications/kde-defaults.list.JIL53V': No such file or directory
What is wrong?
The desktop-file-utils package was wrong, with some bugs. It got fixed. Cheers, Vincent -- Les gens heureux ne sont pas pressés. -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On 2 May 2011 11:24, Vincent Untz <vuntz@opensuse.org> wrote:
a) Package installs a .desktop file in /usr/share/applications
Macros: %desktop_database_post/%desktop_database_postun
What it does: calls update-desktop-database to update a cache mapping MIME types to apps handling them. This is needed to make the desktops aware that an app can handle a MIME type.
The macros (non only this one, also the MIME and icon ones) are creating scripts like this: if test -x /usr/bin/update-desktop-database; then /usr/bin/update-desktop-database --quiet "/usr/share/applications" || true fi It is not going to fail if /usr/bin/update-desktop-database doesn't exist? If the execution fails the "|| true" will ensure that the exit result is 0. But if it doesn't exist the exit result will be the one from "test -x"... Fedora doesn't do the first test and just lets it fail (http://fedoraproject.org/wiki/Packaging:ScriptletSnippets#desktop-database). -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
* Cristian Morales Vega <cmorve69@yahoo.es> [2011-11-20 15:57]:
The macros (non only this one, also the MIME and icon ones) are creating scripts like this:
if test -x /usr/bin/update-desktop-database; then /usr/bin/update-desktop-database --quiet "/usr/share/applications" || true fi
It is not going to fail if /usr/bin/update-desktop-database doesn't exist? If the execution fails the "|| true" will ensure that the exit result is 0. But if it doesn't exist the exit result will be the one from "test -x"...
No, it will be zero. The exit status of an "if" command will be zero if the compound list following the "if" exits with a non-zero exit status and there is no "else"/"elif". The "if" is redundant here but it will not do any harm either. -- Guido Berhoerster -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
On 20 November 2011 16:13, Guido Berhoerster <gber@opensuse.org> wrote:
* Cristian Morales Vega <cmorve69@yahoo.es> [2011-11-20 15:57]:
The macros (non only this one, also the MIME and icon ones) are creating scripts like this:
if test -x /usr/bin/update-desktop-database; then /usr/bin/update-desktop-database --quiet "/usr/share/applications" || true fi
It is not going to fail if /usr/bin/update-desktop-database doesn't exist? If the execution fails the "|| true" will ensure that the exit result is 0. But if it doesn't exist the exit result will be the one from "test -x"...
No, it will be zero. The exit status of an "if" command will be zero if the compound list following the "if" exits with a non-zero exit status and there is no "else"/"elif". The "if" is redundant here but it will not do any harm either.
OK, thanks. So I don't know why a 11.3 build failed to me (later I noticed 11.3 does not have the macros) but I workarounded that... -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-packaging+owner@opensuse.org
participants (5)
-
Cristian Morales Vega
-
Guido Berhoerster
-
Hans-Peter Jansen
-
Kyrill Detinov
-
Vincent Untz