From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org)
	by finch.gentoo.org with esmtp (Exim 4.60)
	(envelope-from <gentoo-commits+bounces-328918-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1Q2ck6-0000V8-QT
	for garchives@archives.gentoo.org; Thu, 24 Mar 2011 05:05:55 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 2D35A1C015;
	Thu, 24 Mar 2011 05:05:46 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id F1C6C1C015
	for <gentoo-commits@lists.gentoo.org>; Thu, 24 Mar 2011 05:05:45 +0000 (UTC)
Received: from pelican.gentoo.org (unknown [66.219.59.40])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 6BE2F1B407B
	for <gentoo-commits@lists.gentoo.org>; Thu, 24 Mar 2011 05:05:45 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id C675A8006A
	for <gentoo-commits@lists.gentoo.org>; Thu, 24 Mar 2011 05:05:44 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <20fff13645e50ec68c5a56c064e66e11aad72256.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/ebuild.sh
X-VCS-Directories: bin/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: 20fff13645e50ec68c5a56c064e66e11aad72256
Date: Thu, 24 Mar 2011 05:05:44 +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
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 
X-Archives-Hash: 0a11644aff19cb4ec0a757de1d271db9

commit:     20fff13645e50ec68c5a56c064e66e11aad72256
Author:     David James <davidjames <AT> google <DOT> com>
AuthorDate: Thu Mar 24 05:05:15 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Mar 24 05:05:15 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3D20fff136

Optimize ebuild.sh to cache preprocessing output.

Right now ebuild.sh runs preprocessing steps multiple times during the
same build. It processes the same environment and produces the same
output every time. This slows down the build unnecessarily.

This optimization cuts build time for 50 binary packages with 16 jobs
from 3m22 to 2m33 (33%).

Change-Id: I72ac84cce2eb60d17736cc5f5343d4a858ec86f4

Review URL: http://codereview.chromium.org/6733008

---
 bin/ebuild.sh |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 59bf46e..c79d4c3 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -1826,14 +1826,14 @@ filter_readonly_variables() {
 # interfering with the current environment. This is useful when an exist=
ing
 # environment needs to be loaded from a binary or installed package.
 preprocess_ebuild_env() {
-	local _portage_filter_opts=3D""
-	if [ -f "${T}/environment.raw" ] ; then
-		# This is a signal from the python side, indicating that the
-		# environment may contain stale SANDBOX_{DENY,PREDICT,READ,WRITE}
-		# and FEATURES variables that should be filtered out. Between
-		# phases, these variables are normally preserved.
-		_portage_filter_opts+=3D" --filter-features --filter-locale --filter-p=
ath --filter-sandbox"
-	fi
+	local _portage_filter_opts=3D"--filter-features --filter-locale --filte=
r-path --filter-sandbox"
+
+	# If environment.raw is present, this is a signal from the python side,
+	# indicating that the environment may contain stale FEATURES and
+	# SANDBOX_{DENY,PREDICT,READ,WRITE} variables that should be filtered o=
ut.
+	# Otherwise, we don't need to filter the environment.
+	[ -f "${T}/environment.raw" ] || return 0
+
 	filter_readonly_variables $_portage_filter_opts < "${T}"/environment \
 		>> "$T/environment.filtered" || return $?
 	unset _portage_filter_opts