diff options
author | 2020-08-29 13:13:44 -0700 | |
---|---|---|
committer | 2020-08-30 23:25:05 -0700 | |
commit | cf07a23a0ff77049476e0f4b94afbb6a844806fa (patch) | |
tree | d9ba20d1cca5730427a4d7c3e855b934d986d92d /lib/_emerge | |
parent | dephgraph: Allow elimination of highest version after slot conflict (bug 439688) (diff) | |
download | portage-cf07a23a0ff77049476e0f4b94afbb6a844806fa.tar.gz portage-cf07a23a0ff77049476e0f4b94afbb6a844806fa.tar.bz2 portage-cf07a23a0ff77049476e0f4b94afbb6a844806fa.zip |
Use cached portage.getpid() function (bug 739540)
Use the cached portage.getpid() function to avoid unnecessary syscalls,
and update the cache after each call to os.fork() where the fork may
invoke portage APIs.
Bug: https://bugs.gentoo.org/739540
Signed-off-by: Zac Medico <zmedico@gentoo.org>
Diffstat (limited to 'lib/_emerge')
-rw-r--r-- | lib/_emerge/EbuildBinpkg.py | 4 | ||||
-rw-r--r-- | lib/_emerge/actions.py | 2 |
2 files changed, 4 insertions, 2 deletions
diff --git a/lib/_emerge/EbuildBinpkg.py b/lib/_emerge/EbuildBinpkg.py index 6e098eb8a..879b3a9aa 100644 --- a/lib/_emerge/EbuildBinpkg.py +++ b/lib/_emerge/EbuildBinpkg.py @@ -3,6 +3,8 @@ from _emerge.CompositeTask import CompositeTask from _emerge.EbuildPhase import EbuildPhase + +import portage from portage import os class EbuildBinpkg(CompositeTask): @@ -17,7 +19,7 @@ class EbuildBinpkg(CompositeTask): root_config = pkg.root_config bintree = root_config.trees["bintree"] binpkg_tmpfile = os.path.join(bintree.pkgdir, - pkg.cpv + ".tbz2." + str(os.getpid())) + pkg.cpv + ".tbz2." + str(portage.getpid())) bintree._ensure_dir(os.path.dirname(binpkg_tmpfile)) self._binpkg_tmpfile = binpkg_tmpfile diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index 063f5d4a0..a4ecfe43d 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -2623,7 +2623,7 @@ def ionice(settings): if not ionice_cmd: return - variables = {"PID" : str(os.getpid())} + variables = {"PID" : str(portage.getpid())} cmd = [varexpand(x, mydict=variables) for x in ionice_cmd] try: |