1
0

Accepting request 50170 from X11:common:Factory

Copy from X11:common:Factory/desktop-file-utils based on submit request 50170 from user coolo

OBS-URL: https://build.opensuse.org/request/show/50170
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/desktop-file-utils?expand=0&rev=24
This commit is contained in:
OBS User autobuild 2010-10-11 10:11:31 +00:00 committed by Git OBS Bridge
commit de00e7a204
3 changed files with 56 additions and 1 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 Fri Sep 10 12:34:14 CEST 2010 - vuntz@opensuse.org

View File

@ -19,13 +19,14 @@
Name: desktop-file-utils Name: desktop-file-utils
Version: 0.17 Version: 0.17
Release: 1 Release: 2
License: GPLv2+ License: GPLv2+
Summary: Utilities for Manipulating Desktop Files Summary: Utilities for Manipulating Desktop Files
Url: http://www.freedesktop.org/wiki/Software/desktop-file-utils Url: http://www.freedesktop.org/wiki/Software/desktop-file-utils
Group: Development/Tools/Other Group: Development/Tools/Other
Source0: %{name}-%{version}.tar.bz2 Source0: %{name}-%{version}.tar.bz2
Source1: SuSEconfig.desktop-file-utils 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. # 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 Patch0: desktop-file-utils-suse-keys.patch
BuildRequires: glib2-devel BuildRequires: glib2-devel
@ -61,6 +62,8 @@ install -D -m644 misc/desktop-entry-mode.el %{buildroot}%{_datadir}/emacs/site-l
# SuSEconfig script # SuSEconfig script
mkdir -p %{buildroot}/sbin/conf.d mkdir -p %{buildroot}/sbin/conf.d
install %{S:1} %{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: # Create ghosts based on default $XDG_DATA_DIRS:
mkdir -p %{buildroot}%{_datadir}/applications mkdir -p %{buildroot}%{_datadir}/applications
touch %{buildroot}%{_datadir}/applications/mimeinfo.cache touch %{buildroot}%{_datadir}/applications/mimeinfo.cache
@ -68,6 +71,9 @@ touch %{buildroot}%{_datadir}/applications/mimeinfo.cache
%clean %clean
rm -rf %{buildroot} rm -rf %{buildroot}
%post
%{_bindir}/update-desktop-database --quiet %{_datadir}/applications || true
%postun %postun
# It is not allowed by FHS to own this file in RPM package, but we can # 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 # purge it. Removal on update can be ignored, SuSEconfig will create it
@ -91,6 +97,7 @@ fi
%dir %{_datadir}/emacs %dir %{_datadir}/emacs
%dir %{_datadir}/emacs/site-lisp %dir %{_datadir}/emacs/site-lisp
%{_datadir}/emacs/site-lisp/*.el* %{_datadir}/emacs/site-lisp/*.el*
%{_sysconfdir}/rpm/macros.desktop-file-utils
/sbin/conf.d/SuSEconfig.* /sbin/conf.d/SuSEconfig.*
%changelog %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