Accepting request 50000 from home:vuntz:branches:GNOME:Factory

Looks fine... we'd probably want a lint warning on mime files being installed without the post/postun macros in plus though.

OBS-URL: https://build.opensuse.org/request/show/50000
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/shared-mime-info?expand=0&rev=14
This commit is contained in:
Dominique Leuenberger 2010-10-07 17:32:20 +00:00 committed by Git OBS Bridge
parent c163d41814
commit 4a5d92d903
3 changed files with 53 additions and 1 deletions

40
macros.shared-mime-info Normal file
View File

@ -0,0 +1,40 @@
# RPM macros for packages installing a MIME type according to the XDG specification
#
###
#
# When a package installs a MIME type as per the XDG specification, it should
# use both macros:
#
# - %mime_database_post in %post
# - %mime_database_postun in %postun
#
# Note that these macros can optionally take as argument the directory
# where the MIME type is installed. If no argument is passed, then
# %{_datadir}/mime will be used (which is where applications usually install
# the MIME type information).
#
###
# On install, update the mime database
%mime_database_post() \
if test -x %{_bindir}/update-mime-database; then \
%if "x%1" != "x%%1" \
%{_bindir}/update-mime-database "%1" || true \
%else \
%{_bindir}/update-mime-database "%{_datadir}/mime" || true \
%endif \
fi
# On uninstall, update the mime database. Note: we ignore upgrades (already
# handled in %post of the new package).
%mime_database_postun() \
if [ $1 -eq 0 ]; then \
if test -x %{_bindir}/update-mime-database; then \
%{_bindir}/update-mime-database "${MIME_DIR}" || true \
%if "x%1" != "x%%1" \
%{_bindir}/update-mime-database "%1" || true \
%else \
%{_bindir}/update-mime-database "%{_datadir}/mime" || true \
%endif \
fi \
fi

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Oct 7 14:09:38 CEST 2010 - vuntz@opensuse.org
- Add rpm macros to update the mime database: %mime_database_post
and %mime_database_postun.
- Update %post to never fail, and to not redirect the output to
/dev/null: if there is output, then it's important.
-------------------------------------------------------------------
Fri Oct 1 19:40:56 CEST 2010 - vuntz@opensuse.org

View File

@ -31,6 +31,7 @@ License: GPLv2+
Summary: Shared MIME Database
Source: %{name}-%{version}.tar.bz2
Source1: mime-info-to-mime
Source2: macros.shared-mime-info
# needed by mime-info-to-mime:
Requires: /bin/rm /bin/mkdir /usr/bin/fgrep
# needed by update-mime-database
@ -59,12 +60,14 @@ translation-update-upstream
%makeinstall
install %{S:1} $RPM_BUILD_ROOT%{_bindir}/
%find_lang %{name}
# Install rpm macros
install -D -m644 %{S:2} %{buildroot}%{_sysconfdir}/rpm/macros.shared-mime-info
%clean
rm -rf $RPM_BUILD_ROOT
%post
usr/bin/update-mime-database usr/share/mime >/dev/null
%{_bindir}/update-mime-database %{_datadir}/mime || true
%files -f %{name}.lang
%defattr (-, root, root)
@ -74,5 +77,6 @@ usr/bin/update-mime-database usr/share/mime >/dev/null
%{_datadir}/pkgconfig/*.pc
%ghost %{_datadir}/mime/[a-ms-vxX]*
%{_mandir}/man?/*.*
%{_sysconfdir}/rpm/macros.shared-mime-info
%changelog