summaryrefslogtreecommitdiff
path: root/apt/cache.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2008-06-13 11:59:36 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2008-06-13 11:59:36 +0200
commitcabdf7f7238ad23e7d61074e542c065b86b25268 (patch)
tree4078242d34b83c4c30bf9c9a7906094fc372ff69 /apt/cache.py
parentdd3c715fc64caa2dfca7ecf26a6f1ae2b99eb030 (diff)
downloadpython-apt-cabdf7f7238ad23e7d61074e542c065b86b25268.tar.gz
* apt/cache.py:
- add "memonly" option to apt.Cache() to force python-apt to not touch the pkgcache.bin file (this works around a possible race condition in the pkgcache.bin handling)
Diffstat (limited to 'apt/cache.py')
-rw-r--r--apt/cache.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/apt/cache.py b/apt/cache.py
index a92bd5be..384afe31 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -41,8 +41,11 @@ class Cache(object):
dictionary
"""
- def __init__(self, progress=None, rootdir=None):
+ def __init__(self, progress=None, rootdir=None, memonly=False):
self._callbacks = {}
+ if memonly:
+ # force apt to build its caches in memory
+ apt_pkg.Config.Set("Dir::Cache::pkgcache","")
if rootdir:
apt_pkg.Config.Set("Dir", rootdir)
apt_pkg.Config.Set("Dir::State::status", rootdir + "/var/lib/dpkg/status")