[Piuparts-commits] [piuparts] 02/17: open_packages_url: return the resolved url, too

Holger Levsen holger at alioth.debian.org
Wed Nov 6 09:45:52 UTC 2013


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit 2d75c956b6987dc89a1f07fa1696198404416889
Author: Andreas Beckmann <anbe at debian.org>
Date:   Tue Nov 5 18:29:22 2013 +0100

    open_packages_url: return the resolved url, too
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 piupartslib/__init__.py   |    4 +++-
 piupartslib/packagesdb.py |    3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/piupartslib/__init__.py b/piupartslib/__init__.py
index eb71e94..fe9337c 100644
--- a/piupartslib/__init__.py
+++ b/piupartslib/__init__.py
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
 # Copyright 2005 Lars Wirzenius (liw at iki.fi)
+# Copyright © 2013 Andreas Beckmann (anbe at debian.org)
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the
@@ -40,6 +41,7 @@ def open_packages_url(url):
             break
     if socket is None:
         raise httperror
+    url = socket.geturl()
     if ext == '.bz2':
         decompressed = cStringIO.StringIO()
         decompressor = bz2.BZ2Decompressor()
@@ -62,6 +64,6 @@ def open_packages_url(url):
         decompressed = gzip.GzipFile(fileobj=compressed)
     else:
         raise ext
-    return decompressed
+    return (url, decompressed)
 
 # vi:set et ts=4 sw=4 :
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 07a30f8..218d521 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -136,8 +136,9 @@ class PackagesFile(UserDict.UserDict):
 
     def load_packages_urls(self, urls):
         for url in urls:
+            logging.debug("Opening %s.*" % url)
+            (url, stream) = piupartslib.open_packages_url(url)
             logging.debug("Fetching %s" % url)
-            stream = piupartslib.open_packages_url(url)
             self._read_file(stream)
             stream.close()
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list