summaryrefslogtreecommitdiff
path: root/apt
diff options
context:
space:
mode:
authorMichael Vogt <egon@bottom>2008-02-19 19:26:32 +0100
committerMichael Vogt <egon@bottom>2008-02-19 19:26:32 +0100
commit5c84be897a08247a5146cccbac7134cadfb43310 (patch)
treeccffceb503eaa2d926cc75171dd3723a4a1de462 /apt
parent4d46ff50f061c4742713e906430d73fdc927b250 (diff)
parent1bf52388c98e72768b8f883726ee7e2e2992e4ff (diff)
downloadpython-apt-5c84be897a08247a5146cccbac7134cadfb43310.tar.gz
* use the new CacheFile::ListUpdate() code
* add example in doc/examples/update.py * python/pkgrecords.cc: - export the Homepage field * python/tar.cc: - fix .lzma extraction (thanks to bigjools) * python/sourcelist.cc: - support GetIndexes() GetAll argument to implement something like --print-uris * python/apt_pkgmodule.cc: - add InstState{Ok,ReInstReq,Hold,HoldReInstReq} constants * apt/cache.py: - add reqReinstallPkgs property that lists all packages in ReInstReq or HoldReInstReq
Diffstat (limited to 'apt')
-rw-r--r--apt/cache.py21
-rw-r--r--apt/package.py8
2 files changed, 21 insertions, 8 deletions
diff --git a/apt/cache.py b/apt/cache.py
index 65f3c9d9..a92bd5be 100644
--- a/apt/cache.py
+++ b/apt/cache.py
@@ -122,6 +122,17 @@ class Cache(object):
self._depcache.Upgrade(distUpgrade)
self.cachePostChange()
+ @property
+ def reqReinstallPkgs(self):
+ " return the packages not downloadable packages in reqreinst state "
+ reqreinst = set()
+ for pkg in self:
+ if (not pkg.candidateDownloadable and
+ (pkg._pkg.InstState == apt_pkg.InstStateReInstReq or
+ pkg._pkg.InstState == apt_pkg.InstStateHoldReInstReq)):
+ reqreinst.add(pkg.name)
+ return reqreinst
+
def _runFetcher(self, fetcher):
# do the actual fetching
res = fetcher.Run()
@@ -166,6 +177,7 @@ class Cache(object):
os.close(lock)
def update(self, fetchProgress=None):
+ " run the equivalent of apt-get update "
lockfile = apt_pkg.Config.FindDir("Dir::State::Lists") + "lock"
lock = apt_pkg.GetLock(lockfile)
if lock < 0:
@@ -174,14 +186,7 @@ class Cache(object):
try:
if fetchProgress == None:
fetchProgress = apt.progress.FetchProgress()
- fetcher = apt_pkg.GetAcquire(fetchProgress)
- # this can throw a exception
- self._list.GetIndexes(fetcher)
- # now run the fetcher, throw exception if something fails to be
- # fetched
- if self._runFetcher(fetcher) == fetcher.ResultContinue:
- return True
- return False
+ return self._cache.Update(fetchProgress, self._list)
finally:
os.close(lock)
diff --git a/apt/package.py b/apt/package.py
index 49aadd20..ac045969 100644
--- a/apt/package.py
+++ b/apt/package.py
@@ -194,6 +194,13 @@ class Package(object):
return self._pkg.Name
sourcePackageName = property(sourcePackageName)
+ def homepage(self):
+ """ Return the homepage field as string """
+ if not self._lookupRecord():
+ return None
+ return self._records.Homepage
+ homepage = property(homepage)
+
def section(self):
""" Return the section of the package"""
return self._pkg.Section
@@ -449,6 +456,7 @@ if __name__ == "__main__":
for dep in pkg.candidateDependencies:
print ",".join(["%s (%s) (%s) (%s)" % (o.name,o.version,o.relation, o.preDepend) for o in dep.or_dependencies])
print "arch: %s" % pkg.architecture
+ print "homepage: %s" % pkg.homepage
print "rec: ",pkg.candidateRecord
# now test install/remove