public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/, gentoopm/basepm/
@ 2011-07-12  8:43 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2011-07-12  8:43 UTC (permalink / raw
  To: gentoo-commits

commit:     5bcd5b16d08ae263e9973196f144b72b8c7b7d0a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 12 08:44:18 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul 12 08:44:18 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=5bcd5b16

Portage: support grabbing userpriv from config.

---
 gentoopm/basepm/config.py    |   27 ++++++++++++++++++++++++++-
 gentoopm/portagepm/config.py |   14 ++++++++++++++
 2 files changed, 40 insertions(+), 1 deletions(-)

diff --git a/gentoopm/basepm/config.py b/gentoopm/basepm/config.py
index 90dbb67..d011001 100644
--- a/gentoopm/basepm/config.py
+++ b/gentoopm/basepm/config.py
@@ -8,4 +8,29 @@ from abc import abstractproperty
 from gentoopm.util import ABCObject
 
 class PMConfig(ABCObject):
-	pass
+	@abstractproperty
+	def userpriv_enabled(self):
+		"""
+		Check whether root privileges are dropped for build-time.
+
+		@type: bool
+		"""
+		pass
+
+	@abstractproperty
+	def userpriv_uid(self):
+		"""
+		The UID used for userpriv.
+
+		@type: string/numeric
+		"""
+		pass
+
+	@abstractproperty
+	def userpriv_gid(self):
+		"""
+		The GID used for userpriv.
+
+		@type: string/numeric
+		"""
+		pass

diff --git a/gentoopm/portagepm/config.py b/gentoopm/portagepm/config.py
index 5f80506..5bb697d 100644
--- a/gentoopm/portagepm/config.py
+++ b/gentoopm/portagepm/config.py
@@ -3,8 +3,22 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
+import portage.data
+
 from gentoopm.basepm.config import PMConfig
 
 class PortageConfig(PMConfig):
 	def __init__(self, settings):
 		self._settings = settings
+
+	@property
+	def userpriv_enabled(self):
+		return 'userpriv' in self._settings.features
+
+	@property
+	def userpriv_uid(self):
+		return portage.data.portage_uid
+
+	@property
+	def userpriv_gid(self):
+		return portage.data.portage_gid



^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/, gentoopm/basepm/
@ 2011-07-07 19:55 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2011-07-07 19:55 UTC (permalink / raw
  To: gentoo-commits

commit:     a23f4f0a03bb3a09aa588c6f819bad94e1e27e67
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  7 19:55:50 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul  7 19:55:50 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=a23f4f0a

Support checking for matching atoms through 'atom in pkgset'.

---
 gentoopm/basepm/pkg.py    |   13 +++++++++++++
 gentoopm/portagepm/pkg.py |    2 +-
 2 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/gentoopm/basepm/pkg.py b/gentoopm/basepm/pkg.py
index f7e534a..2e801e0 100644
--- a/gentoopm/basepm/pkg.py
+++ b/gentoopm/basepm/pkg.py
@@ -67,6 +67,19 @@ class PMPackageSet(ABCObject):
 		except KeyError:
 			raise ValueError('Ambiguous filter (matches more than a single package name).')
 
+	def __contains__(self, arg):
+		"""
+		Check whether the package set contains at least a single package
+		matching the filter or package atom passed as an argument.
+		"""
+
+		i = iter(self.filter(arg))
+		try:
+			next(i)
+		except StopIteration:
+			return False
+		return True
+
 class PMFilteredPackageSet(PMPackageSet):
 	def __init__(self, it, args, kwargs):
 		self._iter = it

diff --git a/gentoopm/portagepm/pkg.py b/gentoopm/portagepm/pkg.py
index ca2c054..d2ea1ad 100644
--- a/gentoopm/portagepm/pkg.py
+++ b/gentoopm/portagepm/pkg.py
@@ -52,7 +52,7 @@ class PortageCPV(PortageDBCPV):
 	def __cmp__(self, other):
 		if not isinstance(other, PortageCPV):
 			raise TypeError('Unable to compare %s against %s' % \
-					self, other)
+					(self, other))
 		return cmp(cpv_getkey(self._cpv), cpv_getkey(other._cpv)) \
 				or vercmp(cpv_getversion(self._cpv), cpv_getversion(other._cpv)) \
 				or cmp(self._repo_prio, other._repo_prio)



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-07-12  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-12  8:43 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/portagepm/, gentoopm/basepm/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2011-07-07 19:55 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox