From a5adf03304d80696fb701e2373f13876bf9a50f8 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 27 Nov 2007 01:11:10 +0000 Subject: [PATCH] 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 --- pym/portage/getbinpkg.py | 13 +++++++++++-- 1 file 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 -- 2.26.2