From 16917ac913f029aed5148bdb134069901c816300 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 23 Jan 2009 09:59:32 +0100 Subject: * apt/cache.py: - when running with the rootdir option, run InitConfig() again to ensure that the config from the rootdir is read, not from the host (lp: #243550) --- apt/cache.py | 1 + 1 file changed, 1 insertion(+) (limited to 'apt') diff --git a/apt/cache.py b/apt/cache.py index 0065d14c..a8432a32 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -55,6 +55,7 @@ class Cache(object): apt_pkg.Config.Set("Dir", rootdir) apt_pkg.Config.Set("Dir::State::status", rootdir + "/var/lib/dpkg/status") + apt_pkg.InitConfig() self.open(progress) def _runCallbacks(self, name): -- cgit v1.2.3 From 82fda8b9fa514ed8a268650f21ae9e76d713e1d4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 23 Jan 2009 21:41:00 +0100 Subject: * apt/package.py: - make sure to set the defaulttimeout back to the original value (in getChangelog(), LP: #314212) --- apt/package.py | 11 +++++++---- debian/changelog | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'apt') diff --git a/apt/package.py b/apt/package.py index ecfd8b61..5a7da1f3 100644 --- a/apt/package.py +++ b/apt/package.py @@ -32,10 +32,6 @@ import apt_pkg __all__ = 'BaseDependency', 'Dependency', 'Origin', 'Package', 'Record' -# Set a timeout for the changelog download -socket.setdefaulttimeout(2) - - def _(string): """Return the translation of the string.""" return gettext.dgettext("python-apt", string) @@ -596,7 +592,12 @@ class Package(object): "prefix": prefix, "src_pkg": src_pkg, "src_ver": src_ver} + + timeout = socket.getdefaultimeout() try: + # Set a timeout for the changelog download + socket.setdefaulttimeout(2) + # Check if the download was canceled if cancel_lock and cancel_lock.isSet(): return "" @@ -649,6 +650,8 @@ class Package(object): except (IOError, httplib.BadStatusLine): return _("Failed to download the list of changes. \nPlease " "check your Internet connection.") + finally: + socket.setdefaulttimeout(timeout) return self._changelog @property diff --git a/debian/changelog b/debian/changelog index 73715a36..f3514680 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,9 @@ python-apt (0.7.9~exp3) experimental; urgency=low InitConfig() again to ensure that the config from the rootdir is read, not from the host (lp: #243550) + * apt/package.py: + - make sure to set the defaulttimeout back to the + original value (in getChangelog(), LP: #314212) -- -- cgit v1.2.3