diff options
Diffstat (limited to 'pym/_emerge/Package.py')
-rw-r--r-- | pym/_emerge/Package.py | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index e8a13cbd8..975335db2 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -41,12 +41,12 @@ class Package(Task): "_validated_atoms", "_visible") metadata_keys = [ - "BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "EAPI", - "HDEPEND", "INHERITED", "IUSE", "KEYWORDS", - "LICENSE", "PDEPEND", "PROVIDE", "RDEPEND", - "repository", "PROPERTIES", "RESTRICT", "SLOT", "USE", - "_mtime_", "DEFINED_PHASES", "REQUIRED_USE", "PROVIDES", - "REQUIRES"] + "BUILD_ID", "BUILD_TIME", "CHOST", "COUNTER", "DEFINED_PHASES", + "DEPEND", "EAPI", "HDEPEND", "INHERITED", "IUSE", "KEYWORDS", + "LICENSE", "MD5", "PDEPEND", "PROVIDE", "PROVIDES", + "RDEPEND", "repository", "REQUIRED_USE", + "PROPERTIES", "REQUIRES", "RESTRICT", "SIZE", + "SLOT", "USE", "_mtime_"] _dep_keys = ('DEPEND', 'HDEPEND', 'PDEPEND', 'RDEPEND') _buildtime_keys = ('DEPEND', 'HDEPEND') @@ -114,13 +114,14 @@ class Package(Task): return self._metadata["EAPI"] @property + def build_id(self): + return self.cpv.build_id + + @property def build_time(self): if not self.built: raise AttributeError('build_time') - try: - return long(self._metadata['BUILD_TIME']) - except (KeyError, ValueError): - return 0 + return self.cpv.build_time @property def defined_phases(self): @@ -509,9 +510,15 @@ class Package(Task): else: cpv_color = "PKG_NOMERGE" + build_id_str = "" + if isinstance(self.cpv.build_id, long) and self.cpv.build_id > 0: + build_id_str = "-%s" % self.cpv.build_id + s = "(%s, %s" \ - % (portage.output.colorize(cpv_color, self.cpv + _slot_separator + \ - self.slot + "/" + self.sub_slot + _repo_separator + self.repo) , self.type_name) + % (portage.output.colorize(cpv_color, self.cpv + + build_id_str + _slot_separator + self.slot + "/" + + self.sub_slot + _repo_separator + self.repo), + self.type_name) if self.type_name == "installed": if self.root_config.settings['ROOT'] != "/": @@ -755,29 +762,41 @@ class Package(Task): def __lt__(self, other): if other.cp != self.cp: return self.cp < other.cp - if portage.vercmp(self.version, other.version) < 0: + result = portage.vercmp(self.version, other.version) + if result < 0: return True + if result == 0 and self.built and other.built: + return self.build_time < other.build_time return False def __le__(self, other): if other.cp != self.cp: return self.cp <= other.cp - if portage.vercmp(self.version, other.version) <= 0: + result = portage.vercmp(self.version, other.version) + if result <= 0: return True + if result == 0 and self.built and other.built: + return self.build_time <= other.build_time return False def __gt__(self, other): if other.cp != self.cp: return self.cp > other.cp - if portage.vercmp(self.version, other.version) > 0: + result = portage.vercmp(self.version, other.version) + if result > 0: return True + if result == 0 and self.built and other.built: + return self.build_time > other.build_time return False def __ge__(self, other): if other.cp != self.cp: return self.cp >= other.cp - if portage.vercmp(self.version, other.version) >= 0: + result = portage.vercmp(self.version, other.version) + if result >= 0: return True + if result == 0 and self.built and other.built: + return self.build_time >= other.build_time return False def with_use(self, use): |