Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: cluster@g.o, robbat2@g.o, toolchain@g.o, suse@g.o, llvm@g.o
Subject: Re: [gentoo-dev] [PATCH 02/12] dev-util/ccache: Convert to EAPI=6
Date: Thu, 17 Aug 2017 09:00:26
Message-Id: 1502960411.18375.0.camel@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH 02/12] dev-util/ccache: Convert to EAPI=6 by David Seifert
1 W dniu czw, 17.08.2017 o godzinie 10∶48 +0200, użytkownik David Seifert
2 napisał:
3 > On Thu, 2017-08-17 at 10:36 +0200, Michał Górny wrote:
4 > > ---
5 > > dev-util/ccache/ccache-3.3.4-r1.ebuild | 68
6 > > ++++++++++++++++++++++++++++++++++
7 > > 1 file changed, 68 insertions(+)
8 > > create mode 100644 dev-util/ccache/ccache-3.3.4-r1.ebuild
9 > >
10 > > diff --git a/dev-util/ccache/ccache-3.3.4-r1.ebuild b/dev-
11 > > util/ccache/ccache-3.3.4-r1.ebuild
12 > > new file mode 100644
13 > > index 000000000000..1ef1d45179d1
14 > > --- /dev/null
15 > > +++ b/dev-util/ccache/ccache-3.3.4-r1.ebuild
16 > > @@ -0,0 +1,68 @@
17 > > +# Copyright 1999-2017 Gentoo Foundation
18 > > +# Distributed under the terms of the GNU General Public License v2
19 > > +
20 > > +EAPI=6
21 > > +
22 > > +inherit readme.gentoo-r1
23 > > +
24 > > +DESCRIPTION="fast compiler cache"
25 > > +HOMEPAGE="http://ccache.samba.org/"
26 > > +SRC_URI="https://samba.org/ftp/ccache/${P}.tar.xz"
27 > > +
28 > > +LICENSE="GPL-3"
29 > > +SLOT="0"
30 > > +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc
31 > > ~ppc64 ~s390 ~sh ~sparc ~x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-
32 > > macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~x64-solaris
33 > > ~x86-solaris"
34 > > +IUSE=""
35 > > +
36 > > +DEPEND="app-arch/xz-utils
37 > > + sys-libs/zlib"
38 > > +RDEPEND="${DEPEND}
39 > > + sys-apps/gentoo-functions"
40 > > +
41 > > +src_prepare() {
42 > > + # make sure we always use system zlib
43 > > + rm -rf zlib || die
44 > > + eapply "${FILESDIR}"/${PN}-3.3-size-on-disk.patch #456178
45 > > + eapply_user
46 > > + sed \
47 > > + -e "/^EPREFIX=/s:'':'${EPREFIX}':" \
48 > > + "${FILESDIR}"/ccache-config-3 > ccache-config || die
49 > > +}
50 > > +
51 > > +src_install() {
52 > > + DOCS=( AUTHORS.txt MANUAL.txt NEWS.txt README.md )
53 > > + default
54 > > +
55 > > + dobin ccache-config
56 > > +
57 > > + DOC_CONTENTS="
58 > > +To use ccache with **non-Portage** C compiling, add
59 > > +${EPREFIX}/usr/lib/ccache/bin to the beginning of your path, before
60 > > ${EPREFIX}/usr/bin.
61 > > +Portage 2.0.46-r11+ will automatically take advantage of ccache with
62 > > +no additional steps. If this is your first install of ccache, type
63 > > +something like this to set a maximum cache size of 2GB:\\n
64 > > +# ccache -M 2G\\n
65 > > +If you are upgrading from an older version than 3.x you should clear
66 > > all of your caches like so:\\n
67 > > +# CCACHE_DIR='${CCACHE_DIR:-${PORTAGE_TMPDIR}/ccache}' ccache -C\\n
68 > > +ccache now supports sys-devel/clang and dev-lang/icc, too!"
69 > > +
70 > > + readme.gentoo_create_doc
71 > > +}
72 > > +
73 > > +pkg_prerm() {
74 > > + if [[ -z ${REPLACED_BY_VERSION} ]] ; then
75 > > + "${EROOT}"/usr/bin/ccache-config --remove-links
76 > > + "${EROOT}"/usr/bin/ccache-config --remove-links
77 > > ${CHOST}
78 > > + fi
79 > > +}
80 > > +
81 > > +pkg_postinst() {
82 > > + "${EROOT}"/usr/bin/ccache-config --install-links
83 > > + "${EROOT}"/usr/bin/ccache-config --install-links ${CHOST}
84 > > +
85 > > + # nuke broken symlinks from previous versions that shouldn't
86 > > exist
87 > > + rm -f "${EROOT}"/usr/lib/ccache/bin/${CHOST}-cc || die
88 > > + rm -rf "${EROOT}"/usr/lib/ccache.backup || die
89 > > +
90 > > + readme.gentoo_print_elog
91 > > +}
92 >
93 > While I personally am not as uptight about 'local'ising variables, I
94 > believe making DOC_CONTENTS local serves an important purpose: to dodge
95 > any chance of people thinking it is allowed to leak into pkg_* phases
96 > (i.e. the whole rationale of readme.gentoo-r1 in the first place). For
97 > DOCS and friends its irrelevant, as their semantics are only import in
98 > src_* phases.
99 >
100
101 Are you saying that I should move it to pkg_setup()?
102
103 --
104 Best regards,
105 Michał Górny

Replies