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
This commit is contained in:
Dirk Mueller 2017-06-30 12:15:06 +00:00 committed by Git OBS Bridge
parent aae2464df6
commit 41244a7254
3 changed files with 17 additions and 24 deletions

View File

@ -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

View File

@ -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

View File

@ -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