From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1232693-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 3F31713835A
	for <garchives@archives.gentoo.org>; Sat, 19 Dec 2020 19:56:09 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 692BE2BC021;
	Sat, 19 Dec 2020 19:56:07 +0000 (UTC)
Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 51FE62BC021
	for <gentoo-commits@lists.gentoo.org>; Sat, 19 Dec 2020 19:56:07 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 854263410CE
	for <gentoo-commits@lists.gentoo.org>; Sat, 19 Dec 2020 19:56:06 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id DD6B144D
	for <gentoo-commits@lists.gentoo.org>; Sat, 19 Dec 2020 19:56:02 +0000 (UTC)
From: "Matt Turner" <mattst88@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" <mattst88@gentoo.org>
Message-ID: <1608087683.37cabf5c536fe8eef16532f18790c1da566aae15.mattst88@gentoo>
Subject: [gentoo-commits] proj/catalyst:wip/mattst88 commit in: targets/stage1/
X-VCS-Repository: proj/catalyst
X-VCS-Files: targets/stage1/chroot.sh
X-VCS-Directories: targets/stage1/
X-VCS-Committer: mattst88
X-VCS-Committer-Name: Matt Turner
X-VCS-Revision: 37cabf5c536fe8eef16532f18790c1da566aae15
X-VCS-Branch: wip/mattst88
Date: Sat, 19 Dec 2020 19:56:02 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 2b6ad635-f6a3-434a-ad64-46eea48f7095
X-Archives-Hash: 697339c758ae33ad04ca185c587fd614
Message-ID: <20201219195602.rwz3ZaWJwKLHntB_cRXPgZvzPHIQLQvX3qaX9KF-Qxw@z>

commit:     37cabf5c536fe8eef16532f18790c1da566aae15
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 15 03:29:56 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Dec 16 03:01:23 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=37cabf5c

targets: Use interpreter with portage module for build.py

Closes: https://bugs.gentoo.org/759685
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 targets/stage1/chroot.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/targets/stage1/chroot.sh b/targets/stage1/chroot.sh
index 83cd084d..6b9bfb3e 100755
--- a/targets/stage1/chroot.sh
+++ b/targets/stage1/chroot.sh
@@ -2,8 +2,13 @@
 
 source /tmp/chroot-functions.sh
 
-# We do this first, so we know our package list for --debug
-buildpkgs=($(/tmp/build.py))
+for module_path in /usr/lib/*/site-packages/portage/__init__.py; do
+	# Find the python interpreter
+	interpreter=$(echo $module_path | cut -d/ -f4)
+
+	buildpkgs=($($interpreter /tmp/build.py 2>/dev/null))
+	[[ $? == 0 ]] && break
+done
 
 ## Sanity check profile
 if [[ ${#buildpkgs[@]} -eq 0 ]]; then