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