summaryrefslogtreecommitdiffstats
path: root/pym/portage/getbinpkg.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-27 01:11:10 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-27 01:11:10 +0000
commita5adf03304d80696fb701e2373f13876bf9a50f8 (patch)
tree05604159d8f40d66eab9a33debc3857d84b9e2a4 /pym/portage/getbinpkg.py
parentcafccdb0da311f40d08541e3d3ad5945cf36ec3d (diff)
downloadportage-a5adf03304d80696fb701e2373f13876bf9a50f8.tar.gz
portage-a5adf03304d80696fb701e2373f13876bf9a50f8.tar.bz2
portage-a5adf03304d80696fb701e2373f13876bf9a50f8.zip
Bug #200231 - Make dir_get_metadata() handle an exception thrown
from dir_get_list() when there's a problem connection problem. svn path=/main/trunk/; revision=8702
Diffstat (limited to 'pym/portage/getbinpkg.py')
-rw-r--r--pym/portage/getbinpkg.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py
index 87f205528..d2d1f75ab 100644
--- a/pym/portage/getbinpkg.py
+++ b/pym/portage/getbinpkg.py
@@ -307,7 +307,9 @@ def dir_get_list(baseurl,conn=None):
del page
listing = parser.get_anchors()
else:
- raise Exception, "Unable to get listing: %s %s" % (rc,msg)
+ import portage.exception
+ raise portage.exception.PortageException(
+ "Unable to get listing: %s %s" % (rc,msg))
elif protocol in ["ftp"]:
if address[-1] == '/':
olddir = conn.pwd()
@@ -486,7 +488,14 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache=
sys.stderr.write("!!! Permission denied: '%s'\n" % cache_path)
return metadata[baseurl]["data"]
- filelist = dir_get_list(baseurl, conn)
+ import portage.exception
+ try:
+ filelist = dir_get_list(baseurl, conn)
+ except portage.exception.PortageException, e:
+ sys.stderr.write("!!! Error connecting to '%s'.\n" % baseurl)
+ sys.stderr.write("!!! %s\n" % str(e))
+ del e
+ return metadata[baseurl]["data"]
tbz2list = match_in_array(filelist, suffix=".tbz2")
metalist = match_in_array(filelist, prefix="metadata.idx")
del filelist