public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/_emerge/
Date: Mon, 28 Sep 2015 16:08:01 +0000 (UTC)	[thread overview]
Message-ID: <1443456078.e6be71af3f67ea274db455e9c24d5f84bd372c39.zmedico@gentoo> (raw)

commit:     e6be71af3f67ea274db455e9c24d5f84bd372c39
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 27 23:10:40 2015 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Sep 28 16:01:18 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=e6be71af

AbstractEbuildProcess: remove cgroup with release_agent (bug 561264)

Use the cgroup release_agent hook to remove cgroups automatically
upon release.

X-Gentoo-bug: 561264
X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=561264
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org>

 bin/cgroup-release-agent             |  2 ++
 pym/_emerge/AbstractEbuildProcess.py | 14 +++++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/bin/cgroup-release-agent b/bin/cgroup-release-agent
new file mode 100755
index 0000000..7aa6d56
--- /dev/null
+++ b/bin/cgroup-release-agent
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec rmdir "/sys/fs/cgroup/portage/${1}"

diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
index 68d96e4..2b5d9c7 100644
--- a/pym/_emerge/AbstractEbuildProcess.py
+++ b/pym/_emerge/AbstractEbuildProcess.py
@@ -89,6 +89,13 @@ class AbstractEbuildProcess(SpawnProcess):
 					subprocess.check_call(['mount', '-t', 'cgroup',
 						'-o', 'rw,nosuid,nodev,noexec,none,name=portage',
 						'tmpfs', cgroup_portage])
+					with open(os.path.join(
+						cgroup_portage, 'release_agent'), 'w') as f:
+						f.write(os.path.join(self.settings['PORTAGE_BIN_PATH'],
+							'cgroup-release-agent'))
+					with open(os.path.join(
+						cgroup_portage, 'notify_on_release'), 'w') as f:
+						f.write('1')
 
 				cgroup_path = tempfile.mkdtemp(dir=cgroup_portage,
 					prefix='%s:%s.' % (self.settings["CATEGORY"],
@@ -313,13 +320,6 @@ class AbstractEbuildProcess(SpawnProcess):
 	def _set_returncode(self, wait_retval):
 		SpawnProcess._set_returncode(self, wait_retval)
 
-		if self.cgroup is not None:
-			try:
-				shutil.rmtree(self.cgroup)
-			except EnvironmentError as e:
-				if e.errno != errno.ENOENT:
-					raise
-
 		if self._exit_timeout_id is not None:
 			self.scheduler.source_remove(self._exit_timeout_id)
 			self._exit_timeout_id = None


             reply	other threads:[~2015-09-28 16:08 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-28 16:08 Zac Medico [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-04-30 19:28 [gentoo-commits] proj/portage:master commit in: bin/, pym/_emerge/ Zac Medico
2018-03-28  6:52 Zac Medico
2013-12-27 18:06 Arfrever Frehtes Taifersar Arahesis
2013-08-03  0:38 Zac Medico
2012-12-29  7:45 Zac Medico
2012-10-14 21:59 Zac Medico
2012-10-06 18:11 Zac Medico
2012-10-06 18:05 Zac Medico
2012-09-15 16:53 Zac Medico
2012-07-18 21:38 Zac Medico
2012-03-25 23:20 Zac Medico
2011-12-10  3:23 Zac Medico
2011-10-29  3:20 Zac Medico
2011-10-28 20:13 Zac Medico
2011-02-22  2:51 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1443456078.e6be71af3f67ea274db455e9c24d5f84bd372c39.zmedico@gentoo \
    --to=zmedico@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox