summaryrefslogtreecommitdiff
path: root/apt/progress
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2009-09-16 20:05:46 +0200
committerJulian Andres Klode <jak@debian.org>2009-09-16 20:05:46 +0200
commita7217b885beff13462bbb793eac42d28c53752f8 (patch)
treee141cd0d0e644e7cf4f79fea34ba9bf8977801b8 /apt/progress
parent8600d4c44a5b9f75887da6e12acea622caef8c76 (diff)
parentbe85eeaeadf8b93021413ab7ed79e639b65102a6 (diff)
downloadpython-apt-a7217b885beff13462bbb793eac42d28c53752f8.tar.gz
Merge 0.7.13.0 - 0.7.13.3 from unstable.
* 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) * apt/cache.py: - Convert argument to str in __getitem__() (Closes: #542965).
Diffstat (limited to 'apt/progress')
-rw-r--r--apt/progress/base.py18
1 files changed, 15 insertions, 3 deletions
diff --git a/apt/progress/base.py b/apt/progress/base.py
index 08d35533..fd6bc475 100644
--- a/apt/progress/base.py
+++ b/apt/progress/base.py
@@ -27,6 +27,8 @@ import os
import re
import select
+import apt_pkg
+
__all__ = ['AcquireProgress', 'CdromProgress', 'InstallProgress', 'OpProgress']
@@ -179,11 +181,19 @@ class InstallProgress(object):
"""
pid = self.fork()
if pid == 0:
+ # pm.do_install might raise a exception,
+ # when this happens, we need to catch
+ # it, otherwise os._exit() is not run
+ # and the execution continues in the
+ # parent code leading to very confusing bugs
try:
os._exit(obj.do_install(self.writefd.fileno()))
except AttributeError:
os._exit(os.spawnlp(os.P_WAIT, "dpkg", "dpkg", "--status-fd",
str(self.writefd.fileno()), "-i", obj))
+ except Exception:
+ os._exit(apt_pkg.PackageManager.result_failed)
+
self.child_pid = pid
res = self.wait_child()
return os.WEXITSTATUS(res)
@@ -236,7 +246,8 @@ class InstallProgress(object):
"""Wait for child progress to exit.
This method is responsible for calling update_interface() from time to
- time. It exits once the child has exited.
+ time. It exits once the child has exited. The return values is the
+ full status returned from os.waitpid() (not only the return code).
"""
(pid, res) = (0, 0)
while True:
@@ -252,10 +263,11 @@ class InstallProgress(object):
if pid == self.child_pid:
break
except OSError, err:
- if err[0] != errno.EINTR:
- raise
if err[0] == errno.ECHILD:
break
+ if err[0] != errno.EINTR:
+ raise
+
return res