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
This commit is contained in:
Stephan Kulow 2010-10-10 13:21:16 +00:00 committed by Git OBS Bridge
parent d9ea346e0a
commit b2134b2fad
3 changed files with 55 additions and 0 deletions

View File

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

View File

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

39
macros.desktop-file-utils Normal file
View File

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