aptdaemon-developers team mailing list archive
-
aptdaemon-developers team
-
Mailing list archive
-
Message #00011
[Merge] lp:~aptdaemon-developers/aptdaemon/non-blocking-lintian into lp:aptdaemon
Sebastian Heinlein has proposed merging lp:~aptdaemon-developers/aptdaemon/non-blocking-lintian into lp:aptdaemon.
Requested reviews:
Aptdaemon Developers (aptdaemon-developers)
Related bugs:
Bug #804444 in software-center (Ubuntu): "software-center crashed with DBusException in _convert_dbus_exception(): org.freedesktop.DBus.Error.NoReply: Did not receive a reply. aptdaemon does not respond in time."
https://bugs.launchpad.net/ubuntu/+source/software-center/+bug/804444
Bug #812023 in aptdaemon (Ubuntu): "software-center crashed with DBusException in _convert_dbus_exception(): org.freedesktop.DBus.Error.UnknownMethod: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Properties" doesn't exist"
https://bugs.launchpad.net/ubuntu/+source/aptdaemon/+bug/812023
Bug #819941 in aptdaemon (Ubuntu): "<type 'exceptions.OSError'>: [Errno 4] Interrupted system call"
https://bugs.launchpad.net/ubuntu/+source/aptdaemon/+bug/819941
For more details, see:
https://code.launchpad.net/~aptdaemon-developers/aptdaemon/non-blocking-lintian/+merge/75886
--
https://code.launchpad.net/~aptdaemon-developers/aptdaemon/non-blocking-lintian/+merge/75886
Your team Aptdaemon Developers is requested to review the proposed merge of lp:~aptdaemon-developers/aptdaemon/non-blocking-lintian into lp:aptdaemon.
=== modified file 'aptdaemon/worker.py'
--- aptdaemon/worker.py 2011-09-07 06:51:27 +0000
+++ aptdaemon/worker.py 2011-09-18 08:20:27 +0000
@@ -1123,26 +1123,22 @@
fatal_args = ["/usr/bin/lintian", "--tags-from-file",
tags_fatal_file, "--no-override", path]
for lintian_args in (nonfatal_args, fatal_args):
- pid, master = os.forkpty()
- if pid == 0:
- mainloop.quit()
- os.seteuid(uid)
- os.execv("/usr/bin/lintian", lintian_args)
- os._exit(2)
- else:
- output_fd = os.fdopen(master)
- try:
- output = output_fd.read()
- except IOError:
- output = ""
- finally:
- output_fd.close()
- pid, status = os.waitpid(pid, 0)
- #FIXME: Add an error to catch return state 2 (failure)
- if os.WEXITSTATUS(status) == 1:
- raise TransactionFailed(ERROR_INVALID_PACKAGE_FILE,
- "Lintian check results for %s:"
- "\n%s" % (path, output))
+ proc = subprocess.Popen(lintian_args,
+ stderr=subprocess.STDOUT,
+ stdout=subprocess.PIPE, close_fds=True,
+ preexec_fn=lambda: os.setuid(uid))
+ while proc.poll() is None:
+ while gobject.main_context_default().pending():
+ gobject.main_context_default().iteration()
+ time.sleep(0.05)
+ #FIXME: Add an error to catch return state 2 (failure)
+ if proc.returncode == 1:
+ stdout = unicode(proc.stdout.read(),
+ sys.stdin.encoding or "UTF-8",
+ errors="replace")
+ raise TransactionFailed(ERROR_INVALID_PACKAGE_FILE,
+ "Lintian check results for %s:"
+ "\n%s" % (path, stdout))
try:
deb = apt.debfile.DebPackage(path, self._cache)
except IOError:
@@ -1153,7 +1149,7 @@
raise TransactionFailed(ERROR_DEP_RESOLUTION_FAILED,
deb._failure_string)
return deb
-
+
def clean(self, trans):
"""Clean the download directories.
=== modified file 'tests/test_worker.py'
--- tests/test_worker.py 2011-08-25 22:10:35 +0000
+++ tests/test_worker.py 2011-09-18 08:20:27 +0000
@@ -254,7 +254,8 @@
try:
self.worker.simulate(trans)
except errors.TransactionFailed, error:
- self.assertEqual(error.code, enums.ERROR_INVALID_PACKAGE_FILE)
+ self.assertEqual(error.code, enums.ERROR_INVALID_PACKAGE_FILE,
+ error)
else:
raise Exception("Lintian failed to detect a broken package")
# Now allow to install invalid packages
Follow ups