From 41244a7254e89ecdac36cd6fb4fa8a3da5e7a065ad4b8f652e015852d000fc3d Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Fri, 30 Jun 2017 12:15:06 +0000 Subject: [PATCH] Accepting request 506454 from GNOME:Next Let's switch this one to file-triggers instead of copying a macro in every package; lowers the error rate for packagers drastically, as they no longer need to care for this OBS-URL: https://build.opensuse.org/request/show/506454 OBS-URL: https://build.opensuse.org/package/show/X11:common:Factory/desktop-file-utils?expand=0&rev=60 --- desktop-file-utils.changes | 9 +++++++++ desktop-file-utils.spec | 8 ++++++-- macros.desktop-file-utils | 24 ++---------------------- 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/desktop-file-utils.changes b/desktop-file-utils.changes index 36364e0..0748fca 100644 --- a/desktop-file-utils.changes +++ b/desktop-file-utils.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Thu Jun 22 10:07:09 UTC 2017 - dimstar@opensuse.org + +- Replace %desktop_database_post/postun with respective file + triggers in desktop-file-utils: any file put into + /usr/share/applications will trigger the execution of the script. + In order to not break the macros short-term they are being + redefined to %nil. + ------------------------------------------------------------------- Sat Oct 15 06:57:19 UTC 2016 - zaitor@opensuse.org diff --git a/desktop-file-utils.spec b/desktop-file-utils.spec index 89df6b6..846bb04 100644 --- a/desktop-file-utils.spec +++ b/desktop-file-utils.spec @@ -1,7 +1,7 @@ # # spec file for package desktop-file-utils # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -66,7 +66,11 @@ install -D -m644 %{SOURCE2} %{buildroot}%{_sysconfdir}/rpm/macros.desktop-file-u mkdir -p %{buildroot}%{_datadir}/applications touch %{buildroot}%{_datadir}/applications/mimeinfo.cache -%post +%filetriggerin -- %{_datadir}/applications +%{_bindir}/update-desktop-database --quiet %{_datadir}/applications || true +%{_bindir}/suse-update-mime-defaults || true + +%filetriggerpostun -- %{_datadir}/applications %{_bindir}/update-desktop-database --quiet %{_datadir}/applications || true %{_bindir}/suse-update-mime-defaults || true diff --git a/macros.desktop-file-utils b/macros.desktop-file-utils index 2255300..07d2b75 100644 --- a/macros.desktop-file-utils +++ b/macros.desktop-file-utils @@ -16,29 +16,9 @@ # 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 \ -%else \ - %{_bindir}/update-desktop-database --quiet "%{_datadir}/applications" || true \ -%endif \ -fi \ -if test -x %{_bindir}/suse-update-mime-defaults; then \ - %{_bindir}/suse-update-mime-defaults || true \ -fi +%nil # 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 \ -%if "x%1" != "x%%1" \ - %{_bindir}/update-desktop-database --quiet "%1" || true \ -%else \ - %{_bindir}/update-desktop-database --quiet "%{_datadir}/applications" || true \ -%endif \ - fi \ - if test -x %{_bindir}/suse-update-mime-defaults; then \ - %{_bindir}/suse-update-mime-defaults || true \ - fi \ -fi +%nil