From: Zac Medico Date: Tue, 14 Sep 2010 05:49:03 +0000 (-0700) Subject: Make AbstractEbuildProcess lock PORTAGE_BUILDIR if it's not already X-Git-Tag: v2.2_rc82~18 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ac0965588410cb437efff2a240256e2c0a5bfd7b;p=portage.git Make AbstractEbuildProcess lock PORTAGE_BUILDIR if it's not already locked. --- diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py index ed20b14f9..7169dab58 100644 --- a/pym/_emerge/AbstractEbuildProcess.py +++ b/pym/_emerge/AbstractEbuildProcess.py @@ -4,6 +4,7 @@ import stat import textwrap from _emerge.SpawnProcess import SpawnProcess +from _emerge.EbuildBuildDir import EbuildBuildDir from _emerge.EbuildIpcDaemon import EbuildIpcDaemon import portage from portage.elog import messages as elog_messages @@ -20,7 +21,7 @@ from portage.util import apply_secpass_permissions class AbstractEbuildProcess(SpawnProcess): __slots__ = ('phase', 'settings',) + \ - ('_ipc_daemon', '_exit_command',) + ('_build_dir', '_ipc_daemon', '_exit_command',) _phases_without_builddir = ('clean', 'cleanrm', 'depend', 'help',) # Number of milliseconds to allow natural exit of the ebuild @@ -67,6 +68,11 @@ class AbstractEbuildProcess(SpawnProcess): if self._enable_ipc_daemon: self.settings.pop('PORTAGE_EBUILD_EXIT_FILE', None) if self.phase not in self._phases_without_builddir: + if 'PORTAGE_BUILDIR_LOCKED' not in self.settings: + self._build_dir = EbuildBuildDir( + dir_path=self.settings['PORTAGE_BUILDDIR'], + scheduler=self.scheduler, settings=self.settings) + self._build_dir.lock() self.settings['PORTAGE_IPC_DAEMON'] = "1" self._start_ipc_daemon() else: @@ -230,6 +236,9 @@ class AbstractEbuildProcess(SpawnProcess): else: self.returncode = 1 self._unexpected_exit() + if self._build_dir is not None: + self._build_dir.unlock() + self._build_dir = None else: exit_file = self.settings.get('PORTAGE_EBUILD_EXIT_FILE') if exit_file and not os.path.exists(exit_file): diff --git a/pym/_emerge/EbuildBuildDir.py b/pym/_emerge/EbuildBuildDir.py index 1dc63c3b4..af3ce0792 100644 --- a/pym/_emerge/EbuildBuildDir.py +++ b/pym/_emerge/EbuildBuildDir.py @@ -45,6 +45,7 @@ class EbuildBuildDir(SlotObject): builddir_lock.start() builddir_lock.wait() self._lock_obj = builddir_lock.lock_obj + self.settings['PORTAGE_BUILDIR_LOCKED'] = '1' finally: self.locked = self._lock_obj is not None catdir_lock.unlock() @@ -70,6 +71,7 @@ class EbuildBuildDir(SlotObject): portage.locks.unlockdir(self._lock_obj) self._lock_obj = None self.locked = False + self.settings.pop('PORTAGE_BUILDIR_LOCKED', None) catdir = self._catdir catdir_lock = None diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py index 70db71b24..2eac17aac 100644 --- a/pym/portage/package/ebuild/_config/special_env_vars.py +++ b/pym/portage/package/ebuild/_config/special_env_vars.py @@ -12,7 +12,7 @@ env_blacklist = frozenset(( "A", "AA", "CATEGORY", "DEPEND", "DESCRIPTION", "EAPI", "EBUILD_PHASE", "ED", "EMERGE_FROM", "EPREFIX", "EROOT", "HOMEPAGE", "INHERITED", "IUSE", - "KEYWORDS", "LICENSE", "PDEPEND", "PF", "PKGUSE", + "KEYWORDS", "LICENSE", "PDEPEND", "PF", "PKGUSE", "PORTAGE_BUILDIR_LOCKED", "PORTAGE_BUILT_USE", "PORTAGE_CONFIGROOT", "PORTAGE_IUSE", "PORTAGE_NONFATAL", "PORTAGE_REPO_NAME", "PORTAGE_SANDBOX_COMPAT_LEVEL", "PORTAGE_USE", "PROPERTIES", "PROVIDE", "RDEPEND", "RESTRICT",