Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: eva@g.o
Subject: Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update
Date: Sat, 31 Aug 2013 11:40:42
Message-Id: 20130831134046.7dc07f06@gentoo.org
In Reply to: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update by Gilles Dartiguelongue
1 Dnia 2013-08-31, o godz. 13:07:41
2 Gilles Dartiguelongue <eva@g.o> napisał(a):
3
4 > +# @FUNCTION: gnome2_gdk_pixbuf_savelist
5 > +# @DESCRIPTION:
6 > +# Find if there is any gdk-pixbuf loader to install and save the list in
7 > +# GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
8 > +# This function should be called from pkg_preinst.
9 > +gnome2_gdk_pixbuf_savelist() {
10 > + has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
11 > + pushd "${ED}" &>/dev/null
12
13 pushd "${ED}" >/dev/null || die
14
15 (don't hide errors)
16
17 > + export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find "usr/$(get_libdir)/gdk-pixbuf-2.0" -type f 2>/dev/null)
18 > + popd &>/dev/null
19 > +}
20 > +
21 > +# @FUNCTION: gnome2_gdk_pixbuf_update
22 > +# @USAGE: gnome2_gdk_pixbuf_update
23 > +# @DESCRIPTION:
24 > +# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some.
25 > +# This function should be called from pkg_postinst and pkg_postrm.
26 > +gnome2_gdk_pixbuf_update() {
27 > + has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
28 > + local updater="${EROOT}${GDK_PIXBUF_UPDATE_BIN}"
29 > +
30 > + if [[ ! -x ${updater} ]]; then
31 > + debug-print "${updater} is not executable"
32 > + return
33 > + fi
34 > +
35 > + if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
36 > + debug-print "gdk-pixbuf loader cache does not need an update"
37 > + return
38 > + fi
39 > +
40 > + ebegin "Updating gdk-pixbuf loader cache"
41 > + local tmp_file=$(mktemp -t tmp.XXXXXXXXXX_gdkpixbuf)
42 > + ${updater} 1> "${tmp_file}" 2>/dev/null &&
43
44 Why do you hide errors from user? '[FAIL]' with no explanation doesn't
45 seem really helpeful.
46
47 > + cat "${tmp_file}" > "${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache"
48
49 Why not mv or cp? Also you need '|| die' here since 'cat' can fail
50 writing.
51
52 Is it safe to assume constant '2.10.0'?
53
54 > + eend $?
55 > +}
56 > +
57 > +
58 > # @FUNCTION: gnome2_query_immodules_gtk2
59 > # @USAGE: gnome2_query_immodules_gtk2
60 > # @DESCRIPTION:
61
62 Also, please make 'loaders.cache' owned by x11-libs/gdk-pixbuf.
63 And please ensure to remove it in pkg_postrm() when last version
64 of gdk-pixbuf is unmerged.
65
66 --
67 Best regards,
68 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies