From 80bd612d4006a493541ca8f50b1634ee529cb533 Mon Sep 17 00:00:00 2001 From: Stephan Peijnik Date: Sat, 25 Jul 2009 10:35:21 +0200 Subject: Exception handling fixes in InstallProgress class. --- apt/progress/__init__.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'apt/progress') diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index 3be197f7..b582ad22 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -286,11 +286,20 @@ class InstallProgress(DumbInstallProgress): def waitChild(self): """Wait for child progress to exit.""" while True: - select.select([self.statusfd], [], [], self.selectTimeout) - self.updateInterface() - (pid, res) = os.waitpid(self.child_pid, os.WNOHANG) - if pid == self.child_pid: + try: + select.select([self.statusfd], [], [], self.selectTimeout) + except select.error, (errno_, errstr): + if errno_ != errno.EINTR: + raise break + self.updateInterface() + try: + (pid, res) = os.waitpid(self.child_pid, os.WNOHANG) + if pid == self.child_pid: + break + except OSError, (errno_, errstr): + if errno_ != errno.EINTR: + raise return res def run(self, pm): -- cgit v1.2.3 From 2b64e774ba825789caea80d9424faf1ac3be19d9 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 30 Jul 2009 14:36:35 +0200 Subject: apt/progress.py: Extract the package name from the status message (Closes: #532660) --- apt/progress/__init__.py | 5 +++-- debian/changelog | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'apt/progress') diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index b582ad22..b9288c2c 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -344,7 +344,7 @@ class DpkgInstallProgress(InstallProgress): if pid == 0: # child res = os.system("/usr/bin/dpkg --status-fd %s -i %s" % \ - (self.writefd, self.debfile)) + (self.writefd, debfile)) os._exit(os.WEXITSTATUS(res)) self.child_pid = pid res = self.waitChild() @@ -370,10 +370,11 @@ class DpkgInstallProgress(InstallProgress): print "got garbage from dpkg: '%s'" % self.read self.read = "" break + pkg_name = statusl[1].strip() status = statusl[2].strip() #print status if status == "error": - self.error(self.debname, status) + self.error(pkg_name, status) elif status == "conffile-prompt": # we get a string like this: # 'current-conffile' 'new-conffile' useredited distedited diff --git a/debian/changelog b/debian/changelog index e95a3fe2..83422b00 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,10 @@ python-apt (0.7.11.2) unstable; urgency=low * debian/python-apt.doc-base: register the documentation with the doc-base system (Closes: #525134) + [ Sebastian Heinlein ] + * apt/progress.py: Extract the package name from the status message + (Closes: #532660) + -- Julian Andres Klode Thu, 30 Jul 2009 14:08:30 +0200 python-apt (0.7.11.1) unstable; urgency=low -- cgit v1.2.3 From bb517c1da9e82d36b2c599f308d5451be68fadcb Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 30 Jul 2009 18:29:13 +0200 Subject: apt/progress/__init__.py: Fix InstallProgress.waitChild() - Do not break out of InstallProgress.waitChild()'s loop just because it is hitting EINTR, but only on child exit or on ECHILD. --- apt/progress/__init__.py | 5 +++-- debian/changelog | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'apt/progress') diff --git a/apt/progress/__init__.py b/apt/progress/__init__.py index b9288c2c..337bd161 100644 --- a/apt/progress/__init__.py +++ b/apt/progress/__init__.py @@ -112,7 +112,7 @@ class FetchProgress(object): This happens eg. when the downloads fails or is completed. """ - def update_status_full(self, uri, descr, short_descr, status, file_size, + def update_status_full(self, uri, descr, short_descr, status, file_size, partial_size): """Called when the status of an item changes. @@ -291,7 +291,6 @@ class InstallProgress(DumbInstallProgress): except select.error, (errno_, errstr): if errno_ != errno.EINTR: raise - break self.updateInterface() try: (pid, res) = os.waitpid(self.child_pid, os.WNOHANG) @@ -300,6 +299,8 @@ class InstallProgress(DumbInstallProgress): except OSError, (errno_, errstr): if errno_ != errno.EINTR: raise + if errno_ == errno.ECHILD: + break return res def run(self, pm): diff --git a/debian/changelog b/debian/changelog index c2d30cf9..49c74106 100644 --- a/debian/changelog +++ b/debian/changelog @@ -22,6 +22,9 @@ python-apt (0.7.12.0) unstable; urgency=low - Return VersionList objects in Package.versions, which are sequences and also provide features of mappings. (partial API BREAK) + Allows to get a specific version (Closes: #523998) + * apt/progress/__init__.py: + - Do not break out of InstallProgress.waitChild()'s loop just because it + is hitting EINTR, but only on child exit or on ECHILD. * Use debhelper 7 instead of CDBS [ Stefano Zacchiroli ] -- cgit v1.2.3