diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-12-02 17:02:12 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-12-02 17:02:12 +0100 |
| commit | b02678a53864040155d5845a23a50096ea31e498 (patch) | |
| tree | de854af2900ee899fe510d768842f6fd524feaa5 /apt/cache.py | |
| parent | c69e1b0d6e7224f21026c2ec793140b99b93f8de (diff) | |
| parent | 6b68713c64868460202e3178dfeed31a2bde2b95 (diff) | |
| download | python-apt-b02678a53864040155d5845a23a50096ea31e498.tar.gz | |
* merge from debian, remaining changes:
- different mirror list
* po/zh_CN.po:
- updated, thanks to Feng Chao
* python/progress.cc:
- if the mediaChange() does not return anything or is not implemented
send "false" to libapt
* apt/package.py: Fix dictionary access of VersionList, patch
by Sebastian Heinlein (Closes: #554895).
* apt/cache.py:
- add actiongroup() method (backport from 0.7.92)
- re-work the logic in commit() to fail if installArchives() returns
a unexpected result
* apt/progress/__init__.py:
- catch exceptions in pm.DoInstall()
* apt/package.py:
- Export if a package is an essential one (Closes: #543428)
* python/depcache.cc:
- Make ActionGroups context managers so apt.Cache.actiongroup() has
the same behavior as in 0.7.92
* apt/cache.py:
- Add raiseOnError option to Cache.update() (Closes: #545474)
* apt/package.py:
- Use the source version instead of the binary version in fetch_source().
* apt/progress/__init__.py:
- Correctly ignore ECHILD by checking before EINTR (Closes: #546007)
Diffstat (limited to 'apt/cache.py')
| -rw-r--r-- | apt/cache.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apt/cache.py b/apt/cache.py index bb944041..fa6c404c 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -270,7 +270,7 @@ class Cache(object): providers.append(pkg) return providers - def update(self, fetchProgress=None, pulseInterval=0): + def update(self, fetchProgress=None, pulseInterval=0, raiseOnError=False): " run the equivalent of apt-get update " lockfile = apt_pkg.Config.FindDir("Dir::State::Lists") + "lock" lock = apt_pkg.GetLock(lockfile) @@ -280,7 +280,14 @@ class Cache(object): try: if fetchProgress is None: fetchProgress = apt.progress.FetchProgress() - return self._cache.Update(fetchProgress, self._list, pulseInterval) + res = self._cache.Update(fetchProgress, self._list, pulseInterval) + + if res == 2 and raiseOnError: + raise FetchCancelledException() + elif res == 1 and raiseOnError: + raise FetchFailedException() + else: + return res finally: os.close(lock) |
