Temporary workaround to fix make_chroot --fast

Three changes here:
  1) parallel_emerge now only disables PORTAGE_LOCKS on board builds. This
     slows down make_chroot --fast, but works around a bug where make_chroot
     --fast sometimes merges broken packages.
  2) Only set PORTAGE_LOCKS if it's not already set. This allows users to
     override PORTAGE_LOCKS and request that it be enabled using
     PORTAGE_LOCKS=true
  3) Only add the no-env-update feature if PORTAGE_LOCKS=false. This feature
     is only needed for that case.

Long term fix is to patch PORTAGE_LOCKS feature to lock postinst. That'll be
tracked in a separate bug.

BUG=chromium-os:6750
TEST=Run make_chroot --fast. It works every time now, but is slower.
     build_packages && build_image run at same speed as before.

Change-Id: I12ab40671034e10cd2ffbba45281ca44718d1d2c

Review URL: http://codereview.chromium.org/3446006
This commit is contained in:
David James 2010-09-15 16:19:38 -07:00
parent 5ebed121aa
commit 0f0402900a

View File

@ -300,8 +300,12 @@ class DepGraphGenerator(object):
# will be going away soon as we migrate to CROS_WORKON_SRCROOT.
os.environ.setdefault("CHROMEOS_ROOT", os.environ["HOME"] + "/trunk")
# Modify the environment to disable locking.
os.environ["PORTAGE_LOCKS"] = "false"
# Modify the environment to disable locking by default.
# TODO(davidjames): This option can cause problems if packages muck
# with each other during the post-install step. There are a few host
# packages that do this, so we only do this environment modification for
# board builds.
os.environ.setdefault("PORTAGE_LOCKS", "false")
# Turn off interactive delays
os.environ["EBEEP_IGNORE"] = "1"
@ -344,9 +348,10 @@ class DepGraphGenerator(object):
features = os.environ.get("FEATURES", "") + " -collision-protect"
# If we're cross-compiling, updating the environment every time we install
# a package isn't necessary, and leads to race conditions. Do environment
# updates at the end, instead.
if self.board:
# a package isn't necessary, and leads to race conditions when
# PORTAGE_LOCKS is false. In this case, do environment updates at the end,
# instead.
if self.board and os.environ.get("PORTAGE_LOCKS") == "false":
features = features + " no-env-update"
os.environ["FEATURES"] = features