From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 995921381F3 for ; Tue, 27 Nov 2012 06:03:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E9DA2E0684; Tue, 27 Nov 2012 06:02:53 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 5A94FE067D for ; Tue, 27 Nov 2012 06:02:53 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3C1A533D9A9 for ; Tue, 27 Nov 2012 06:02:52 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 653F6E5436 for ; Tue, 27 Nov 2012 06:02:50 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1353996158.bdaca74c12d592d9b955e7009539f1b598497ec2.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/Package.py pym/_emerge/depgraph.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: bdaca74c12d592d9b955e7009539f1b598497ec2 X-VCS-Branch: master Date: Tue, 27 Nov 2012 06:02:50 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: cb738945-3180-4cdc-bbd0-8bb6b96766f9 X-Archives-Hash: 471353195a57185d8df755a62ef9fd48 commit: bdaca74c12d592d9b955e7009539f1b598497ec2 Author: Zac Medico gentoo org> AuthorDate: Tue Nov 27 06:02:38 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Tue Nov 27 06:02:38 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=bdaca74c Add Package.built_time property. --- pym/_emerge/Package.py | 9 +++++++++ pym/_emerge/depgraph.py | 25 ++++++++----------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 602fea8..86ed5f7 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -109,6 +109,15 @@ class Package(Task): return self._metadata["EAPI"] @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 + + @property def defined_phases(self): return self._metadata.defined_phases diff --git a/pym/_emerge/depgraph.py b/pym/_emerge/depgraph.py index 702f7fe..f5fe435 100644 --- a/pym/_emerge/depgraph.py +++ b/pym/_emerge/depgraph.py @@ -269,13 +269,12 @@ class _rebuild_config(object): return True elif (parent.installed and root_slot not in self.reinstall_list): - inst_build_time = parent._metadata.get("BUILD_TIME") try: bin_build_time, = bindb.aux_get(parent.cpv, ["BUILD_TIME"]) except KeyError: continue - if bin_build_time != inst_build_time: + if bin_build_time != _unicode(parent.build_time): # 2) Remote binary package is valid, and local package # is not up to date. Force reinstall. reinstall = True @@ -593,8 +592,7 @@ class depgraph(object): if selected_pkg.installed and \ selected_pkg.cpv == pkg.cpv and \ - selected_pkg._metadata.get('BUILD_TIME') == \ - pkg._metadata.get('BUILD_TIME'): + selected_pkg.build_time == pkg.build_time: # We don't care about ignored binaries when an # identical installed instance is selected to # fill the slot. @@ -3886,7 +3884,7 @@ class depgraph(object): return True def _equiv_binary_installed(self, pkg): - build_time = pkg._metadata.get('BUILD_TIME') + build_time = pkg.build_time if not build_time: return False @@ -3896,7 +3894,7 @@ class depgraph(object): except PackageNotFound: return False - return build_time == inst_pkg._metadata.get('BUILD_TIME') + return build_time == inst_pkg.build_time class _AutounmaskLevel(object): __slots__ = ("allow_use_changes", "allow_unstable_keywords", "allow_license_changes", \ @@ -4317,8 +4315,8 @@ class depgraph(object): for selected_pkg in matched_packages: if selected_pkg.type_name == "binary" and \ selected_pkg.cpv == pkg.cpv and \ - selected_pkg._metadata.get('BUILD_TIME') == \ - pkg._metadata.get('BUILD_TIME'): + selected_pkg.build_time == \ + pkg.build_time: identical_binary = True break @@ -4551,15 +4549,8 @@ class depgraph(object): # non-empty, in order to avoid cases like to # bug #306659 where BUILD_TIME fields are missing # in local and/or remote Packages file. - try: - built_timestamp = int(built_pkg._metadata['BUILD_TIME']) - except (KeyError, ValueError): - built_timestamp = 0 - - try: - installed_timestamp = int(inst_pkg._metadata['BUILD_TIME']) - except (KeyError, ValueError): - installed_timestamp = 0 + built_timestamp = built_pkg.build_time + installed_timestamp = inst_pkg.build_time if unbuilt_pkg is not None and unbuilt_pkg > built_pkg: pass