diff options
| author | Michael Vogt <mvo@debian.org> | 2008-12-15 14:42:01 +0100 |
|---|---|---|
| committer | Michael Vogt <mvo@debian.org> | 2008-12-15 14:42:01 +0100 |
| commit | 12cf58d12b969010f3d98b2974d72bbb950b775f (patch) | |
| tree | dc7f0af010aefa0b76a256f594d6dc4ae3163aaa /apt/cache.py | |
| parent | be8fa1ee4581faeadfb6d067301ee9e7761dc1c7 (diff) | |
| parent | 481a90a820564dc12567348c16773e15cc129560 (diff) | |
| download | python-apt-12cf58d12b969010f3d98b2974d72bbb950b775f.tar.gz | |
merge mvo branch, upload to experimental
Diffstat (limited to 'apt/cache.py')
| -rw-r--r-- | apt/cache.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/apt/cache.py b/apt/cache.py index bbf2165b..79e58282 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -129,6 +129,17 @@ class Cache(object): self.cachePostChange() @property + def requiredDownload(self): + """ get the size of the packages that are required to download """ + pm = apt_pkg.GetPackageManager(self._depcache) + fetcher = apt_pkg.GetAcquire() + pm.GetArchives(fetcher, self._list, self._records) + return fetcher.FetchNeeded + @property + def additionalRequiredSpace(self): + """ get the size of the additional required space on the fs """ + return self._depcache.UsrSize + @property def reqReinstallPkgs(self): " return the packages not downloadable packages in reqreinst state " reqreinst = set() @@ -182,6 +193,28 @@ class Cache(object): finally: os.close(lock) + def getProvidingPackages(self, virtual): + """ + Return a list of packages which provide the virtual package of the + specified name + """ + providers = [] + try: + vp = self._cache[virtual] + if len(vp.VersionList) != 0: + return providers + except KeyError: + return providers + for pkg in self: + v = self._depcache.GetCandidateVer(pkg._pkg) + if v == None: + continue + for p in v.ProvidesList: + if virtual == p[0]: + # we found a pkg that provides this virtual pkg + providers.append(pkg) + return providers + def update(self, fetchProgress=None): " run the equivalent of apt-get update " lockfile = apt_pkg.Config.FindDir("Dir::State::Lists") + "lock" @@ -232,6 +265,10 @@ class Cache(object): fetcher.Shutdown() return (res == pm.ResultCompleted) + def clear(self): + """ Unmark all changes """ + self._depcache.Init() + # cache changes def cachePostChange(self): " called internally if the cache has changed, emit a signal then " |
