summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid James <davidjames@google.com>2011-03-23 22:05:15 -0700
committerZac Medico <zmedico@gentoo.org>2011-03-26 12:20:52 -0700
commitfa3a5a04bc8eeb9e0eda44b21c7c8f3f49e00fa5 (patch)
tree618d63f1cf421dcd79f44ece2954a3af4f673e97
parent937f4f958f77b54a4c46b94e89af3f1720450e6b (diff)
downloadportage-fa3a5a04bc8eeb9e0eda44b21c7c8f3f49e00fa5.tar.gz
portage-fa3a5a04bc8eeb9e0eda44b21c7c8f3f49e00fa5.tar.bz2
portage-fa3a5a04bc8eeb9e0eda44b21c7c8f3f49e00fa5.zip
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
-rwxr-xr-xbin/ebuild.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index 59bf46e91..c79d4c3d0 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 existing
# environment needs to be loaded from a binary or installed package.
preprocess_ebuild_env() {
- local _portage_filter_opts=""
- 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+=" --filter-features --filter-locale --filter-path --filter-sandbox"
- fi
+ local _portage_filter_opts="--filter-features --filter-locale --filter-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 out.
+ # 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