summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt/cache.py1
-rw-r--r--apt/package.py11
-rw-r--r--debian/changelog13
3 files changed, 21 insertions, 4 deletions
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):
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 8eab9649..6cb5d12d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,16 @@
+python-apt (0.7.9~exp2ubuntu4) jaunty; urgency=low
+
+ * 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/package.py:
+ - make sure to set the defaulttimeout back to the
+ original value (in getChangelog(), LP: #314212)
+
+ -- Michael Vogt <michael.vogt@ubuntu.com> Mon, 26 Jan 2009 08:45:00 +0100
+
python-apt (0.7.9~exp2ubuntu3) jaunty; urgency=low
* apt/__init__.py: