From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RGdY1-0008Ol-6e for garchives@archives.gentoo.org; Wed, 19 Oct 2011 21:19:37 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4EF5821C0AD; Wed, 19 Oct 2011 21:19:30 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1A9E221C0AD for ; Wed, 19 Oct 2011 21:19:30 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 952741B400D for ; Wed, 19 Oct 2011 21:19:29 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 0D1DE80042 for ; Wed, 19 Oct 2011 21:19:29 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/bintree.py X-VCS-Directories: pym/portage/dbapi/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: de807d14fb994535f1ea529ecef8de0ee9db4136 Date: Wed, 19 Oct 2011 21:19:29 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: bf56ed603302588cee770217edd6d8c8 commit: de807d14fb994535f1ea529ecef8de0ee9db4136 Author: Zac Medico gentoo org> AuthorDate: Wed Oct 19 21:19:09 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Oct 19 21:19:09 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dde807d14 Add bindbapi.getfetchsizes() like pordbapi has. --- pym/portage/dbapi/bintree.py | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 62fc623..5c091bd 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -177,6 +177,34 @@ class bindbapi(fakedbapi): self.bintree.populate() return fakedbapi.cpv_all(self) =20 + def getfetchsizes(self, pkg): + """ + This will raise MissingSignature if SIZE signature is not available, + or InvalidSignature if SIZE signature is invalid. + """ + + if not self.bintree.populated: + self.bintree.populate() + + pkg =3D getattr(pkg, 'cpv', pkg) + + filesdict =3D {} + if not self.bintree.isremote(pkg): + pass + else: + metadata =3D self.bintree._remotepkgs[pkg] + try: + size =3D int(metadata["SIZE"]) + except KeyError: + raise portage.exception.MissingSignature("SIZE") + except ValueError: + raise portage.exception.InvalidSignature( + "SIZE: %s" % metadata["SIZE"]) + else: + filesdict[os.path.basename(self.bintree.getname(pkg))] =3D size + + return filesdict + def _pkgindex_cpv_map_latest_build(pkgindex): """ Given a PackageIndex instance, create a dict of cpv -> metadata map.