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 1Popdt-0004Hz-3U for garchives@archives.gentoo.org; Mon, 14 Feb 2011 04:02:29 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 82854E090F; Mon, 14 Feb 2011 04:02:20 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 3EEEEE0977 for ; Mon, 14 Feb 2011 04:02:20 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A9F371B40D9 for ; Mon, 14 Feb 2011 04:02:19 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id D7C808006A for ; Mon, 14 Feb 2011 04:02:18 +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: <53f096c5d72dd15336fdf921f29ceae9b5842148.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dbapi/, pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/bintree.py pym/portage/getbinpkg.py X-VCS-Directories: pym/portage/dbapi/ pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 53f096c5d72dd15336fdf921f29ceae9b5842148 Date: Mon, 14 Feb 2011 04:02:18 +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: e89b450246935750f940548e0357e7ac commit: 53f096c5d72dd15336fdf921f29ceae9b5842148 Author: David James google com> AuthorDate: Fri Feb 11 17:25:26 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Feb 14 03:51:39 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D53f096c5 Add support for grabbing Packages files using external programs. If the user specifies FETCHCOMMAND_*, Portage should honor this when grab= bing Packages files. This allows users to setup support for grabbing Packages = files from other protocols. BUG=3Dchrome-os-partner:2026 TEST=3DTry downloading prebuilts from gs:// when FETCHCOMMAND_GS is setup= in make.conf Change-Id: I96b239819351633dd02d608954e81a1c363a4687 Review URL: http://codereview.chromium.org/6458015 --- pym/portage/dbapi/bintree.py | 16 ++++++++++++++-- pym/portage/getbinpkg.py | 6 ++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 993df77..78eb429 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -770,8 +770,9 @@ class binarytree(object): # urlparse.urljoin() only works correctly with recognized # protocols and requires the base url to have a trailing # slash, so join manually... + url =3D base_url.rstrip("/") + "/Packages" try: - f =3D urllib_request_urlopen(base_url.rstrip("/") + "/Packages") + f =3D urllib_request_urlopen(url) except IOError: path =3D parsed_url.path.rstrip("/") + "/Packages" =20 @@ -796,7 +797,18 @@ class binarytree(object): stdout=3Dsubprocess.PIPE) f =3D proc.stdout else: - raise + setting =3D 'FETCHCOMMAND_' + parsed_url.scheme.upper() + fcmd =3D self.settings.get(setting) + if not fcmd: + raise + fd, tmp_filename =3D tempfile.mkstemp() + tmp_dirname, tmp_basename =3D os.path.split(tmp_filename) + os.close(fd) + success =3D portage.getbinpkg.file_get(url, + tmp_dirname, fcmd=3Dfcmd, filename=3Dtmp_basename) + if not success: + raise portage.exception.FileNotFound(url) + f =3D open(tmp_filename, 'rb') =20 f_dec =3D codecs.iterdecode(f, _encodings['repo.content'], errors=3D'replace') diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index f85b65c..43a6bf5 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -431,17 +431,19 @@ def file_get_metadata(baseurl,conn=3DNone, chunk_si= ze=3D3000): return myid =20 =20 -def file_get(baseurl,dest,conn=3DNone,fcmd=3DNone): +def file_get(baseurl,dest,conn=3DNone,fcmd=3DNone,filename=3DNone): """(baseurl,dest,fcmd=3D) -- Takes a base url to connect to and read fr= om. URI should be in the form ://[user[:pass]@][:port]""= " =20 if not fcmd: return file_get_lib(baseurl,dest,conn) + if not filename: + filename =3D os.path.basename(baseurl) =20 variables =3D { "DISTDIR": dest, "URI": baseurl, - "FILE": os.path.basename(baseurl) + "FILE": filename } =20 from portage.util import varexpand