Gentoo Archives: gentoo-dev

From: "Marty E. Plummer" <hanetzer@×××××××××.com>
To: gentoo-dev@l.g.o
Cc: "Marty E. Plummer" <hanetzer@×××××××××.com>
Subject: [gentoo-dev] [PATCH 02/10] gnome2.eclass: move icon handling code to xdg.eclass
Date: Thu, 21 Jun 2018 05:11:51
Message-Id: 20180621050950.9162-3-hanetzer@startmail.com
In Reply to: [gentoo-dev] [PATCH 00/10] {gnome2,xdg}{,-utils}.eclass: EAPI 7 work by "Marty E. Plummer"
1 Package-Manager: Portage-2.3.40, Repoman-2.3.9
2 ---
3 eclass/gnome2.eclass | 9 +--------
4 eclass/xdg.eclass | 31 ++++++++++++++++++++++++-------
5 2 files changed, 25 insertions(+), 15 deletions(-)
6
7 diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass
8 index 6db6d08b14e..c4418df92bb 100644
9 --- a/eclass/gnome2.eclass
10 +++ b/eclass/gnome2.eclass
11 @@ -1,4 +1,4 @@
12 -# Copyright 1999-2015 Gentoo Foundation
13 +# Copyright 1999-2018 Gentoo Foundation
14 # Distributed under the terms of the GNU General Public License v2
15
16 # @ECLASS: gnome2.eclass
17 @@ -315,7 +315,6 @@ gnome2_src_install() {
18 gnome2_pkg_preinst() {
19 xdg_pkg_preinst
20 gnome2_gconf_savelist
21 - gnome2_icon_savelist
22 gnome2_schemas_savelist
23 gnome2_scrollkeeper_savelist
24 gnome2_gdk_pixbuf_savelist
25 @@ -337,9 +336,6 @@ gnome2_pkg_preinst() {
26 gnome2_pkg_postinst() {
27 xdg_pkg_postinst
28 gnome2_gconf_install
29 - if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
30 - gnome2_icon_cache_update
31 - fi
32 if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
33 gnome2_schemas_update
34 fi
35 @@ -361,9 +357,6 @@ gnome2_pkg_postinst() {
36 # Handle scrollkeeper, GSettings, Icons, desktop and mime database updates.
37 gnome2_pkg_postrm() {
38 xdg_pkg_postrm
39 - if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
40 - gnome2_icon_cache_update
41 - fi
42 if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
43 gnome2_schemas_update
44 fi
45 diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
46 index fd4816b8447..2a4e1f81abf 100644
47 --- a/eclass/xdg.eclass
48 +++ b/eclass/xdg.eclass
49 @@ -1,4 +1,4 @@
50 -# Copyright 1999-2015 Gentoo Foundation
51 +# Copyright 1999-2018 Gentoo Foundation
52 # Distributed under the terms of the GNU General Public License v2
53
54 # @ECLASS: xdg.eclass
55 @@ -39,9 +39,9 @@ xdg_src_prepare() {
56
57 # @FUNCTION: xdg_pkg_preinst
58 # @DESCRIPTION:
59 -# Finds .desktop and mime info files for later handling in pkg_postinst.
60 -# Locations are stored in XDG_ECLASS_DESKTOPFILES and XDG_ECLASS_MIMEINFOFILES
61 -# respectively.
62 +# Finds .desktop, icon and mime info files for later handling in pkg_postinst.
63 +# Locations are stored in XDG_ECLASS_DESKTOPFILES, XDG_ECLASS_ICONFILES
64 +# and XDG_ECLASS_MIMEINFOFILES respectively.
65 xdg_pkg_preinst() {
66 local f
67
68 @@ -50,17 +50,22 @@ xdg_pkg_preinst() {
69 XDG_ECLASS_DESKTOPFILES+=( ${f} )
70 done < <(cd "${D}" && find 'usr/share/applications' -type f -print0 2>/dev/null)
71
72 + XDG_ECLASS_ICONFILES=()
73 + while IFS= read -r '' f; do
74 + XDG_ECLASS_ICONFILES+=( ${f} )
75 + done < <(cd "${D}" && find 'usr/share/icons' -type f -print0 2>/dev/null)
76 +
77 XDG_ECLASS_MIMEINFOFILES=()
78 while IFS= read -r -d '' f; do
79 XDG_ECLASS_MIMEINFOFILES+=( ${f} )
80 done < <(cd "${D}" && find 'usr/share/mime' -type f -print0 2>/dev/null)
81
82 - export XDG_ECLASS_DESKTOPFILES XDG_ECLASS_MIMEINFOFILES
83 + export XDG_ECLASS_DESKTOPFILES XDG_ECLASS_ICONFILES XDG_ECLASS_MIMEINFOFILES
84 }
85
86 # @FUNCTION: xdg_pkg_postinst
87 # @DESCRIPTION:
88 -# Handle desktop and mime info database updates.
89 +# Handle desktop, icon and mime info database updates.
90 xdg_pkg_postinst() {
91 if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
92 xdg_desktop_database_update
93 @@ -68,6 +73,12 @@ xdg_pkg_postinst() {
94 debug-print "No .desktop files to add to database"
95 fi
96
97 + if [[ ${#XDG_ECLASS_ICONFILES[@]} -gt 0 ]]; then
98 + xdg_icon_cache_update
99 + else
100 + debug-print "No icon files to add to cache"
101 + fi
102 +
103 if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
104 xdg_mimeinfo_database_update
105 else
106 @@ -77,7 +88,7 @@ xdg_pkg_postinst() {
107
108 # @FUNCTION: xdg_pkg_postrm
109 # @DESCRIPTION:
110 -# Handle desktop and mime info database updates.
111 +# Handle desktop, icon and mime info database updates.
112 xdg_pkg_postrm() {
113 if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
114 xdg_desktop_database_update
115 @@ -85,6 +96,12 @@ xdg_pkg_postrm() {
116 debug-print "No .desktop files to add to database"
117 fi
118
119 + if [[ ${#XDG_ECLASS_ICONFILES[@]} -gt 0 ]]; then
120 + xdg_icon_cache_update
121 + else
122 + debug-print "No icon files to add to cache"
123 + fi
124 +
125 if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
126 xdg_mimeinfo_database_update
127 else
128 --
129 2.17.1