← Back to team overview

apport-hackers team mailing list archive

[Merge] lp:~ev/apport/automatic-reporting into lp:apport

 

Evan Dandrea has proposed merging lp:~ev/apport/automatic-reporting into lp:apport.

Requested reviews:
  Apport upstream developers (apport-hackers)

For more details, see:
https://code.launchpad.net/~ev/apport/automatic-reporting/+merge/173553

This branch creates a thin frontend for automatic error reporting, as requested by a few engineers (apw, infinity, etc) and needed for the server (https://lists.ubuntu.com/archives/ubuntu-server/2013-June/006626.html).

It returns the negative or empty response to any questions asked by client-side hooks, as the user will not be able to review these.

I added support to apport-collect, with the intention to patch update-notifier to point at /usr/bin/apport-collect instead of /usr/share/apport/apport-gtk. This would allow us to select the automatic error reporting frontend without pulling in GTK libraries as we would in an approach that checked packaging.enabled() from within apport-gtk.

Definitely open to suggestion on this one.

If you approve, I'll follow up with a branch of activity-log-manager that sets automatic=1 in /etc/default/apport when the appropriate box is ticked:

https://wiki.ubuntu.com/ErrorTracker#Privacy_settings

As the wiki page suggests, we can follow this up with finer-grained control at the ~/ level for automatic submission and the server to send to.
-- 
https://code.launchpad.net/~ev/apport/automatic-reporting/+merge/173553
Your team Apport upstream developers is requested to review the proposed merge of lp:~ev/apport/automatic-reporting into lp:apport.
=== added file 'bin/apport-autoreport'
--- bin/apport-autoreport	1970-01-01 00:00:00 +0000
+++ bin/apport-autoreport	2013-07-08 17:07:27 +0000
@@ -0,0 +1,84 @@
+#!/usr/bin/python
+
+'''Automatic reporting Apport user interface.'''
+
+# Copyright (C) 2013 Canonical Ltd.
+# Author: Evan Dandrea <evan.dandrea@xxxxxxxxxxxxx>
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version.  See http://www.gnu.org/copyleft/gpl.html for
+# the full text of the license.
+
+import subprocess
+import apport
+import apport.ui
+
+
+class AutoreportUserInterface(apport.ui.UserInterface):
+    '''Autoreport UserInterface.'''
+
+    #
+    # ui_* implementation of abstract UserInterface classes
+    #
+
+
+    def ui_present_report_details(self, allowed_to_report=True, modal_for=None):
+        return_value = { 'report' : True, 'blacklist' : False,
+                         'restart' : False, 'examine' : False }
+        return return_value
+
+    def ui_info_message(self, title, text):
+        apport.log('Automatic reporting: %s: %s' % (title, text))
+
+    def ui_error_message(self, title, text):
+        apport.log('Automatic reporting: %s: %s' % (title, text))
+
+    def ui_start_upload_progress(self):
+        return
+
+    def ui_set_upload_progress(self, progress):
+        return
+
+    def ui_stop_upload_progress(self):
+        return
+
+    def ui_start_info_collection_progress(self):
+        return
+
+    def ui_pulse_info_collection_progress(self):
+        return
+
+    def ui_stop_info_collection_progress(self):
+        return
+
+    def ui_question_yesno(self, text):
+        '''Respond 'No' to any questions, as the user has not had the
+        opportunity to review the question.
+        '''
+        return False
+
+    def ui_question_choice(self, text, options, multiple):
+        '''Respond with no selection to any multiple choice questions, as the
+        user has not had the opportunity to review them.
+        '''
+        return None
+
+    def ui_question_file(self, text):
+        '''Show a file selector dialog.
+
+        Return path if the user selected a file, or None if cancelled.
+        '''
+        return None
+
+    def ui_run_terminal(self, command):
+        # we are already running in a terminal, so this works by definition
+        if not command:
+            return True
+        subprocess.call(command, shell=True)
+
+
+if __name__ == '__main__':
+    app = AutoreportUserInterface()
+    app.run_argv()

=== modified file 'bin/apport-bug'
--- bin/apport-bug	2012-06-11 07:50:03 +0000
+++ bin/apport-bug	2013-07-08 17:07:27 +0000
@@ -30,6 +30,8 @@
     GTK="$RET"
     find_program "apport-kde"
     KDE="$RET"
+    find_program "apport-autoreport"
+    AUTO="$RET"
 
     # find a terminal emulator
 }
@@ -42,6 +44,10 @@
 
 export APPORT_INVOKED_AS="$0"
 
+if [ -n "$AUTO" ] && grep -qs "automatic=1" /etc/default/apport; then
+    $AUTO "$@"
+fi
+
 # check for X
 if [ -z "$DISPLAY" ]; then
     if [ -n "$CLI" ] ; then
@@ -72,7 +78,7 @@
     fi
 
 else
-    echo "Neither apport-gtk, apport-kde or apport-cli are installed. Install either to make this program work." >&2
+    echo "Neither apport-gtk, apport-kde, apport-cli, or apport-autoreport are installed. Install either to make this program work." >&2
     exit 1
 fi
 


Follow ups