aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2015-11-03 13:07:55 -0800
committerZac Medico <zmedico@gentoo.org>2015-11-03 16:00:29 -0800
commit21930f70b7c3b98c9b3c1ac7b3ebdd31581ec00b (patch)
tree3bdfca010f39d4852f67f4b823f2f4a14c8ed929
parentegencache --update-changelogs: Support reversing order (diff)
downloadportage-21930f70b7c3b98c9b3c1ac7b3ebdd31581ec00b.tar.gz
portage-21930f70b7c3b98c9b3c1ac7b3ebdd31581ec00b.tar.bz2
portage-21930f70b7c3b98c9b3c1ac7b3ebdd31581ec00b.zip
AbstractEbuildProcess: validate cgroup release agent
Since commit e6be71af3f67ea274db455e9c24d5f84bd372c39, the release agent can refer to a temporary file if it was set while portage was updating itself. Fix it to reset the release agent when necessary. Fixes: e6be71af3f67 ("AbstractEbuildProcess: remove cgroup with release_agent (bug 561264)") Acked-by: Brian Dolbec <dolsen@gentoo.org>
-rw-r--r--pym/_emerge/AbstractEbuildProcess.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
index 2b5d9c78d..8bd30a640 100644
--- a/pym/_emerge/AbstractEbuildProcess.py
+++ b/pym/_emerge/AbstractEbuildProcess.py
@@ -96,6 +96,24 @@ class AbstractEbuildProcess(SpawnProcess):
with open(os.path.join(
cgroup_portage, 'notify_on_release'), 'w') as f:
f.write('1')
+ else:
+ # Update release_agent if it no longer exists, because
+ # it refers to a temporary path when portage is updating
+ # itself.
+ release_agent = os.path.join(
+ cgroup_portage, 'release_agent')
+ try:
+ with open(release_agent) as f:
+ release_agent_path = f.readline().rstrip('\n')
+ except EnvironmentError:
+ release_agent_path = None
+
+ if (release_agent_path is None or
+ not os.path.exists(release_agent_path)):
+ with open(release_agent, 'w') as f:
+ f.write(os.path.join(
+ self.settings['PORTAGE_BIN_PATH'],
+ 'cgroup-release-agent'))
cgroup_path = tempfile.mkdtemp(dir=cgroup_portage,
prefix='%s:%s.' % (self.settings["CATEGORY"],