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 4/4] gnome2.eclass: move icon handling code to xdg.eclass
Date: Wed, 20 Jun 2018 07:13:22
Message-Id: 20180620071053.11589-4-hanetzer@startmail.com
In Reply to: [gentoo-dev] [PATCH 1/4] xdg-utils.eclass: make EAPI 7 ready by "Marty E. Plummer"
1 ---
2 eclass/gnome2.eclass | 7 -------
3 eclass/xdg.eclass | 27 ++++++++++++++++++++++-----
4 2 files changed, 22 insertions(+), 12 deletions(-)
5
6 diff --git a/eclass/gnome2.eclass b/eclass/gnome2.eclass
7 index 6db6d08b14e..5b81cb4f01a 100644
8 --- a/eclass/gnome2.eclass
9 +++ b/eclass/gnome2.eclass
10 @@ -315,7 +315,6 @@ gnome2_src_install() {
11 gnome2_pkg_preinst() {
12 xdg_pkg_preinst
13 gnome2_gconf_savelist
14 - gnome2_icon_savelist
15 gnome2_schemas_savelist
16 gnome2_scrollkeeper_savelist
17 gnome2_gdk_pixbuf_savelist
18 @@ -337,9 +336,6 @@ gnome2_pkg_preinst() {
19 gnome2_pkg_postinst() {
20 xdg_pkg_postinst
21 gnome2_gconf_install
22 - if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
23 - gnome2_icon_cache_update
24 - fi
25 if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
26 gnome2_schemas_update
27 fi
28 @@ -361,9 +357,6 @@ gnome2_pkg_postinst() {
29 # Handle scrollkeeper, GSettings, Icons, desktop and mime database updates.
30 gnome2_pkg_postrm() {
31 xdg_pkg_postrm
32 - if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then
33 - gnome2_icon_cache_update
34 - fi
35 if [[ -n ${GNOME2_ECLASS_GLIB_SCHEMAS} ]]; then
36 gnome2_schemas_update
37 fi
38 diff --git a/eclass/xdg.eclass b/eclass/xdg.eclass
39 index fd4816b8447..29830a5ee15 100644
40 --- a/eclass/xdg.eclass
41 +++ b/eclass/xdg.eclass
42 @@ -39,9 +39,9 @@ xdg_src_prepare() {
43
44 # @FUNCTION: xdg_pkg_preinst
45 # @DESCRIPTION:
46 -# Finds .desktop and mime info files for later handling in pkg_postinst.
47 -# Locations are stored in XDG_ECLASS_DESKTOPFILES and XDG_ECLASS_MIMEINFOFILES
48 -# respectively.
49 +# Finds .desktop, icon, and mime info files for later handling in pkg_postinst.
50 +# Locations are stored in XDG_ECLASS_DESKTOPFILES, XDG_ECLASS_ICONS and
51 +# XDG_ECLASS_MIMEINFOFILES respectively.
52 xdg_pkg_preinst() {
53 local f
54
55 @@ -50,6 +50,11 @@ xdg_pkg_preinst() {
56 XDG_ECLASS_DESKTOPFILES+=( ${f} )
57 done < <(cd "${D}" && find 'usr/share/applications' -type f -print0 2>/dev/null)
58
59 + XDG_ECLASS_ICONS=()
60 + while IFS= read -r -d '' f; do
61 + XDG_ECLASS_ICONS+=( ${f} )
62 + done < <(cd "${D}" && find 'usr/share/icons' -type f -print0 2>/dev/null)
63 +
64 XDG_ECLASS_MIMEINFOFILES=()
65 while IFS= read -r -d '' f; do
66 XDG_ECLASS_MIMEINFOFILES+=( ${f} )
67 @@ -60,7 +65,7 @@ xdg_pkg_preinst() {
68
69 # @FUNCTION: xdg_pkg_postinst
70 # @DESCRIPTION:
71 -# Handle desktop and mime info database updates.
72 +# Handle desktop, icon and mime info database updates.
73 xdg_pkg_postinst() {
74 if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
75 xdg_desktop_database_update
76 @@ -68,6 +73,12 @@ xdg_pkg_postinst() {
77 debug-print "No .desktop files to add to database"
78 fi
79
80 + if [[ ${#XDG_ECLASS_ICONS[@]} -gt 0 ]]; then
81 + xdg_icon_cache_update
82 + else
83 + debug-print "No icon files to add to database"
84 + fi
85 +
86 if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
87 xdg_mimeinfo_database_update
88 else
89 @@ -77,7 +88,7 @@ xdg_pkg_postinst() {
90
91 # @FUNCTION: xdg_pkg_postrm
92 # @DESCRIPTION:
93 -# Handle desktop and mime info database updates.
94 +# Handle desktop, icon and mime info database updates.
95 xdg_pkg_postrm() {
96 if [[ ${#XDG_ECLASS_DESKTOPFILES[@]} -gt 0 ]]; then
97 xdg_desktop_database_update
98 @@ -85,6 +96,12 @@ xdg_pkg_postrm() {
99 debug-print "No .desktop files to add to database"
100 fi
101
102 + if [[ ${#XDG_ECLASS_ICONS[@]} -gt 0 ]]; then
103 + xdg_icon_cache_update
104 + else
105 + debug-print "No icon files to add to database"
106 + fi
107 +
108 if [[ ${#XDG_ECLASS_MIMEINFOFILES[@]} -gt 0 ]]; then
109 xdg_mimeinfo_database_update
110 else
111 --
112 2.17.1

Replies