From e414b8571fed1e0da1a03e0a9719b580e21f7558 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 7 May 2011 21:34:25 -0700 Subject: [PATCH] Rename FEATURES=no-ebuild-locks to ebuild-locks. --- cnf/make.globals | 2 +- man/make.conf.5 | 4 ++++ pym/_emerge/EbuildPhase.py | 13 ++++++++----- pym/portage/const.py | 4 ++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/cnf/make.globals b/cnf/make.globals index bcad5deb6..2258fd2f2 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -51,7 +51,7 @@ RESUMECOMMAND_SSH=${FETCHCOMMAND_SSH} FETCHCOMMAND_SFTP="bash -c \"x=\\\${2#sftp://} ; host=\\\${x%%/*} ; port=\\\${host##*:} ; host=\\\${host%:*} ; [[ \\\${host} = \\\${port} ]] && port=22 ; exec sftp -P \\\${port} \\\"\\\${host}:/\\\${x#*/}\\\" \\\"\\\$1\\\"\" sftp \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" # Default user options -FEATURES="assume-digests binpkg-logs distlocks fixpackages +FEATURES="assume-digests binpkg-logs distlocks ebuild-locks fixpackages fixlafiles news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch" diff --git a/man/make.conf.5 b/man/make.conf.5 index 169296970..389bab1db 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -265,6 +265,10 @@ strangely configured Samba server (oplocks off, NFS re\-export). A tool /usr/lib/portage/bin/clean_locks exists to help handle lock issues when a problem arises (normally due to a crash or disconnect). .TP +.B ebuild\-locks +Use locks to ensure that unsandboxed ebuild phases never execute +concurrently. +.TP .B fakeroot Enable fakeroot for the install and package phases when a non-root user runs the \fBebuild\fR(1) command. diff --git a/pym/_emerge/EbuildPhase.py b/pym/_emerge/EbuildPhase.py index 77b3a4d88..e75673c7c 100644 --- a/pym/_emerge/EbuildPhase.py +++ b/pym/_emerge/EbuildPhase.py @@ -30,7 +30,8 @@ from portage import _unicode_encode class EbuildPhase(CompositeTask): - __slots__ = ("actionmap", "ebuild_lock", "phase", "settings") + __slots__ = ("actionmap", "phase", "settings") + \ + ("_ebuild_lock",) # FEATURES displayed prior to setup phase _features_display = ("ccache", "distcc", "fakeroot", @@ -144,16 +145,18 @@ class EbuildPhase(CompositeTask): settings=self.settings) if (self.phase in self._locked_phases and - "no-ebuild-locks" not in self.settings.features): + "ebuild-locks" in self.settings.features): root = self.settings["ROOT"] lock_path = os.path.join(root, portage.VDB_PATH + "-ebuild") - self.ebuild_lock = lockdir(lock_path) + if os.access(os.path.dirname(lock_path), os.W_OK): + self._ebuild_lock = lockdir(lock_path) self._start_task(ebuild_process, self._ebuild_exit) def _ebuild_exit(self, ebuild_process): - if self.ebuild_lock: - unlockdir(self.ebuild_lock) + if self._ebuild_lock is not None: + unlockdir(self._ebuild_lock) + self._ebuild_lock = None fail = False if self._default_exit(ebuild_process) != os.EX_OK: diff --git a/pym/portage/const.py b/pym/portage/const.py index dbbaa3e86..0bd56b20f 100644 --- a/pym/portage/const.py +++ b/pym/portage/const.py @@ -88,11 +88,11 @@ EBUILD_PHASES = ("pretend", "setup", "unpack", "prepare", "configure" SUPPORTED_FEATURES = frozenset([ "assume-digests", "binpkg-logs", "buildpkg", "buildsyspkg", "candy", "ccache", "chflags", "collision-protect", "compress-build-logs", - "digest", "distcc", "distlocks", "fakeroot", + "digest", "distcc", "distlocks", "ebuild-locks", "fakeroot", "fail-clean", "fixpackages", "force-mirror", "getbinpkg", "installsources", "keeptemp", "keepwork", "fixlafiles", "lmirror", "metadata-transfer", "mirror", "multilib-strict", "news", - "no-ebuild-locks", "noauto", "noclean", "nodoc", "noinfo", "noman", + "noauto", "noclean", "nodoc", "noinfo", "noman", "nostrip", "notitles", "parallel-fetch", "parse-eapi-ebuild-head", "prelink-checksums", "preserve-libs", "protect-owned", "python-trace", "sandbox", -- 2.26.2