diff options
| author | Sebastian Heinlein <sebi@glatzor.de> | 2008-08-22 06:14:02 +0200 |
|---|---|---|
| committer | Sebastian Heinlein <sebi@glatzor.de> | 2008-08-22 06:14:02 +0200 |
| commit | f59dec995d909d7f32c0cb8422e1554a82e2657d (patch) | |
| tree | 731b7f691decfc413f38b97d46c0e2b53bd35ab4 /apt/cache.py | |
| parent | 0b0b062b72b721e5f5b3387b6c0fb4de6f6a4e61 (diff) | |
| parent | a39a102e437702e7cd1c3f314e507d6b0d466eb5 (diff) | |
| download | python-apt-f59dec995d909d7f32c0cb8422e1554a82e2657d.tar.gz | |
Merge local dpkg installation from the gdebi branch.
Diffstat (limited to 'apt/cache.py')
| -rw-r--r-- | apt/cache.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/apt/cache.py b/apt/cache.py index bbf2165b..3fd1e996 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -182,6 +182,51 @@ class Cache(object): finally: os.close(lock) + def isVirtualPackage(self, name): + """ + Return True if the package of the given name is a virtual package + """ + try: + virtual_pkg = self._cache[name] + except KeyError: + return False + if len(virtual_pkg.VersionList) == 0: + return True + return False + + 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: + #print virtual + #print p[0] + if virtual == p[0]: + # we found a pkg that provides this virtual + # pkg, check if the proivdes is any good + providers.append(pkg) + #cand = self._cache[pkg.name] + #candver = self._cache._depcache.GetCandidateVer(cand._pkg) + #instver = cand._pkg.CurrentVer + #res = apt_pkg.CheckDep(candver.VerStr,oper,ver) + #if res == True: + # self._dbg(1,"we can use %s" % pkg.name) + # or_found = True + # break + 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 +277,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 " |
