Gentoo Archives: gentoo-dev

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