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
Since D, ED, ROOT, EROOT no longer have a trailing slash in EAPI=7
This eclass is terribly broken, installing things into
imageusr/...

Reported by AnAverageHuman on #gentoo-dev-help

Signed-off-by: Georgy Yakovlev <gyakovlev@g.o>
---
 eclass/opam.eclass | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/eclass/opam.eclass b/eclass/opam.eclass
index 5c9c4950dd2..ba4f515f0ec 100644
--- a/eclass/opam.eclass
+++ b/eclass/opam.eclass
@@ -1,51 +1,51 @@
 # Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: opam.eclass
 # @MAINTAINER:
 # Gentoo ML Project <ml@g.o>
 # @AUTHOR:
 # Alexis Ballier <aballier@g.o>
 # @SUPPORTED_EAPIS: 5 6 7
 # @BLURB: Provides functions for installing opam packages.
 # @DESCRIPTION:
 # Provides dependencies on opam and ocaml, opam-install and a default
 # src_install for opam-based packages.
 
 case ${EAPI:-0} in
     0|1|2|3|4) die "You need at least EAPI-5 to use opam.eclass";;
     *) ;;
 esac
 
 RDEPEND=">=dev-lang/ocaml-4:="
 DEPEND="${RDEPEND}
 	dev-ml/opam"
 
 # @FUNCTION: opam-install
 # @USAGE: <list of packages>
 # @DESCRIPTION:
 # Installs the opam packages given as arguments. For each "${pkg}" element in
 # that list, "${pkg}.install" must be readable from current working directory.
 opam-install() {
 	local pkg
 	for pkg ; do
 		opam-installer -i \
-			--prefix="${ED}usr" \
-			--libdir="${D}$(ocamlc -where)" \
-			--docdir="${ED}usr/share/doc/${PF}" \
-			--mandir="${ED}usr/share/man" \
+			--prefix="${ED%/}usr" \
+			--libdir="${D%/}$(ocamlc -where)" \
+			--docdir="${ED%/}usr/share/doc/${PF}" \
+			--mandir="${ED%/}usr/share/man" \
 			"${pkg}.install" || die
 	done
 }
 
 opam_src_install() {
 	local pkg="${1:-${PN}}"
 	opam-install "${pkg}"
 	# Handle opam putting doc in a subdir
-	if [ -d "${ED}usr/share/doc/${PF}/${pkg}" ] ; then
-		mv "${ED}usr/share/doc/${PF}/${pkg}/"* "${ED}usr/share/doc/${PF}/" || die
-		rmdir "${ED}usr/share/doc/${PF}/${pkg}" || die
+	if [ -d "${ED%/}usr/share/doc/${PF}/${pkg}" ] ; then
+		mv "${ED%/}usr/share/doc/${PF}/${pkg}/"* "${ED%/}usr/share/doc/${PF}/" || die
+		rmdir "${ED%/}usr/share/doc/${PF}/${pkg}" || die
 	fi
 }
 
 EXPORT_FUNCTIONS src_install
-- 
2.20.1

Replies