Gentoo Archives: gentoo-commits

From: Gilles Dartiguelongue <eva@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:gnome-xdg-eclasses commit in: eclass/
Date: Tue, 24 Nov 2015 18:50:16
Message-Id: 1448390977.0913bfc8d9650ad4eb542ec9a1a30736013224f2.eva@gentoo
1 commit: 0913bfc8d9650ad4eb542ec9a1a30736013224f2
2 Author: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 24 17:42:27 2015 +0000
4 Commit: Gilles Dartiguelongue <eva <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 24 18:49:37 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0913bfc8
7
8 xdg*.eclass: move phase related logic to xdg.eclass
9
10 eclass/xdg-utils.eclass | 32 --------------------------------
11 eclass/xdg.eclass | 34 +++++++++++++++++++++++++++-------
12 2 files changed, 27 insertions(+), 39 deletions(-)
13
14 diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
15 index d140283..3dc9e8e 100644
16 --- a/eclass/xdg-utils.eclass
17 +++ b/eclass/xdg-utils.eclass
18 @@ -62,17 +62,6 @@ xdg_environment_reset() {
19 unset DBUS_SESSION_BUS_ADDRESS
20 }
21
22 -# @FUNCTION: xdg_desktopfiles_savelist
23 -# @DESCRIPTION:
24 -# Find the .desktop files about to be installed and save their location
25 -# in the XDG_ECLASS_DESKTOPFILES environment variable.
26 -# This function should be called from pkg_preinst.
27 -xdg_desktopfiles_savelist() {
28 - pushd "${D}" > /dev/null || die
29 - export XDG_ECLASS_DESKTOPFILES=$(find 'usr/share/applications' -type f 2> /dev/null)
30 - popd > /dev/null || die
31 -}
32 -
33 # @FUNCTION: fdo-xdg_desktop_database_update
34 # @DESCRIPTION:
35 # Updates the .desktop files database.
36 @@ -85,27 +74,11 @@ xdg_desktop_database_update() {
37 return
38 fi
39
40 - if [[ -z "${XDG_ECLASS_DESKTOPFILES}" ]]; then
41 - debug-print "No .desktop files to add to database"
42 - return
43 - fi
44 -
45 ebegin "Updating .desktop files database ..."
46 "${updater}" -q "${EROOT}${DESKTOP_DATABASE_DIR}"
47 eend $?
48 }
49
50 -# @FUNCTION: xdg_mimeinfo_savelist
51 -# @DESCRIPTION:
52 -# Find the mime information files about to be installed and save their location
53 -# in the XDG_ECLASS_MIMEINFOFILES environment variable.
54 -# This function should be called from pkg_preinst.
55 -xdg_mimeinfo_savelist() {
56 - pushd "${D}" > /dev/null || die
57 - export XDG_ECLASS_MIMEINFOFILES=$(find 'usr/share/mime' -type f 2> /dev/null)
58 - popd > /dev/null || die
59 -}
60 -
61 # @FUNCTION: xdg_mimeinfo_database_update
62 # @DESCRIPTION:
63 # Update the mime database.
64 @@ -118,11 +91,6 @@ xdg_mimeinfo_database_update() {
65 return
66 fi
67
68 - if [[ -z "${XDG_ECLASS_MIMEINFOFILES}" ]]; then
69 - debug-print "No mime info files to add to database"
70 - return
71 - fi
72 -
73 ebegin "Updating shared mime info database ..."
74 "${updater}" "${EROOT}${MIMEINFO_DATABASE_DIR}"
75 eend $?
76
77 diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
78 index 799d6a2..1813858 100644
79 --- a/eclass/xdg.eclass
80 +++ b/eclass/xdg.eclass
81 @@ -37,25 +37,45 @@ xdg_src_prepare() {
82
83 # @FUNCTION: xdg_pkg_preinst
84 # @DESCRIPTION:
85 -# Finds .desktop and mime info files for later handling in pkg_postinst
86 +# Finds .desktop and mime info files for later handling in pkg_postinst.
87 +# Locations are stored in XDG_ECLASS_DESKTOPFILES and XDG_ECLASS_MIMEINFOFILES
88 +# respectively.
89 xdg_pkg_preinst() {
90 - xdg_desktopfiles_savelist
91 - xdg_mimeinfo_savelist
92 + export XDG_ECLASS_DESKTOPFILES=( $(cd "${D}" && find 'usr/share/applications' -type f -print0 2> /dev/null) )
93 + export XDG_ECLASS_MIMEINFOFILES=( $(cd "${D}" && find 'usr/share/mime' -type f -print0 2> /dev/null) )
94 }
95
96 # @FUNCTION: xdg_pkg_postinst
97 # @DESCRIPTION:
98 # Handle desktop and mime info database updates.
99 xdg_pkg_postinst() {
100 - xdg_desktop_database_update
101 - xdg_mimeinfo_database_update
102 + if [[ -n "${XDG_ECLASS_DESKTOPFILES}" ]]; then
103 + xdg_desktop_database_update
104 + else
105 + debug-print "No .desktop files to add to database"
106 + fi
107 +
108 + if [[ -n "${XDG_ECLASS_MIMEINFOFILES}" ]]; then
109 + xdg_mimeinfo_database_update
110 + else
111 + debug-print "No mime info files to add to database"
112 + fi
113 }
114
115 # @FUNCTION: xdg_pkg_postrm
116 # @DESCRIPTION:
117 # Handle desktop and mime info database updates.
118 xdg_pkg_postrm() {
119 - xdg_desktop_database_update
120 - xdg_mimeinfo_database_update
121 + if [[ -n "${XDG_ECLASS_DESKTOPFILES}" ]]; then
122 + xdg_desktop_database_update
123 + else
124 + debug-print "No .desktop files to add to database"
125 + fi
126 +
127 + if [[ -n "${XDG_ECLASS_MIMEINFOFILES}" ]]; then
128 + xdg_mimeinfo_database_update
129 + else
130 + debug-print "No mime info files to add to database"
131 + fi
132 }