Gentoo Archives: gentoo-dev

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-dev@l.g.o
Cc: Georgy Yakovlev <gyakovlev@g.o>
Subject: [gentoo-dev] [PATCH] opam.eclass: unbreak on EAPI=7
Date: Sun, 03 Feb 2019 05:27:40
Message-Id: 20190203052729.51024-1-gyakovlev@gentoo.org
1 Since D, ED, ROOT, EROOT no longer have a trailing slash in EAPI=7
2 This eclass is terribly broken, installing things into
3 imageusr/...
4
5 Reported by AnAverageHuman on #gentoo-dev-help
6
7 Signed-off-by: Georgy Yakovlev <gyakovlev@g.o>
8 ---
9 eclass/opam.eclass | 14 +++++++-------
10 1 file changed, 7 insertions(+), 7 deletions(-)
11
12 diff --git a/eclass/opam.eclass b/eclass/opam.eclass
13 index 5c9c4950dd2..ba4f515f0ec 100644
14 --- a/eclass/opam.eclass
15 +++ b/eclass/opam.eclass
16 @@ -1,51 +1,51 @@
17 # Copyright 1999-2017 Gentoo Foundation
18 # Distributed under the terms of the GNU General Public License v2
19
20 # @ECLASS: opam.eclass
21 # @MAINTAINER:
22 # Gentoo ML Project <ml@g.o>
23 # @AUTHOR:
24 # Alexis Ballier <aballier@g.o>
25 # @SUPPORTED_EAPIS: 5 6 7
26 # @BLURB: Provides functions for installing opam packages.
27 # @DESCRIPTION:
28 # Provides dependencies on opam and ocaml, opam-install and a default
29 # src_install for opam-based packages.
30
31 case ${EAPI:-0} in
32 0|1|2|3|4) die "You need at least EAPI-5 to use opam.eclass";;
33 *) ;;
34 esac
35
36 RDEPEND=">=dev-lang/ocaml-4:="
37 DEPEND="${RDEPEND}
38 dev-ml/opam"
39
40 # @FUNCTION: opam-install
41 # @USAGE: <list of packages>
42 # @DESCRIPTION:
43 # Installs the opam packages given as arguments. For each "${pkg}" element in
44 # that list, "${pkg}.install" must be readable from current working directory.
45 opam-install() {
46 local pkg
47 for pkg ; do
48 opam-installer -i \
49 - --prefix="${ED}usr" \
50 - --libdir="${D}$(ocamlc -where)" \
51 - --docdir="${ED}usr/share/doc/${PF}" \
52 - --mandir="${ED}usr/share/man" \
53 + --prefix="${ED%/}usr" \
54 + --libdir="${D%/}$(ocamlc -where)" \
55 + --docdir="${ED%/}usr/share/doc/${PF}" \
56 + --mandir="${ED%/}usr/share/man" \
57 "${pkg}.install" || die
58 done
59 }
60
61 opam_src_install() {
62 local pkg="${1:-${PN}}"
63 opam-install "${pkg}"
64 # Handle opam putting doc in a subdir
65 - if [ -d "${ED}usr/share/doc/${PF}/${pkg}" ] ; then
66 - mv "${ED}usr/share/doc/${PF}/${pkg}/"* "${ED}usr/share/doc/${PF}/" || die
67 - rmdir "${ED}usr/share/doc/${PF}/${pkg}" || die
68 + if [ -d "${ED%/}usr/share/doc/${PF}/${pkg}" ] ; then
69 + mv "${ED%/}usr/share/doc/${PF}/${pkg}/"* "${ED%/}usr/share/doc/${PF}/" || die
70 + rmdir "${ED%/}usr/share/doc/${PF}/${pkg}" || die
71 fi
72 }
73
74 EXPORT_FUNCTIONS src_install
75 --
76 2.20.1

Replies