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

commit:     2b23035543335ca792f9bc92be9db97ccda3a3a3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jul  6 17:53:03 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jul  6 17:53:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=2b230355

pkgcore: reimplement complete package sorting.

---
 gentoopm/pkgcorepm/pkg.py  |   10 +++++-----
 gentoopm/pkgcorepm/repo.py |    4 +++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index 559a229..8407c7e 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -7,8 +7,9 @@ from gentoopm.basepm.metadata import PMPackageMetadata
 from gentoopm.basepm.pkg import PMPackage
 
 class PkgCorePackage(PMPackage):
-	def __init__(self, pkg):
+	def __init__(self, pkg, repo_index = 0):
 		self._pkg = pkg
+		self._repo_index = repo_index
 
 	@property
 	def metadata(self):
@@ -21,10 +22,9 @@ class PkgCorePackage(PMPackage):
 	def __cmp__(self, other):
 		if not isinstance(other, PkgCorePackage):
 			raise TypeError('Unable to compare %s against %s' % \
-					self, other)
-		if self._pkg.key != other._pkg.key:
-			raise TypeError('Unable to compare ebuilds with different PNs')
-		return self._pkg.__cmp__(other._pkg)
+					(self, other))
+		return cmp(self._pkg, other._pkg) \
+				or cmp(other._repo_index, self._repo_index)
 
 class PkgCoreMetadata(PMPackageMetadata):
 	def __init__(self, pkg):

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index b0f0593..0bb1a78 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -16,12 +16,14 @@ class PkgCoreRepoDict(PMRepositoryDict):
 		self._stack = stack
 
 class PkgCoreRepository(PMRepository):
+	_index = 0
 	def __init__(self, repo_obj):
 		self._repo = repo_obj
 
 	def __iter__(self):
+		index = self._index
 		for pkg in self._repo:
-			yield PkgCorePackage(pkg)
+			yield PkgCorePackage(pkg, index)
 
 class PkgCoreEbuildRepo(PkgCoreRepository, PMEbuildRepository):
 	def __init__(self, repo_obj, index):



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-07  9:51 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-07  9:51 UTC (permalink / raw
  To: gentoo-commits

commit:     ed2b5adbd0af75cf03c3091261504a5a1ded43fd
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul  7 09:31:56 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul  7 09:31:56 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=ed2b5adb

pkgcore: don't append ::repo to installed.

---
 gentoopm/pkgcorepm/pkg.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index 5c33a46..220473f 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -25,7 +25,10 @@ class PkgCorePackage(PMPackage):
 
 	@property
 	def id(self):
-		return '%s::%s' % (self._pkg.cpvstr, self._pkg.repo.repo_id)
+		if self._repo_index != 0:
+			return '%s::%s' % (self._pkg.cpvstr, self._pkg.repo.repo_id)
+		else:
+			return self._pkg.cpvstr
 
 	def __cmp__(self, other):
 		if not isinstance(other, PkgCorePackage):



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-08  7:18 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-08  7:18 UTC (permalink / raw
  To: gentoo-commits

commit:     d6ad1d84ffb0ba44a9f4fd5271d61c55f817873d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  8 07:18:52 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul  8 07:18:52 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=d6ad1d84

pkgcore: support restriction creation and matching.

---
 gentoopm/pkgcorepm/atom.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/gentoopm/pkgcorepm/atom.py b/gentoopm/pkgcorepm/atom.py
index 541470a..62043ae 100644
--- a/gentoopm/pkgcorepm/atom.py
+++ b/gentoopm/pkgcorepm/atom.py
@@ -3,7 +3,13 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
+from pkgcore.util.parserestrict import parse_match
+
 from gentoopm.basepm.atom import PMAtom
 
 class PkgCoreAtom(PMAtom):
-	pass
+	def __init__(self, s):
+		self._r = parse_match(s)
+
+	def __contains__(self, pkg):
+		return self._r.match(pkg._pkg)



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-09  7:15 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-09  7:15 UTC (permalink / raw
  To: gentoo-commits

commit:     fdaa5dd40ebf8bca59055ad6892242c3b1a3d03d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  9 06:59:48 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jul  9 06:59:48 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=fdaa5dd4

pkgcore: add API for filter transforms.

---
 gentoopm/pkgcorepm/filter.py |   16 ++++++++++++++++
 gentoopm/pkgcorepm/repo.py   |   23 +++++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/gentoopm/pkgcorepm/filter.py b/gentoopm/pkgcorepm/filter.py
new file mode 100644
index 0000000..ad9aeca
--- /dev/null
+++ b/gentoopm/pkgcorepm/filter.py
@@ -0,0 +1,16 @@
+#!/usr/bin/python
+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+def transform_filters(args, kwargs):
+	"""
+	Transform our filters into pkgcore restrictions whenever possible. Takes
+	args and kwargs as passed to .filter() and returns a tuple (restriction,
+	newargs, newkwargs).
+
+	If no filters can be transformed, None is returned as restriction,
+	and args & kwargs are returned unmodified.
+	"""
+
+	return (None, args, kwargs)

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index 0bb1a78..0a63cab 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -6,6 +6,7 @@
 from gentoopm.basepm.repo import PMRepository, PMRepositoryDict, \
 		PMEbuildRepository
 from gentoopm.pkgcorepm.pkg import PkgCorePackage
+from gentoopm.pkgcorepm.filter import transform_filters
 
 class PkgCoreRepoDict(PMRepositoryDict):
 	def __iter__(self):
@@ -25,6 +26,28 @@ class PkgCoreRepository(PMRepository):
 		for pkg in self._repo:
 			yield PkgCorePackage(pkg, index)
 
+	def filter(self, *args, **kwargs):
+		r = self
+		filt, newargs, newkwargs = transform_filters(args, kwargs)
+
+		if filt:
+			r = PkgCoreFilteredRepo(self, filt)
+		if newargs or newkwargs:
+			r = PMRepository.filter(r, *args, **kwargs)
+
+		return r
+
+class PkgCoreFilteredRepo(PkgCoreRepository):
+	def __init__(self, repo, filt):
+		self._repo = repo
+		self._filt = filt
+		self._index = repo._index
+
+	def __iter__(self):
+		index = self._index
+		for pkg in self._repo.matches(self._filt):
+			yield PkgCorePackage(pkg, index)
+
 class PkgCoreEbuildRepo(PkgCoreRepository, PMEbuildRepository):
 	def __init__(self, repo_obj, index):
 		PkgCoreRepository.__init__(self, repo_obj)



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-09  7:15 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-09  7:15 UTC (permalink / raw
  To: gentoo-commits

commit:     af8c9393c0859f41ca3a3cca72b269bbb7d93bfd
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  9 07:11:26 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jul  9 07:12:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=af8c9393

pkgcore: support transforming atom restrictions.

---
 gentoopm/pkgcorepm/filter.py |   22 +++++++++++++++++++++-
 gentoopm/pkgcorepm/repo.py   |    2 +-
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/gentoopm/pkgcorepm/filter.py b/gentoopm/pkgcorepm/filter.py
index ad9aeca..6201637 100644
--- a/gentoopm/pkgcorepm/filter.py
+++ b/gentoopm/pkgcorepm/filter.py
@@ -3,6 +3,10 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
+import pkgcore.restrictions.boolean as br
+
+from gentoopm.pkgcorepm.atom import PkgCoreAtom
+
 def transform_filters(args, kwargs):
 	"""
 	Transform our filters into pkgcore restrictions whenever possible. Takes
@@ -13,4 +17,20 @@ def transform_filters(args, kwargs):
 	and args & kwargs are returned unmodified.
 	"""
 
-	return (None, args, kwargs)
+	newargs = []
+	f = []
+
+	for a in args:
+		if isinstance(a, PkgCoreAtom):
+			f.append(a._r)
+		else:
+			newargs.append(a)
+
+	if not f:
+		f = None
+	elif len(f) == 1:
+		f = f[0]
+	else:
+		f = br.AndRestriction(*f)
+
+	return (f, newargs, kwargs)

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index 0a63cab..c923c69 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -45,7 +45,7 @@ class PkgCoreFilteredRepo(PkgCoreRepository):
 
 	def __iter__(self):
 		index = self._index
-		for pkg in self._repo.matches(self._filt):
+		for pkg in self._repo._repo.match(self._filt):
 			yield PkgCorePackage(pkg, index)
 
 class PkgCoreEbuildRepo(PkgCoreRepository, PMEbuildRepository):



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-09  7:15 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-09  7:15 UTC (permalink / raw
  To: gentoo-commits

commit:     613cc058d3955b9527ccd34879ded887137b2ecc
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jul  9 07:16:05 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jul  9 07:16:20 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=613cc058

pkgcore: fix chaining filters.

---
 gentoopm/pkgcorepm/repo.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index c923c69..cd25359 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -3,6 +3,8 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
+import pkgcore.restrictions.boolean as br
+
 from gentoopm.basepm.repo import PMRepository, PMRepositoryDict, \
 		PMEbuildRepository
 from gentoopm.pkgcorepm.pkg import PkgCorePackage
@@ -48,6 +50,18 @@ class PkgCoreFilteredRepo(PkgCoreRepository):
 		for pkg in self._repo._repo.match(self._filt):
 			yield PkgCorePackage(pkg, index)
 
+	def filter(self, *args, **kwargs):
+		r = self
+		filt, newargs, newkwargs = transform_filters(args, kwargs)
+
+		if filt:
+			r = PkgCoreFilteredRepo(self._repo,
+					br.AndRestriction(self._filt, filt))
+		if newargs or newkwargs:
+			r = PMRepository.filter(r, *args, **kwargs)
+
+		return r
+
 class PkgCoreEbuildRepo(PkgCoreRepository, PMEbuildRepository):
 	def __init__(self, repo_obj, index):
 		PkgCoreRepository.__init__(self, repo_obj)



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-10 22:17 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-10 22:17 UTC (permalink / raw
  To: gentoo-commits

commit:     dc6dbc7c57f9ce4f3bed0b88b17d59521ec98043
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 10 22:13:10 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 10 22:17:02 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=dc6dbc7c

pkgcore: transform strings to atoms in filter().

---
 gentoopm/pkgcorepm/filter.py |    2 ++
 gentoopm/pkgcorepm/pkg.py    |   13 ++++++++++++-
 gentoopm/pkgcorepm/repo.py   |    9 +++++----
 3 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/gentoopm/pkgcorepm/filter.py b/gentoopm/pkgcorepm/filter.py
index 6201637..d7218b7 100644
--- a/gentoopm/pkgcorepm/filter.py
+++ b/gentoopm/pkgcorepm/filter.py
@@ -21,6 +21,8 @@ def transform_filters(args, kwargs):
 	f = []
 
 	for a in args:
+		if isinstance(a, basestring):
+			a = PkgCoreAtom(a)
 		if isinstance(a, PkgCoreAtom):
 			f.append(a._r)
 		else:

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index 220473f..8e344d0 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -4,7 +4,18 @@
 # Released under the terms of the 2-clause BSD license.
 
 from gentoopm.basepm.metadata import PMPackageMetadata
-from gentoopm.basepm.pkg import PMPackage
+from gentoopm.basepm.pkg import PMPackage, PMPackageSet, PMFilteredPackageSet
+from gentoopm.pkgcorepm.atom import PkgCoreAtom
+
+class PkgCorePackageSet(PMPackageSet):
+	def filter(self, *args, **kwargs):
+		newargs = [(a if not isinstance(a, basestring)
+			else PkgCoreAtom(a)) for a in args]
+
+		return PkgCoreFilteredPackageSet(self, newargs, kwargs)
+
+class PkgCoreFilteredPackageSet(PkgCorePackageSet, PMFilteredPackageSet):
+	pass
 
 class PkgCorePackage(PMPackage):
 	def __init__(self, pkg, repo_index = 0):

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index cd25359..c76d3c6 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -7,7 +7,8 @@ import pkgcore.restrictions.boolean as br
 
 from gentoopm.basepm.repo import PMRepository, PMRepositoryDict, \
 		PMEbuildRepository
-from gentoopm.pkgcorepm.pkg import PkgCorePackage
+from gentoopm.pkgcorepm.pkg import PkgCorePackage, PkgCorePackageSet, \
+		PkgCoreFilteredPackageSet
 from gentoopm.pkgcorepm.filter import transform_filters
 
 class PkgCoreRepoDict(PMRepositoryDict):
@@ -18,7 +19,7 @@ class PkgCoreRepoDict(PMRepositoryDict):
 	def __init__(self, stack):
 		self._stack = stack
 
-class PkgCoreRepository(PMRepository):
+class PkgCoreRepository(PkgCorePackageSet, PMRepository):
 	_index = 0
 	def __init__(self, repo_obj):
 		self._repo = repo_obj
@@ -35,7 +36,7 @@ class PkgCoreRepository(PMRepository):
 		if filt:
 			r = PkgCoreFilteredRepo(self, filt)
 		if newargs or newkwargs:
-			r = PMRepository.filter(r, *args, **kwargs)
+			r = PkgCoreFilteredPackageSet(r, args, kwargs)
 
 		return r
 
@@ -58,7 +59,7 @@ class PkgCoreFilteredRepo(PkgCoreRepository):
 			r = PkgCoreFilteredRepo(self._repo,
 					br.AndRestriction(self._filt, filt))
 		if newargs or newkwargs:
-			r = PMRepository.filter(r, *args, **kwargs)
+			r = PkgCoreFilteredPackageSet(r, args, kwargs)
 
 		return r
 



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-12  9:14 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-12  9:14 UTC (permalink / raw
  To: gentoo-commits

commit:     b974169f200857d17231a994adf6fbfecc26508c
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 12 09:15:19 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul 12 09:15:19 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=b974169f

pkgcore: support config.userpriv*.

---
 gentoopm/pkgcorepm/config.py |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/gentoopm/pkgcorepm/config.py b/gentoopm/pkgcorepm/config.py
index 3056268..8b9e80d 100644
--- a/gentoopm/pkgcorepm/config.py
+++ b/gentoopm/pkgcorepm/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 pkgcore.os_data
+
 from gentoopm.basepm.config import PMConfig
 
 class PkgCoreConfig(PMConfig):
 	def __init__(self, domain):
 		self._domain = domain
+
+	@property
+	def userpriv_enabled(self):
+		return 'userpriv' in self._domain.settings['FEATURES']
+
+	@property
+	def userpriv_uid(self):
+		return pkgcore.os_data.portage_uid
+
+	@property
+	def userpriv_gid(self):
+		return pkgcore.os_data.portage_gid



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-13 17:05 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-13 17:05 UTC (permalink / raw
  To: gentoo-commits

commit:     dee6024edcbe9b1beb695d7cb1c2caee8d8b550e
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 13 17:06:25 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jul 13 17:06:25 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=dee6024e

pkgcore: fix getting INHERITED from vardb.

---
 gentoopm/pkgcorepm/pkg.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index d621b70..2e41a5e 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -62,7 +62,12 @@ class PkgCoreMetadata(PMPackageMetadata):
 
 	@property
 	def INHERITED(self):
-		return ' '.join(self._pkg.data['_eclasses_'].keys())
+		# vdb uses INHERITED
+		# ebuilds use _eclasses_
+		try:
+			return self._pkg.data['INHERITED']
+		except KeyError:
+			return ' '.join(self._pkg.data['_eclasses_'].keys())
 
 	def __getattr__(self, key):
 		if key not in self:



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-13 17:16 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-13 17:16 UTC (permalink / raw
  To: gentoo-commits

commit:     84f1f3e6b299d34a6af35639f4b040b6af288630
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 13 17:16:44 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jul 13 17:16:44 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=84f1f3e6

pkgcore: fix empty INHERITED support.

---
 gentoopm/pkgcorepm/pkg.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index 2e41a5e..47732ab 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -67,7 +67,11 @@ class PkgCoreMetadata(PMPackageMetadata):
 		try:
 			return self._pkg.data['INHERITED']
 		except KeyError:
+			pass
+		try:
 			return ' '.join(self._pkg.data['_eclasses_'].keys())
+		except KeyError:
+			return ''
 
 	def __getattr__(self, key):
 		if key not in self:



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-14 13:31 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-14 13:31 UTC (permalink / raw
  To: gentoo-commits

commit:     30405657a8ea0dcef1c26211154badcd50754edb
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 14 12:40:13 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 14 12:40:13 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=30405657

pkgcore: use InvalidAtomStringError.

---
 gentoopm/pkgcorepm/atom.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gentoopm/pkgcorepm/atom.py b/gentoopm/pkgcorepm/atom.py
index 7c10925..c3969ab 100644
--- a/gentoopm/pkgcorepm/atom.py
+++ b/gentoopm/pkgcorepm/atom.py
@@ -4,13 +4,18 @@
 # Released under the terms of the 2-clause BSD license.
 
 from pkgcore.ebuild.atom import atom
-from pkgcore.util.parserestrict import parse_match
+from pkgcore.util.parserestrict import parse_match, ParseError
 
 from gentoopm.basepm.atom import PMAtom
+from gentoopm.exceptions import InvalidAtomStringError
 
 class PkgCoreAtom(PMAtom):
 	def __init__(self, s, pkg = None):
-		self._r = parse_match(s)
+		try:
+			self._r = parse_match(s)
+		except ParseError:
+			raise InvalidAtomStringError('Incorrect atom: %s' % s)
+
 		self._pkg = pkg
 
 	def __contains__(self, pkg):



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-15 12:34 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-15 12:34 UTC (permalink / raw
  To: gentoo-commits

commit:     0dec284d21305f3e167222fdd1ca453f3ca96e32
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 12:29:30 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 12:29:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=0dec284d

pkgcore: fix metadata access.

Use the processed metadata instead of raw ones.

---
 gentoopm/pkgcorepm/pkg.py |   29 +++++++++++++++++------------
 1 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index 472d92c..381eb6f 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -57,10 +57,6 @@ class PkgCoreMetadata(PMPackageMetadata):
 		self._pkg = pkg
 
 	@property
-	def EAPI(self):
-		return self._pkg.eapi
-
-	@property
 	def INHERITED(self):
 		# vdb uses INHERITED
 		# ebuilds use _eclasses_
@@ -73,14 +69,23 @@ class PkgCoreMetadata(PMPackageMetadata):
 		except KeyError:
 			return ''
 
+	@property
+	def DEPEND(self):
+		return str(self._pkg.depends)
+
+	@property
+	def RDEPEND(self):
+		return str(self._pkg.rdepends)
+
+	@property
+	def PDEPEND(self):
+		return str(self._pkg.post_rdepends)
+
 	def __getattr__(self, key):
 		if key not in self:
 			raise AttributeError('Unsupported metadata key: %s' % key)
-		try:
-			return self._pkg.data[key]
-		except KeyError:
-			return ''
-
-	@property
-	def CATEGORY(self):
-		return self._pkg.category
+		v = getattr(self._pkg, key.lower())
+		if isinstance(v, tuple) or isinstance(v, frozenset):
+			return ' '.join(v)
+		else:
+			return str(v)



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-15 13:32 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-15 13:32 UTC (permalink / raw
  To: gentoo-commits

commit:     70c49d5bceb635757840c0938dcbc636e1911ad3
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 15 13:16:16 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Jul 15 13:16:16 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=70c49d5b

pkgcore: use rich comparisons.

---
 gentoopm/pkgcorepm/pkg.py  |    6 +++---
 gentoopm/pkgcorepm/repo.py |    4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index 381eb6f..cbd4bef 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -45,12 +45,12 @@ class PkgCorePackage(PMPackage):
 	def atom(self):
 		return PkgCoreAtom('=%s' % self.id, self)
 
-	def __cmp__(self, other):
+	def __lt__(self, other):
 		if not isinstance(other, PkgCorePackage):
 			raise TypeError('Unable to compare %s against %s' % \
 					(self, other))
-		return cmp(self._pkg, other._pkg) \
-				or cmp(other._repo_index, self._repo_index)
+		return self._pkg < other._pkg \
+				or other._repo_index < self._repo_index
 
 class PkgCoreMetadata(PMPackageMetadata):
 	def __init__(self, pkg):

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index c76d3c6..4209a8b 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -76,8 +76,8 @@ class PkgCoreEbuildRepo(PkgCoreRepository, PMEbuildRepository):
 	def path(self):
 		return self._repo.location
 
-	def __cmp__(self, other):
-		return cmp(other._index, self._index)
+	def __lt__(self, other):
+		return other._index < self._index
 
 class PkgCoreInstalledRepo(PkgCoreRepository):
 	pass



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-21  8:47 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-21  8:47 UTC (permalink / raw
  To: gentoo-commits

commit:     2649ae3d83c1e93cefe994fe9cc565f2b0184069
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 21 07:28:36 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 21 07:28:36 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=2649ae3d

PkgCore: use _pkg_class for package classes.

---
 gentoopm/pkgcorepm/repo.py |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index 44b4872..9214c7c 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -3,6 +3,8 @@
 # (c) 2011 Michał Górny <mgorny@gentoo.org>
 # Released under the terms of the 2-clause BSD license.
 
+from abc import abstractproperty
+
 import pkgcore.restrictions.boolean as br
 
 from gentoopm.basepm.repo import PMRepository, PMRepositoryDict, \
@@ -25,10 +27,14 @@ class PkgCoreRepository(PkgCorePackageSet, PMRepository):
 	def __init__(self, repo_obj):
 		self._repo = repo_obj
 
+	@abstractproperty
+	def _pkg_class(self):
+		pass
+
 	def __iter__(self):
 		index = self._index
 		for pkg in self._repo:
-			yield PkgCorePackage(pkg, index)
+			yield self._pkg_class(pkg, index)
 
 	def filter(self, *args, **kwargs):
 		r = self
@@ -47,10 +53,14 @@ class PkgCoreFilteredRepo(PkgCoreRepository):
 		self._filt = filt
 		self._index = repo._index
 
+	@property
+	def _pkg_class(self):
+		return self._repo._pkg_class
+
 	def __iter__(self):
 		index = self._index
 		for pkg in self._repo._repo.match(self._filt):
-			yield PkgCorePackage(pkg, index)
+			yield self._pkg_class(pkg, index)
 
 	def filter(self, *args, **kwargs):
 		r = self
@@ -67,6 +77,8 @@ class PkgCoreFilteredRepo(PkgCoreRepository):
 class PkgCoreEbuildRepo(PkgCoreRepository, PMEbuildRepository,
 		FillMissingComparisons):
 
+	_pkg_class = PkgCorePackage
+
 	def __init__(self, repo_obj, index):
 		PkgCoreRepository.__init__(self, repo_obj)
 		self._index = index
@@ -83,4 +95,4 @@ class PkgCoreEbuildRepo(PkgCoreRepository, PMEbuildRepository,
 		return other._index < self._index
 
 class PkgCoreInstalledRepo(PkgCoreRepository):
-	pass
+	_pkg_class = PkgCorePackage



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-21  8:47 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-21  8:47 UTC (permalink / raw
  To: gentoo-commits

commit:     96bb393a2f7a3cb334ad3e91ed7faeee620a7fae
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 21 07:37:03 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 21 07:37:03 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=96bb393a

PkgCore: split out PkgCoreInstalledPackage class.

---
 gentoopm/pkgcorepm/pkg.py  |   26 +++++++++++++++++++-------
 gentoopm/pkgcorepm/repo.py |    4 ++--
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index e2c0288..c255914 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -4,7 +4,8 @@
 # Released under the terms of the 2-clause BSD license.
 
 from gentoopm.basepm.metadata import PMPackageMetadata
-from gentoopm.basepm.pkg import PMPackage, PMPackageDescription
+from gentoopm.basepm.pkg import PMPackage, PMPackageDescription, \
+		PMInstalledPackage
 from gentoopm.basepm.pkgset import PMPackageSet, PMFilteredPackageSet
 from gentoopm.pkgcorepm.atom import PkgCoreAtom
 from gentoopm.util import SpaceSepTuple
@@ -53,15 +54,10 @@ class PkgCorePackage(PMPackage, PkgCoreAtom):
 
 	@property
 	def inherits(self):
-		# ebuilds use _eclasses_
-		# vdb uses INHERITED
 		try:
 			l = self._pkg.data['_eclasses_']
 		except KeyError:
-			try:
-				l = self._pkg.data['INHERITED']
-			except KeyError:
-				l = ()
+			l = ()
 
 		return SpaceSepTuple(l)
 
@@ -99,6 +95,22 @@ class PkgCorePackage(PMPackage, PkgCoreAtom):
 		return self._pkg < other._pkg \
 				or other._repo_index < self._repo_index
 
+class PkgCoreInstalledPackage(PkgCorePackage, PMInstalledPackage):
+	@property
+	def inherits(self):
+		try:
+			l = self._pkg.data['INHERITED']
+		except KeyError:
+			l = ()
+
+		return SpaceSepTuple(l)
+
+	def __lt__(self, other):
+		if not isinstance(other, PkgCorePackage):
+			raise TypeError('Unable to compare %s against %s' % \
+					(self, other))
+		return self._pkg < other._pkg
+
 class PkgCoreMetadata(PMPackageMetadata):
 	def __init__(self, pkg):
 		self._pkg = pkg

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index 9214c7c..1fc2d35 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -10,7 +10,7 @@ import pkgcore.restrictions.boolean as br
 from gentoopm.basepm.repo import PMRepository, PMRepositoryDict, \
 		PMEbuildRepository
 from gentoopm.pkgcorepm.pkg import PkgCorePackage, PkgCorePackageSet, \
-		PkgCoreFilteredPackageSet
+		PkgCoreFilteredPackageSet, PkgCoreInstalledPackage
 from gentoopm.pkgcorepm.filter import transform_filters
 from gentoopm.util import FillMissingComparisons
 
@@ -95,4 +95,4 @@ class PkgCoreEbuildRepo(PkgCoreRepository, PMEbuildRepository,
 		return other._index < self._index
 
 class PkgCoreInstalledRepo(PkgCoreRepository):
-	_pkg_class = PkgCorePackage
+	_pkg_class = PkgCoreInstalledPackage



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-25 19:06 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-25 19:06 UTC (permalink / raw
  To: gentoo-commits

commit:     a3bd4f5475fc3c78a484184a51cebc7e85d7a6d4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 25 18:48:52 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jul 25 18:48:52 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=a3bd4f54

pkgcore: use configured trees.

---
 gentoopm/pkgcorepm/__init__.py |    6 ++++--
 gentoopm/pkgcorepm/repo.py     |   14 ++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/gentoopm/pkgcorepm/__init__.py b/gentoopm/pkgcorepm/__init__.py
index 10a5390..b31e80f 100644
--- a/gentoopm/pkgcorepm/__init__.py
+++ b/gentoopm/pkgcorepm/__init__.py
@@ -20,11 +20,13 @@ class PkgCorePM(PackageManager):
 
 	@property
 	def repositories(self):
-		return PkgCoreRepoDict(self._domain.named_repos['repo-stack'])
+		return PkgCoreRepoDict(self._domain.named_repos['repo-stack'],
+				self._domain)
 
 	@property
 	def installed(self):
-		return PkgCoreInstalledRepo(self._domain.named_repos['vdb'])
+		return PkgCoreInstalledRepo(self._domain.named_repos['vdb'],
+				self._domain)
 
 	@property
 	def Atom(self):

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index 095d89e..c11b01e 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -17,15 +17,17 @@ from gentoopm.util import FillMissingComparisons
 class PkgCoreRepoDict(PMRepositoryDict):
 	def __iter__(self):
 		for i, r in enumerate(self._stack.trees):
-			yield PkgCoreEbuildRepo(r, i)
+			yield PkgCoreEbuildRepo(r, self._domain, i)
 
-	def __init__(self, stack):
+	def __init__(self, stack, domain):
 		self._stack = stack
+		self._domain = domain
 
 class PkgCoreRepository(PkgCorePackageSet, PMRepository):
 	_index = 0
-	def __init__(self, repo_obj):
-		self._repo = repo_obj
+	def __init__(self, repo_obj, domain):
+		self._repo = repo_obj.configure(repo_obj, domain,
+				domain.settings)
 
 	@abstractproperty
 	def _pkg_class(self):
@@ -79,8 +81,8 @@ class PkgCoreEbuildRepo(PkgCoreRepository, PMEbuildRepository,
 
 	_pkg_class = PkgCoreInstallablePackage
 
-	def __init__(self, repo_obj, index):
-		PkgCoreRepository.__init__(self, repo_obj)
+	def __init__(self, repo_obj, domain, index):
+		PkgCoreRepository.__init__(self, repo_obj, domain)
 		self._index = index
 
 	@property



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-25 19:06 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-25 19:06 UTC (permalink / raw
  To: gentoo-commits

commit:     bfdcf993f4fb3cbaf8acd4a779b0404ca96cadc7
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 25 19:07:30 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Jul 25 19:07:30 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=bfdcf993

pkgcore: support getting deps.

---
 gentoopm/pkgcorepm/depend.py |   39 +++++++++++++++++++++++++++++++++++++++
 gentoopm/pkgcorepm/pkg.py    |   16 ++++++++++++++++
 2 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/gentoopm/pkgcorepm/depend.py b/gentoopm/pkgcorepm/depend.py
new file mode 100644
index 0000000..80d697b
--- /dev/null
+++ b/gentoopm/pkgcorepm/depend.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+#	vim:fileencoding=utf-8
+# (c) 2011 Michał Górny <mgorny@gentoo.org>
+# Released under the terms of the 2-clause BSD license.
+
+from pkgcore.ebuild.atom import atom
+from pkgcore.restrictions.boolean import OrRestriction
+
+from gentoopm.basepm.depend import PMPackageDepSet, PMPackageFinalDepSet
+from gentoopm.pkgcorepm.atom import PkgCoreAtom
+
+class PkgCorePackageDepSet(PMPackageDepSet):
+	def __init__(self, deps, pkg):
+		self._deps = deps
+		self._pkg = pkg
+
+	@property
+	def evaluated(self):
+		return PkgCorePackageFinalDepSet(
+				self._deps.evaluate_depset(self._pkg.use))
+
+class PkgCorePackageFinalDepSet(PMPackageFinalDepSet):
+	def __init__(self, deps):
+		self._deps = deps
+
+	def _iter_deps(self, deps):
+		for d in deps:
+			if isinstance(d, atom):
+				yield d
+			elif isinstance(d, OrRestriction):
+				for d in self._iter_deps((next(iter(d)),)): # XXX
+					yield d
+			else:
+				raise NotImplementedError('Parsing %s not implemented' \
+						% repr(d))
+
+	def __iter__(self):
+		for d in self._iter_deps(self._deps):
+			yield PkgCoreAtom(d)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index dff02ed..d50d0fe 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -10,6 +10,7 @@ from gentoopm.basepm.pkg import PMPackage, PMPackageDescription, \
 from gentoopm.basepm.pkgset import PMPackageSet, PMFilteredPackageSet
 from gentoopm.pkgcorepm.atom import PkgCoreAtom, PkgCorePackageKey
 from gentoopm.pkgcorepm.contents import PkgCorePackageContents
+from gentoopm.pkgcorepm.depend import PkgCorePackageDepSet
 from gentoopm.util import SpaceSepTuple
 
 class PkgCorePackageSet(PMPackageSet):
@@ -85,6 +86,21 @@ class PkgCorePackage(PMPackage, PkgCoreAtom):
 	def repository(self):
 		return self._pkg.repo.repo_id
 
+	@property
+	def build_dependencies(self):
+		return PkgCorePackageDepSet(self._pkg.depends,
+				self._pkg)
+
+	@property
+	def run_dependencies(self):
+		return PkgCorePackageDepSet(self._pkg.rdepends,
+				self._pkg)
+
+	@property
+	def post_dependencies(self):
+		return PkgCorePackageDepSet(self._pkg.pdepends,
+				self._pkg)
+
 	def __str__(self):
 		if self._repo_index != 0:
 			s = '%s::%s' % (self._pkg.cpvstr, self._pkg.repo.repo_id)



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-26  7:24 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-26  7:24 UTC (permalink / raw
  To: gentoo-commits

commit:     38f9d3fda6203bf31a2fb5e12fcc7cfc3c840a71
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 26 07:24:37 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 07:24:37 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=38f9d3fd

pkgcore: support dropping conditionals using evaluate_depset().

---
 gentoopm/pkgcorepm/depend.py |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/gentoopm/pkgcorepm/depend.py b/gentoopm/pkgcorepm/depend.py
index 5c38500..eaa6333 100644
--- a/gentoopm/pkgcorepm/depend.py
+++ b/gentoopm/pkgcorepm/depend.py
@@ -37,4 +37,31 @@ class PkgCoreConditionalUseDep(PMConditionalDep, PkgCoreBaseDep):
 		return self._deps.restriction.match(self._pkg.use)
 
 class PkgCorePackageDepSet(PMPackageDepSet, PkgCoreBaseDep):
+	@property
+	def without_conditionals(self):
+		return PkgCoreUncondPackageDepSet(
+				self._deps.evaluate_depset(self._pkg.use))
+
+class PkgCoreUncondDep(PkgCoreBaseDep):
+	def __init__(self, deps):
+		self._deps = deps
+
+	@property
+	def without_conditionals(self):
+		return self
+
+	def __iter__(self):
+		for d in self._deps:
+			if isinstance(d, atom):
+				yield PkgCoreAtom(d)
+			elif isinstance(d, OrRestriction):
+				yield PkgCoreUncondOneOfDep(d)
+			else:
+				raise NotImplementedError('Parsing %s not implemented' \
+						% repr(d))
+
+class PkgCoreUncondOneOfDep(PMOneOfDep, PkgCoreUncondDep):
+	pass
+
+class PkgCoreUncondPackageDepSet(PkgCoreUncondDep):
 	pass



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-26 16:36 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-26 16:36 UTC (permalink / raw
  To: gentoo-commits

commit:     e4b6fd0a47a987c996cd97c7d2fb3031bdb9a261
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 26 16:12:10 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 16:12:10 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=e4b6fd0a

pkgcore: fix getting dependencies of installed packages.

---
 gentoopm/pkgcorepm/pkg.py |   45 ++++++++++++++++++++++++++++++---------------
 1 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index d586349..d49dc51 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -86,21 +86,6 @@ class PkgCorePackage(PMPackage, PkgCoreAtom):
 	def repository(self):
 		return self._pkg.repo.repo_id
 
-	@property
-	def build_dependencies(self):
-		return PkgCorePackageDepSet(self._pkg._raw_pkg.depends,
-				self._pkg)
-
-	@property
-	def run_dependencies(self):
-		return PkgCorePackageDepSet(self._pkg._raw_pkg.rdepends,
-				self._pkg)
-
-	@property
-	def post_dependencies(self):
-		return PkgCorePackageDepSet(self._pkg._raw_pkg.pdepends,
-				self._pkg)
-
 	def __str__(self):
 		if self._repo_index != 0:
 			s = '%s::%s' % (self._pkg.cpvstr, self._pkg.repo.repo_id)
@@ -118,6 +103,21 @@ class PkgCoreInstallablePackage(PkgCorePackage, PMInstallablePackage):
 
 		return SpaceSepTuple(l)
 
+	@property
+	def build_dependencies(self):
+		return PkgCorePackageDepSet(self._pkg._raw_pkg.depends,
+				self._pkg)
+
+	@property
+	def run_dependencies(self):
+		return PkgCorePackageDepSet(self._pkg._raw_pkg.rdepends,
+				self._pkg)
+
+	@property
+	def post_dependencies(self):
+		return PkgCorePackageDepSet(self._pkg._raw_pkg.pdepends,
+				self._pkg)
+
 	def __lt__(self, other):
 		if not isinstance(other, PkgCorePackage):
 			raise TypeError('Unable to compare %s against %s' % \
@@ -136,6 +136,21 @@ class PkgCoreInstalledPackage(PkgCorePackage, PMInstalledPackage):
 		return SpaceSepTuple(l)
 
 	@property
+	def build_dependencies(self):
+		return PkgCorePackageDepSet(self._pkg.depends,
+				self._pkg)
+
+	@property
+	def run_dependencies(self):
+		return PkgCorePackageDepSet(self._pkg.rdepends,
+				self._pkg)
+
+	@property
+	def post_dependencies(self):
+		return PkgCorePackageDepSet(self._pkg.pdepends,
+				self._pkg)
+
+	@property
 	def contents(self):
 		return PkgCorePackageContents(self._pkg.contents)
 



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-07-27 20:45 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-07-27 20:45 UTC (permalink / raw
  To: gentoo-commits

commit:     b65cc5e8c3382e6a67599f111a29d399b1adc853
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 27 20:46:20 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jul 27 20:46:20 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=b65cc5e8

pkgcore: fix getting PDEPEND.

---
 gentoopm/pkgcorepm/pkg.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gentoopm/pkgcorepm/pkg.py b/gentoopm/pkgcorepm/pkg.py
index d64d873..3f5af2d 100644
--- a/gentoopm/pkgcorepm/pkg.py
+++ b/gentoopm/pkgcorepm/pkg.py
@@ -130,7 +130,7 @@ class PkgCoreInstallablePackage(PkgCorePackage, PMInstallablePackage):
 
 	@property
 	def post_dependencies(self):
-		return PkgCorePackageDepSet(self._pkg._raw_pkg.pdepends,
+		return PkgCorePackageDepSet(self._pkg._raw_pkg.post_rdepends,
 				self._pkg)
 
 	def __lt__(self, other):



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-08-13 18:49 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-08-13 18:49 UTC (permalink / raw
  To: gentoo-commits

commit:     f4459dc1178d9861c3c6d4e09b0aff258423e5dc
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 13 18:42:52 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 13 18:42:52 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=f4459dc1

pkgcore: omit virtual packages.

---
 gentoopm/pkgcorepm/repo.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index 61ae0d6..85434b8 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -37,7 +37,8 @@ class PkgCoreRepository(PkgCorePackageSet, PMRepository):
 	def __iter__(self):
 		index = self._index
 		for pkg in self._repo:
-			yield self._pkg_class(pkg, index)
+			if pkg.package_is_real:
+				yield self._pkg_class(pkg, index)
 
 	def filter(self, *args, **kwargs):
 		r = self
@@ -63,7 +64,8 @@ class PkgCoreFilteredRepo(PkgCoreRepository):
 	def __iter__(self):
 		index = self._index
 		for pkg in self._repo._repo.match(self._filt):
-			yield self._pkg_class(pkg, index)
+			if pkg.package_is_real:
+				yield self._pkg_class(pkg, index)
 
 	def filter(self, *args, **kwargs):
 		r = self



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-11-14 21:44 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-11-14 21:44 UTC (permalink / raw
  To: gentoo-commits

commit:     e8b4340507e5e0b575583a72e0f38ca4e2a84b6b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 14 20:21:57 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Nov 14 20:21:57 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=e8b43405

Move repo-stack getting directly to pkgcorepm.repo.

---
 gentoopm/pkgcorepm/__init__.py |    3 +--
 gentoopm/pkgcorepm/repo.py     |    5 ++---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/gentoopm/pkgcorepm/__init__.py b/gentoopm/pkgcorepm/__init__.py
index 53afaaf..aa117a0 100644
--- a/gentoopm/pkgcorepm/__init__.py
+++ b/gentoopm/pkgcorepm/__init__.py
@@ -25,8 +25,7 @@ class PkgCorePM(PackageManager):
 
 	@property
 	def repositories(self):
-		return PkgCoreRepoDict(self._domain.named_repos['repo-stack'],
-				self._domain)
+		return PkgCoreRepoDict(self._domain)
 
 	@property
 	def root(self):

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index 85434b8..b082420 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -17,11 +17,10 @@ from .filter import transform_filters
 
 class PkgCoreRepoDict(PMRepositoryDict):
 	def __iter__(self):
-		for i, r in enumerate(self._stack.trees):
+		for i, r in enumerate(self._domain.named_repos['repo-stack'].trees):
 			yield PkgCoreEbuildRepo(r, self._domain, i)
 
-	def __init__(self, stack, domain):
-		self._stack = stack
+	def __init__(self, domain):
 		self._domain = domain
 
 class PkgCoreRepository(PkgCorePackageSet, PMRepository):



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-11-14 21:44 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-11-14 21:44 UTC (permalink / raw
  To: gentoo-commits

commit:     96b56b5336cff67e48d94125d47471920b3742c4
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 14 21:40:31 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Nov 14 21:40:31 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=96b56b53

Support pkgcore-0.7.5+.

---
 gentoopm/pkgcorepm/repo.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index b082420..13aa1c0 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -6,6 +6,7 @@
 from abc import abstractproperty
 
 import pkgcore.restrictions.boolean as br
+from pkgcore.ebuild.repository import UnconfiguredTree
 
 from ..basepm.repo import PMRepository, PMRepositoryDict, \
 		PMEbuildRepository
@@ -17,7 +18,16 @@ from .filter import transform_filters
 
 class PkgCoreRepoDict(PMRepositoryDict):
 	def __iter__(self):
-		for i, r in enumerate(self._domain.named_repos['repo-stack'].trees):
+		try:
+			trees = self._domain.named_repos['repo-stack'].trees
+		except KeyError: # pkgcore-0.7.5+
+			def _match_ebuild_repos(x):
+				return isinstance(x, UnconfiguredTree)
+
+			trees = filter(_match_ebuild_repos,
+					self._domain.named_repos.values())
+
+		for i, r in enumerate(trees):
 			yield PkgCoreEbuildRepo(r, self._domain, i)
 
 	def __init__(self, domain):



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2011-11-14 22:12 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2011-11-14 22:12 UTC (permalink / raw
  To: gentoo-commits

commit:     9c5daa42afecdbf3e47deca671c820b38dcca14a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 14 22:12:51 2011 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Nov 14 22:12:51 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=9c5daa42

pkgcore: fix package sorting with 0.7.5+.

---
 gentoopm/pkgcorepm/repo.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index 13aa1c0..dc43148 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -26,9 +26,12 @@ class PkgCoreRepoDict(PMRepositoryDict):
 
 			trees = filter(_match_ebuild_repos,
 					self._domain.named_repos.values())
+			rev = -1
+		else:
+			rev = 1
 
 		for i, r in enumerate(trees):
-			yield PkgCoreEbuildRepo(r, self._domain, i)
+			yield PkgCoreEbuildRepo(r, self._domain, rev * i)
 
 	def __init__(self, domain):
 		self._domain = domain



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

* [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
@ 2012-10-14 21:35 Michał Górny
  0 siblings, 0 replies; 25+ messages in thread
From: Michał Górny @ 2012-10-14 21:35 UTC (permalink / raw
  To: gentoo-commits

commit:     f58c5799b4bd26cb6485f8ceb796f07a79cac0ee
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 14 21:33:46 2012 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Oct 14 21:33:46 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/gentoopm.git;a=commit;h=f58c5799

Fix compatibility with pkgcore-0.8.4 API.

---
 gentoopm/pkgcorepm/__init__.py |    8 ++++++--
 gentoopm/pkgcorepm/repo.py     |   10 +++++++---
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/gentoopm/pkgcorepm/__init__.py b/gentoopm/pkgcorepm/__init__.py
index aa117a0..27d980d 100644
--- a/gentoopm/pkgcorepm/__init__.py
+++ b/gentoopm/pkgcorepm/__init__.py
@@ -33,8 +33,12 @@ class PkgCorePM(PackageManager):
 
 	@property
 	def installed(self):
-		return PkgCoreInstalledRepo(self._domain.named_repos['vdb'],
-				self._domain)
+		try:
+			repos = self._domain.repos_raw
+		except AttributeError:
+			repos = self._domain.named_repos
+
+		return PkgCoreInstalledRepo(repos['vdb'], self._domain)
 
 	@property
 	def Atom(self):

diff --git a/gentoopm/pkgcorepm/repo.py b/gentoopm/pkgcorepm/repo.py
index dc43148..44bd745 100644
--- a/gentoopm/pkgcorepm/repo.py
+++ b/gentoopm/pkgcorepm/repo.py
@@ -20,12 +20,16 @@ class PkgCoreRepoDict(PMRepositoryDict):
 	def __iter__(self):
 		try:
 			trees = self._domain.named_repos['repo-stack'].trees
-		except KeyError: # pkgcore-0.7.5+
+		except (KeyError, AttributeError): # pkgcore-0.7.5+
 			def _match_ebuild_repos(x):
 				return isinstance(x, UnconfiguredTree)
 
-			trees = filter(_match_ebuild_repos,
-					self._domain.named_repos.values())
+			try:
+				all_repos = self._domain.repos_raw
+			except AttributeError:
+				all_repos = self._domain.named_repos
+
+			trees = filter(_match_ebuild_repos, all_repos.values())
 			rev = -1
 		else:
 			rev = 1


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

end of thread, other threads:[~2012-10-14 21:35 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-06 20:54 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/ Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2011-07-07  9:51 Michał Górny
2011-07-08  7:18 Michał Górny
2011-07-09  7:15 Michał Górny
2011-07-09  7:15 Michał Górny
2011-07-09  7:15 Michał Górny
2011-07-10 22:17 Michał Górny
2011-07-12  9:14 Michał Górny
2011-07-13 17:05 Michał Górny
2011-07-13 17:16 Michał Górny
2011-07-14 13:31 Michał Górny
2011-07-15 12:34 Michał Górny
2011-07-15 13:32 Michał Górny
2011-07-21  8:47 Michał Górny
2011-07-21  8:47 Michał Górny
2011-07-25 19:06 Michał Górny
2011-07-25 19:06 Michał Górny
2011-07-26  7:24 Michał Górny
2011-07-26 16:36 Michał Górny
2011-07-27 20:45 Michał Górny
2011-08-13 18:49 Michał Górny
2011-11-14 21:44 Michał Górny
2011-11-14 21:44 Michał Górny
2011-11-14 22:12 Michał Górny
2012-10-14 21:35 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