aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2015-02-17 14:56:47 -0800
committerZac Medico <zmedico@gentoo.org>2015-03-04 13:32:07 -0800
commit34055adae6bd90fc64f18421e2cec5f8da6f7c33 (patch)
treeb7f20aee368696ff77d064d794f03cbb230982be /pym/portage/dbapi
parentsetup.py: Set version for new release (diff)
downloadportage-34055adae6bd90fc64f18421e2cec5f8da6f7c33.tar.gz
portage-34055adae6bd90fc64f18421e2cec5f8da6f7c33.tar.bz2
portage-34055adae6bd90fc64f18421e2cec5f8da6f7c33.zip
binpkg-multi-instance 1 of 7
Extend the _pkg_str class with build_id, build_time, file_size, and mtime attributes. These will be used to distinguish binary package instances that have the same cpv. Package sorting accounts for build_time, which will be used to prefer newer builds over older builds when their versions are identical.
Diffstat (limited to 'pym/portage/dbapi')
-rw-r--r--pym/portage/dbapi/__init__.py10
-rw-r--r--pym/portage/dbapi/vartree.py8
2 files changed, 14 insertions, 4 deletions
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index 34dfaa760..044faec4e 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -31,7 +31,8 @@ class dbapi(object):
_use_mutable = False
_known_keys = frozenset(x for x in auxdbkeys
if not x.startswith("UNUSED_0"))
- _pkg_str_aux_keys = ("EAPI", "KEYWORDS", "SLOT", "repository")
+ _pkg_str_aux_keys = ("BUILD_TIME", "EAPI", "BUILD_ID",
+ "KEYWORDS", "SLOT", "repository")
def __init__(self):
pass
@@ -57,7 +58,12 @@ class dbapi(object):
@staticmethod
def _cmp_cpv(cpv1, cpv2):
- return vercmp(cpv1.version, cpv2.version)
+ result = vercmp(cpv1.version, cpv2.version)
+ if (result == 0 and cpv1.build_time is not None and
+ cpv2.build_time is not None):
+ result = ((cpv1.build_time > cpv2.build_time) -
+ (cpv1.build_time < cpv2.build_time))
+ return result
@staticmethod
def _cpv_sort_ascending(cpv_list):
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index cf31c8e9c..277c2f188 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -173,7 +173,8 @@ class vardbapi(dbapi):
self.vartree = vartree
self._aux_cache_keys = set(
["BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "DESCRIPTION",
- "EAPI", "HDEPEND", "HOMEPAGE", "IUSE", "KEYWORDS",
+ "EAPI", "HDEPEND", "HOMEPAGE",
+ "BUILD_ID", "IUSE", "KEYWORDS",
"LICENSE", "PDEPEND", "PROPERTIES", "PROVIDE", "RDEPEND",
"repository", "RESTRICT" , "SLOT", "USE", "DEFINED_PHASES",
"PROVIDES", "REQUIRES"
@@ -425,7 +426,10 @@ class vardbapi(dbapi):
continue
if len(mysplit) > 1:
if ps[0] == mysplit[1]:
- returnme.append(_pkg_str(mysplit[0]+"/"+x))
+ cpv = "%s/%s" % (mysplit[0], x)
+ metadata = dict(zip(self._aux_cache_keys,
+ self.aux_get(cpv, self._aux_cache_keys)))
+ returnme.append(_pkg_str(cpv, metadata=metadata))
self._cpv_sort_ascending(returnme)
if use_cache:
self.cpcache[mycp] = [mystat, returnme[:]]