Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Unified Diff: pym/portage/dbapi/bintree.py

Issue 6458015: Add support for grabbing Packages files using external programs. (Closed) Base URL: http://git.chromium.org/git/portage_tool.git@cros-2.1.9
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pym/portage/getbinpkg.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pym/portage/dbapi/bintree.py
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 8c2ba8d1baf064eea4f1fb3c9e29d76b2089d489..41d1f8613f4e14a70cb7707e84492fb52b5a021e 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -772,8 +772,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 = base_url.rstrip("/") + "/Packages"
try:
- f = urllib_request_urlopen(base_url.rstrip("/") + "/Packages")
+ f = urllib_request_urlopen(url)
except IOError:
path = parsed_url.path.rstrip("/") + "/Packages"
@@ -798,7 +799,18 @@ class binarytree(object):
stdout=subprocess.PIPE)
f = proc.stdout
else:
- raise
+ setting = 'FETCHCOMMAND_' + parsed_url.scheme.upper()
+ fcmd = self.settings.get(setting)
+ if not fcmd:
+ raise
+ fd, tmp_filename = tempfile.mkstemp()
+ tmp_dirname, tmp_basename = os.path.split(tmp_filename)
+ os.close(fd)
+ success = portage.getbinpkg.file_get(url,
+ tmp_dirname, fcmd=fcmd, filename=tmp_basename)
+ if not success:
+ raise portage.exception.FileNotFound(url)
+ f = open(tmp_filename, 'rb')
f_dec = codecs.iterdecode(f,
_encodings['repo.content'], errors='replace')
« no previous file with comments | « no previous file | pym/portage/getbinpkg.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698