Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH v3] dosym: protect Prefix hack from double EPREFIX
Date: Thu, 20 Apr 2017 18:29:57
Message-Id: 20170420182943.15592-1-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] dosym: protect Prefix hack from double EPREFIX by "Michał Górny"
1 Add an additional conditional to the dosym Prefix hack to ensure that
2 the symlink is not using double Prefix when the ebuild uses ${EPREFIX}
3 explicitly. This ensures that Portage on Prefix systems is both
4 compatible with the ebuilds relying on the hack, and using dosym
5 in the PMS-defined manner.
6 ---
7 bin/ebuild-helpers/dosym | 12 +++++++++---
8 1 file changed, 9 insertions(+), 3 deletions(-)
9
10 diff --git a/bin/ebuild-helpers/dosym b/bin/ebuild-helpers/dosym
11 index 0bc8cc7be..11596403f 100755
12 --- a/bin/ebuild-helpers/dosym
13 +++ b/bin/ebuild-helpers/dosym
14 @@ -1,5 +1,5 @@
15 #!/bin/bash
16 -# Copyright 1999-2012 Gentoo Foundation
17 +# Copyright 1999-2017 Gentoo Foundation
18 # Distributed under the terms of the GNU General Public License v2
19
20 source "${PORTAGE_BIN_PATH}"/isolated-functions.sh || exit 1
21 @@ -21,9 +21,15 @@ fi
22
23 destdir=${2%/*}
24 [[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
25 -# when absolute, prefix with offset for Gentoo Prefix
26 target="${1}"
27 -[[ ${target:0:1} == "/" ]] && target="${EPREFIX}${target}"
28 +# DEPRECATED HACK: when absolute, prefix with offset for Gentoo Prefix
29 +# (but only if ${EPREFIX} is not there already)
30 +# this will eventually be removed, #615594
31 +if [[ ${target:0:1} == "/" && ${target}/ != "${EPREFIX}"/* ]]; then
32 + eqawarn "dosym: prepending EPREFIX to path implicitly. If this is desired,"
33 + eqawarn " please fix the ebuild to use \${EPREFIX} explicitly."
34 + target="${EPREFIX}${target}"
35 +fi
36 ln -snf "${target}" "${ED}${2}"
37
38 ret=$?
39 --
40 2.12.2