diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-01-04 23:45:32 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-01-04 23:45:32 +0000 |
| commit | 0b33dd41e471a36c3e28a22319c3e760346ed2f3 (patch) | |
| tree | c070bcb111ed1ab8dc132ef6a3da30174dcbe430 | |
| parent | 170c310e75aa0bc417cb67f6e560fdaab482d72e (diff) | |
| download | python-apt-0b33dd41e471a36c3e28a22319c3e760346ed2f3.tar.gz | |
* added "trusted" to the Origin class (in package.py)
| -rw-r--r-- | apt/cache.py | 3 | ||||
| -rw-r--r-- | apt/package.py | 24 | ||||
| -rw-r--r-- | debian/changelog | 1 |
3 files changed, 19 insertions, 9 deletions
diff --git a/apt/cache.py b/apt/cache.py index 9a0ff96c..2821f287 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -65,7 +65,8 @@ class Cache(object): # drop stuff with no versions (cruft) if len(pkg.VersionList) > 0: self._dict[pkg.Name] = Package(self._cache, self._depcache, - self._records, self, pkg) + self._records, self._list, + self, pkg) i += 1 if progress != None: diff --git a/apt/package.py b/apt/package.py index 4ca27b81..c9a73597 100644 --- a/apt/package.py +++ b/apt/package.py @@ -25,12 +25,13 @@ import apt_pkg, string, sys, random class Package(object): """ This class represents a package in the cache """ - def __init__(self, cache, depcache, records, pcache, pkgiter): + def __init__(self, cache, depcache, records, list, pcache, pkgiter): """ Init the Package object """ self._cache = cache # low level cache self._depcache = depcache self._records = records self._pkg = pkgiter + self._list = list # sourcelist self._pcache = pcache # python cache in cache.py pass @@ -235,16 +236,22 @@ class Package(object): # canidate origin class Origin: - def __init__(self,VerFileIter): + def __init__(self, pkg, VerFileIter): self.component = VerFileIter.Component self.archive = VerFileIter.Archive self.origin = VerFileIter.Origin self.label = VerFileIter.Label self.site = VerFileIter.Site - def __str__(self): - return "component:%s\narchive: %s\norigin: %s\nlabel: %s" \ - "\nsite %s\n"% (self.component, self.archive, - self.origin, self.label, self.site) + # check the trust + indexfile = pkg._list.FindIndex(VerFileIter) + if indexfile and indexfile.IsTrusted: + self.trusted = True + self.trusted = False + def __repr__(self): + return "component: '%s' archive: '%s' origin: '%s' label: %s" \ + "site '%s' isTrusted: '%s'"% (self.component, self.archive, + self.origin, self.label, + self.site, self.trusted) def candidateOrigin(self): ver = self._depcache.GetCandidateVer(self._pkg) @@ -252,7 +259,7 @@ class Package(object): return None origins = [] for (verFileIter,index) in ver.FileList: - origins.append(self.Origin(verFileIter)) + origins.append(self.Origin(pkg, verFileIter)) return origins candidateOrigin = property(candidateOrigin) @@ -308,9 +315,10 @@ if __name__ == "__main__": cache = apt_pkg.GetCache() depcache = apt_pkg.GetDepCache(cache) records = apt_pkg.GetPkgRecords(cache) + list = apt_pkg.GetPkgSourceList() iter = cache["apt-utils"] - pkg = Package(cache, depcache, records, None, iter) + pkg = Package(cache, depcache, records, list, None, iter) print "Name: %s " % pkg.name print "ID: %s " % pkg.id print "Priority (Candidate): %s " % pkg.priority diff --git a/debian/changelog b/debian/changelog index 2635581d..f00d90b3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,7 @@ python-apt (0.6.16) unstable; urgency=low now instead of a single one * apt_pkg.Cdrom.Add() returns a boolean now, CdromProgress has totalSteps * added support for pkgIndexFile and added SourcesList.FindIndex() + * added "trusted" to the Origin class -- |
