summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-11-23 08:51:44 +0100
committerMichael Vogt <mvo@debian.org>2013-11-23 08:51:44 +0100
commit5e76e9fccee519c63602562dc4065deb3f97748b (patch)
treeeaeb6fdfed8d710dc26bfb879bd2ba2bbd8b5bed /apt
parent56ed099558a9f6e7137a8c113ca9efb2b2c1a1d2 (diff)
downloadpython-apt-5e76e9fccee519c63602562dc4065deb3f97748b.tar.gz
* apt/cache.py:
- when using apt.Cache(rootdir=/some/dir) only read the APT configuration from this rootdir instead of /etc (closes: #728274)
Diffstat (limited to 'apt')
-rw-r--r--apt/cache.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 2f0eda59..43fb55d7 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -82,13 +82,16 @@ class Cache(object):
apt_pkg.config.set("Dir::Cache::pkgcache", "")
if rootdir:
rootdir = os.path.abspath(rootdir)
+ # clear old config first (Bug#728274)
+ apt_pkg.config.clear("APT")
+ apt_pkg.config.set("Dir", rootdir)
+ apt_pkg.init_config()
if os.path.exists(rootdir+"/etc/apt/apt.conf"):
apt_pkg.read_config_file(apt_pkg.config,
rootdir + "/etc/apt/apt.conf")
if os.path.isdir(rootdir+"/etc/apt/apt.conf.d"):
apt_pkg.read_config_dir(apt_pkg.config,
rootdir + "/etc/apt/apt.conf.d")
- apt_pkg.config.set("Dir", rootdir)
apt_pkg.config.set("Dir::State::status",
rootdir + "/var/lib/dpkg/status")
# also set dpkg to the rootdir path so that its called for the