From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/
Date: Wed, 6 Jul 2011 20:54:18 +0000 (UTC) [thread overview]
Message-ID: <2b23035543335ca792f9bc92be9db97ccda3a3a3.mgorny@gentoo> (raw)
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):
next reply other threads:[~2011-07-06 20:54 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-06 20:54 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2011-07-07 9:51 [gentoo-commits] proj/gentoopm:master commit in: gentoopm/pkgcorepm/ 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
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=2b23035543335ca792f9bc92be9db97ccda3a3a3.mgorny@gentoo \
--to=mgorny@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