From b2134b2fada037f28f3e2504889e072b2dbeff20e563539a6555fab97f891eba Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Sun, 10 Oct 2010 13:21:16 +0000 Subject: [PATCH 1/2] Accepting request 50111 from home:vuntz:branches:X11:common:Factory not sure I'm happy to have all desktop packages changed, but having the macros is fine OBS-URL: https://build.opensuse.org/request/show/50111 OBS-URL: https://build.opensuse.org/package/show/X11:common:Factory/desktop-file-utils?expand=0&rev=15 --- desktop-file-utils.changes | 9 +++++++++ desktop-file-utils.spec | 7 +++++++ macros.desktop-file-utils | 39 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 macros.desktop-file-utils diff --git a/desktop-file-utils.changes b/desktop-file-utils.changes index 6024cdb..cbfa5e9 100644 --- a/desktop-file-utils.changes +++ b/desktop-file-utils.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Thu Oct 7 14:11:12 CEST 2010 - vuntz@opensuse.org + +- Add rpm macros to update the mime database: + %desktop_database_post and %desktop_database_postun. This will + replace SuSEconfig.desktop-file-utils in the future, once we have + converted packages. +- Add a %post scriptlet to update the desktop database. + ------------------------------------------------------------------- Fri Sep 10 12:34:14 CEST 2010 - vuntz@opensuse.org diff --git a/desktop-file-utils.spec b/desktop-file-utils.spec index 34e2939..c9a8a3d 100644 --- a/desktop-file-utils.spec +++ b/desktop-file-utils.spec @@ -26,6 +26,7 @@ Url: http://www.freedesktop.org/wiki/Software/desktop-file-utils Group: Development/Tools/Other Source0: %{name}-%{version}.tar.bz2 Source1: SuSEconfig.desktop-file-utils +Source2: macros.desktop-file-utils # PATCH-FEATURE-OPENSUSE desktop-file-utils-suse-keys.patch vuntz@opensuse.org -- Handle SUSE-specific keys in validator. This is not strictly necessary, since they are prefixed with X-, but we can verify that the value has the right type. Patch0: desktop-file-utils-suse-keys.patch BuildRequires: glib2-devel @@ -61,6 +62,8 @@ install -D -m644 misc/desktop-entry-mode.el %{buildroot}%{_datadir}/emacs/site-l # SuSEconfig script mkdir -p %{buildroot}/sbin/conf.d install %{S:1} %{buildroot}/sbin/conf.d +# Install rpm macros +install -D -m644 %{S:2} %{buildroot}%{_sysconfdir}/rpm/macros.desktop-file-utils # Create ghosts based on default $XDG_DATA_DIRS: mkdir -p %{buildroot}%{_datadir}/applications touch %{buildroot}%{_datadir}/applications/mimeinfo.cache @@ -68,6 +71,9 @@ touch %{buildroot}%{_datadir}/applications/mimeinfo.cache %clean rm -rf %{buildroot} +%post +%{_bindir}/update-desktop-database --quiet %{_datadir}/applications || true + %postun # It is not allowed by FHS to own this file in RPM package, but we can # purge it. Removal on update can be ignored, SuSEconfig will create it @@ -91,6 +97,7 @@ fi %dir %{_datadir}/emacs %dir %{_datadir}/emacs/site-lisp %{_datadir}/emacs/site-lisp/*.el* +%{_sysconfdir}/rpm/macros.desktop-file-utils /sbin/conf.d/SuSEconfig.* %changelog diff --git a/macros.desktop-file-utils b/macros.desktop-file-utils new file mode 100644 index 0000000..79c861f --- /dev/null +++ b/macros.desktop-file-utils @@ -0,0 +1,39 @@ +# RPM macros for packages installing desktop files +# +### +# +# When a package installs a desktop file, it should use both macros: +# +# - %desktop_database_post in %post +# - %desktop_database_postun in %postun +# +# Note that these macros can optionally take as argument the directory +# where the desktop file is installed. If no argument is passed, then +# %{_datadir}/applications will be used (which is where applications +# usually install their desktop file). +# +### + +# On install, update the desktop database +%desktop_database_post() \ +if test -x %{_bindir}/update-desktop-database; then \ +%if "x%1" != "x%%1" \ + %{_bindir}/update-desktop-database --quiet "%1" || true \ +%endif \ + %{_bindir}/update-desktop-database --quiet "%{_datadir}/applications" || true \ +%else \ +fi + +# On uninstall, update the desktop database. Note: we ignore upgrades (already +# handled in %post of the new package). +%desktop_database_postun() \ +if [ $1 -eq 0 ]; then \ + if test -x %{_bindir}/update-desktop-database; then \ + %{_bindir}/update-desktop-database --quiet "${DESKTOP_DIR}" || true \ +%if "x%1" != "x%%1" \ + %{_bindir}/update-desktop-database --quiet "%1" || true \ +%endif \ + %{_bindir}/update-desktop-database --quiet "%{_datadir}/applications" || true \ +%else \ + fi \ +fi From b7d09f53790b6f067b415bf2e47b83e1b7fd9facc099796cd7b149caff13ff78 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Mon, 11 Oct 2010 10:11:31 +0000 Subject: [PATCH 2/2] Updating link to change in openSUSE:Factory/desktop-file-utils revision 24.0 OBS-URL: https://build.opensuse.org/package/show/X11:common:Factory/desktop-file-utils?expand=0&rev=efe8d3267dbf3be366e651940c37d679 --- desktop-file-utils.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/desktop-file-utils.spec b/desktop-file-utils.spec index c9a8a3d..76bbd5e 100644 --- a/desktop-file-utils.spec +++ b/desktop-file-utils.spec @@ -19,7 +19,7 @@ Name: desktop-file-utils Version: 0.17 -Release: 1 +Release: 2 License: GPLv2+ Summary: Utilities for Manipulating Desktop Files Url: http://www.freedesktop.org/wiki/Software/desktop-file-utils