Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] bin/ebuild-helpers/portageq: fix bug #524964
Date: Sat, 11 Oct 2014 04:50:58
Message-Id: 5438B72D.6000501@gentoo.org
1 Since commit 0cc4c1ac21a2ea94cfb1f6ff4b461a9e349d47df,
2 $PORTAGE_BIN_PATH/portageq no longer exists, which breaks
3 bin/ebuild-helpers/portageq. Note that has_version and best_version
4 rely on bin/ebuild-helpers/portageq if IPC is disabled, so breakage
5 extends beyond ebuilds that call portageq "illegally". Since
6 $PORTAGE_BIN_PATH no longer works, use PATH to locate the real
7 portageq python script.
8
9 Fixes: 0cc4c1ac21a2 ("Install Portage using setup.py")
10 X-Gento-Bug: 524964
11 X-Gentoo-URL: https://bugs.gentoo.org/show_bug.cgi?id=524964
12 ---
13 bin/ebuild-helpers/portageq | 19 +++++++++++++++++--
14 1 file changed, 17 insertions(+), 2 deletions(-)
15
16 diff --git a/bin/ebuild-helpers/portageq b/bin/ebuild-helpers/portageq
17 index b67b03f..9eb17fc 100755
18 --- a/bin/ebuild-helpers/portageq
19 +++ b/bin/ebuild-helpers/portageq
20 @@ -2,9 +2,24 @@
21 # Copyright 2009-2013 Gentoo Foundation
22 # Distributed under the terms of the GNU General Public License v2
23
24 +scriptpath=${BASH_SOURCE[0]}
25 +scriptname=${scriptpath##*/}
26 +
27 PORTAGE_BIN_PATH=${PORTAGE_BIN_PATH:-/usr/lib/portage/bin}
28 PORTAGE_PYM_PATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
29 # Use safe cwd, avoiding unsafe import for bug #469338.
30 cd "${PORTAGE_PYM_PATH}"
31 -PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
32 - exec "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH/portageq" "$@"
33 +
34 +IFS=':'
35 +
36 +for path in ${PATH}; do
37 + [[ -x ${path}/${scriptname} ]] || continue
38 + [[ ${path}/${scriptname} -ef ${scriptpath} ]] && continue
39 + PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
40 + exec "${PORTAGE_PYTHON:-/usr/bin/python}" \
41 + "${path}/${scriptname}" "$@"
42 +done
43 +
44 +unset IFS
45 +echo "${scriptname}: command not found" 1>&2
46 +exit 127
47 --
48 1.8.5.5

Replies