Gentoo Archives: gentoo-portage-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH] dosym: protect Prefix hack from double EPREFIX
Date: Wed, 19 Apr 2017 16:07:02
Message-Id: 22775.35616.121339.244596@a1i15.kph.uni-mainz.de
In Reply to: [gentoo-portage-dev] [PATCH] dosym: protect Prefix hack from double EPREFIX by "Michał Górny"
1 >>>>> On Wed, 19 Apr 2017, Michał Górny wrote:
2
3 > Add an additional conditional to the dosym Prefix hack to ensure that
4 > the symlink is not using double Prefix when the ebuild uses ${EPREFIX}
5 > explicitly. This ensures that Portage on Prefix systems is both
6 > compatible with the ebuilds relying on the hack, and using dosym
7 > in the PMS-defined manner.
8
9
10 > destdir=${2%/*}
11 > [[ ! -d ${ED}${destdir} ]] && dodir "${destdir}"
12 > -# when absolute, prefix with offset for Gentoo Prefix
13 > target="${1}"
14 > -[[ ${target:0:1} == "/" ]] && target="${EPREFIX}${target}"
15 > +# DEPRECATED HACK: when absolute, prefix with offset for Gentoo Prefix
16 > +# (but only if ${EPREFIX} is not there already)
17
18 Maybe add a date (like 2018-04-30) to the comment after which the code
19 can be removed?
20
21 > +if [[ ${target:0:1} == "/" && ${target} != "${EPREFIX}"* ]]; then
22
23 I think you want an additional slash in the second condition, in order
24 to prevent /foo/barbaz from matching if EPREFIX is equal to /foo/bar:
25
26 if [[ ${target:0:1} == "/" && ${target}/ != "${EPREFIX}"/* ]]; then
27
28 > + target="${EPREFIX}${target}"
29 > +fi
30 > ln -snf "${target}" "${ED}${2}"
31 >
32 > ret=$?
33
34 Ulrich

Replies