Gentoo Archives: gentoo-dev

From: Gilles Dartiguelongue <eva@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update
Date: Sat, 31 Aug 2013 13:00:52
Message-Id: 1377954043.19411.9.camel@kanae
In Reply to: Re: [gentoo-dev] [PATCH] gnome2-utils.eclass add support for gdk-pixbuf cache update by "Michał Górny"
1 Le samedi 31 août 2013 à 13:40 +0200, Michał Górny a écrit :
2 > Dnia 2013-08-31, o godz. 13:07:41
3 > Gilles Dartiguelongue <eva@g.o> napisał(a):
4 >
5 > > +# @FUNCTION: gnome2_gdk_pixbuf_savelist
6 > > +# @DESCRIPTION:
7 > > +# Find if there is any gdk-pixbuf loader to install and save the list in
8 > > +# GNOME2_ECLASS_GDK_PIXBUF_LOADERS variable.
9 > > +# This function should be called from pkg_preinst.
10 > > +gnome2_gdk_pixbuf_savelist() {
11 > > + has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
12 > > + pushd "${ED}" &>/dev/null
13 >
14 > pushd "${ED}" >/dev/null || die
15 >
16 > (don't hide errors)
17
18 ok, I'll check all other usage in gnome eclasses.
19
20 > > + export GNOME2_ECLASS_GDK_PIXBUF_LOADERS=$(find "usr/$(get_libdir)/gdk-pixbuf-2.0" -type f 2>/dev/null)
21 > > + popd &>/dev/null
22 > > +}
23 > > +
24 > > +# @FUNCTION: gnome2_gdk_pixbuf_update
25 > > +# @USAGE: gnome2_gdk_pixbuf_update
26 > > +# @DESCRIPTION:
27 > > +# Updates gdk-pixbuf loader cache if GNOME2_ECLASS_GDK_PIXBUF_LOADERS has some.
28 > > +# This function should be called from pkg_postinst and pkg_postrm.
29 > > +gnome2_gdk_pixbuf_update() {
30 > > + has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
31 > > + local updater="${EROOT}${GDK_PIXBUF_UPDATE_BIN}"
32 > > +
33 > > + if [[ ! -x ${updater} ]]; then
34 > > + debug-print "${updater} is not executable"
35 > > + return
36 > > + fi
37 > > +
38 > > + if [[ -z ${GNOME2_ECLASS_GDK_PIXBUF_LOADERS} ]]; then
39 > > + debug-print "gdk-pixbuf loader cache does not need an update"
40 > > + return
41 > > + fi
42 > > +
43 > > + ebegin "Updating gdk-pixbuf loader cache"
44 > > + local tmp_file=$(mktemp -t tmp.XXXXXXXXXX_gdkpixbuf)
45 > > + ${updater} 1> "${tmp_file}" 2>/dev/null &&
46 >
47 > Why do you hide errors from user? '[FAIL]' with no explanation doesn't
48 > seem really helpeful.
49
50 True.
51
52 > > + cat "${tmp_file}" > "${EROOT}usr/$(get_libdir)/gdk-pixbuf-2.0/2.10.0/loaders.cache"
53 >
54 > Why not mv or cp? Also you need '|| die' here since 'cat' can fail
55 > writing.
56
57 I'd have to look back at the original bug report to get the exact reason
58 but it seems mv/cp was not atomic enough.
59
60 > Is it safe to assume constant '2.10.0'?
61
62 afaik yes, it's not changed in ages.
63
64 > > + eend $?
65 > > +}
66 > > +
67 > > +
68 > > # @FUNCTION: gnome2_query_immodules_gtk2
69 > > # @USAGE: gnome2_query_immodules_gtk2
70 > > # @DESCRIPTION:
71 >
72 > Also, please make 'loaders.cache' owned by x11-libs/gdk-pixbuf.
73
74 Yes, we need to work on that for all other caches as well.
75
76 > And please ensure to remove it in pkg_postrm() when last version
77 > of gdk-pixbuf is unmerged.
78
79 I am not clear on this last sentence. Could you reformulate it please ?
80
81 --
82 Gilles Dartiguelongue <eva@g.o>
83 Gentoo

Attachments

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

Replies