Merge lp:~cr3/checkbox/1047857 into lp:checkbox

Proposed by Marc Tardif
Status: Merged
Merged at revision: 1715
Proposed branch: lp:~cr3/checkbox/1047857
Merge into: lp:checkbox
Diff against target: 309 lines (+2/-281)
3 files modified
debian/changelog (+2/-0)
plugins/apport_prompt.py (+0/-280)
po/POTFILES.in (+0/-1)
To merge this branch: bzr merge lp:~cr3/checkbox/1047857
Reviewer Review Type Date Requested Status
Jeff Marcom (community) Approve
Marc Tardif (community) Needs Resubmitting
Review via email: mp+126709@code.launchpad.net

Commit message

Merged fix to remove apport plugin by cr3 (LP #1047857)

Description of the change

Remembered to update po/POTFILES.in to remove reference to plugins/apport_prompt.py.

To post a comment you must log in.
lp:~cr3/checkbox/1047857 updated
1715. By Marc Tardif

Removed apport_prompt.py from POTFILES.in

Revision history for this message
Marc Tardif (cr3) wrote :

The changes to po/POTFILES.in got lost when creating this merge request again.

review: Needs Resubmitting
Revision history for this message
Jeff Marcom (jeffmarcom) wrote :

Looks okay to me, and no more nagging from apport!!! Thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-09-27 09:00:46 +0000
3+++ debian/changelog 2012-09-27 16:14:24 +0000
4@@ -87,6 +87,8 @@
5 * checkbox/parsers/description.py: Fixed the PURPOSE and STEPS parts
6 of the description parser to automatically fix bad descriptions.
7 * plugins/suites_prompt.py: Fixed tree view in selection window (LP #1056432)
8+ * plugins/apport_prompt.py: Removed apport plugin that caused crashes
9+ when trying to send bug report (LP #1047857)
10
11 [Sean Feole]
12 * [FEATURE] scripts/battery_test: measures battery capacity before and after
13
14=== removed file 'plugins/apport_prompt.py'
15--- plugins/apport_prompt.py 2012-07-27 14:24:06 +0000
16+++ plugins/apport_prompt.py 1970-01-01 00:00:00 +0000
17@@ -1,280 +0,0 @@
18-#
19-# This file is part of Checkbox.
20-#
21-# Copyright 2008 Canonical Ltd.
22-#
23-# Checkbox is free software: you can redistribute it and/or modify
24-# it under the terms of the GNU General Public License as published by
25-# the Free Software Foundation, either version 3 of the License, or
26-# (at your option) any later version.
27-#
28-# Checkbox is distributed in the hope that it will be useful,
29-# but WITHOUT ANY WARRANTY; without even the implied warranty of
30-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31-# GNU General Public License for more details.
32-#
33-# You should have received a copy of the GNU General Public License
34-# along with Checkbox. If not, see <http://www.gnu.org/licenses/>.
35-#
36-import logging
37-
38-from subprocess import check_output
39-
40-from gettext import gettext as _
41-
42-from checkbox.job import FAIL
43-from checkbox.plugin import Plugin
44-from checkbox.properties import Bool, Path, String
45-from checkbox.reactor import StopAllException
46-
47-
48-class DummyUserInterface:
49- pass
50-
51-try:
52- from apport.ui import UserInterface
53- from apport.crashdb import get_crashdb
54-except:
55- UserInterface = DummyUserInterface
56-
57-
58-CATEGORY_TO_PACKAGE = {
59- "SOUND": "alsa-base"}
60-
61-CATEGORY_TO_SYMPTOM = {
62- "VIDEO": "display",
63- "DISK": "storage"}
64-
65-
66-class ApportOptions:
67-
68- def __init__(self, test, device, package, symptom):
69- self.test = test
70- self.device = device
71- self.package = package
72- self.symptom = symptom
73- self.pid = None
74- self.save = False
75- self.tag = '' #Additional tags to add to reports filed
76- #through this tool
77-
78-
79-class ApportUserInterface(UserInterface):
80-
81- def __init__(self, interface, options):
82- self.interface = interface
83- self.options = options
84- self.report = None
85- self.report_file = None
86- self.cur_package = None
87-
88- # ImportError raised during package upgrade
89- self.crashdb = get_crashdb(None)
90-
91- def ui_info_message(self, title, text):
92- self.interface.show_info(text, ["close"])
93-
94- def ui_error_message(self, title, text):
95- self.interface.show_progress_stop()
96- self.interface.show_error(text)
97-
98- def ui_start_info_collection_progress(self):
99- self.interface.show_progress_start(
100- _("Collecting information about this test.\n"
101- "This might take a few minutes."))
102-
103- def ui_pulse_info_collection_progress(self):
104- self.interface.show_progress_pulse()
105-
106- def ui_stop_info_collection_progress(self):
107- # tags
108- if "Tags" in self.report:
109- tags = self.report["Tags"].split(" ")
110- else:
111- tags = []
112-
113- tags.append("checkbox-bug")
114- if self.options.device:
115- tags.append(self.options.device)
116-
117- self.report["Tags"] = " ".join(tags)
118-
119- # checkbox
120- test = self.options.test
121- self.report["CheckboxTest"] = test["name"]
122- if test.get("description"):
123- self.report["CheckboxDescription"] = test["description"]
124- if test.get("data"):
125- self.report["CheckboxData"] = test["data"]
126- if test.get("command"):
127- self.report["CheckboxCommand"] = test["command"]
128- if test.get("environ"):
129- self.report["CheckboxEnvironment"] = test["environ"]
130-
131- self.interface.show_progress_stop()
132-
133- def ui_start_upload_progress(self):
134- self.interface.show_progress_start(
135- _("Collected information is being sent for bug tracking.\n"
136- "This might take a few minutes."))
137-
138- def ui_set_upload_progress(self, progress):
139- self.interface.show_progress_pulse()
140-
141- def ui_stop_upload_progress(self):
142- self.interface.show_progress_stop()
143-
144- def ui_present_report_details(self, *args):
145- return dict(report=1)
146-
147- def ui_question_choice(self, text, options, multiple):
148- self.interface.show_progress_stop()
149-
150- if multiple:
151- results = self.interface.show_check(text, options)
152- else:
153- results = [self.interface.show_radio(text, options)]
154-
155- return [options.index(r) for r in results]
156-
157- def ui_question_yesno(self, text):
158- self.interface.show_progress_stop()
159- result = self.interface.show_radio(text, ["Yes", "No"])
160- return result == "Yes"
161-
162- def open_url(self, url):
163- self.interface.show_url(url)
164-
165-
166-class ApportPrompt(Plugin):
167-
168- # Default configuration filename
169- default_filename = Path(default="/etc/default/apport")
170-
171- # Default enabled state
172- default_enabled = Bool(required=False)
173-
174- # Default package if none is detected
175- default_package = String(required=False)
176-
177- # Filename where Submission ID is cached
178- submission_filename = Path(default="%(checkbox_data)s/submission")
179-
180- # Filename where System ID is cached
181- system_filename = Path(default="%(checkbox_data)s/system")
182-
183- def register(self, manager):
184- super(ApportPrompt, self).register(manager)
185-
186- self._submission_id = None
187- self._system_id = None
188-
189- for (rt, rh) in [
190- ("exchange-success", self.exchange_success),
191- ("report-submission_id", self.report_submission_id),
192- ("report-system_id", self.report_system_id)]:
193- self._manager.reactor.call_on(rt, rh)
194-
195- if not isinstance(ApportUserInterface, DummyUserInterface):
196- self._manager.reactor.call_on("gather", self.gather)
197- self._manager.reactor.call_on("prompt-test", self.prompt_test, 100)
198-
199- def gather(self):
200- if self.default_enabled is None:
201- value = check_output("unset enabled && . %s && echo ${enabled}"
202- % self.default_filename, shell=True, universal_newlines=True)
203- self.default_enabled = value.strip() == "1"
204-
205- def prompt_test(self, interface, test):
206- if not self.default_enabled:
207- return
208-
209- if test["status"] != FAIL:
210- return
211-
212- device = None
213- package = None
214- symptom = None
215-
216- # Give lowest priority to required packages
217- for resource in test.get("resources", []):
218- if "version" in resource:
219- package = resource["name"]
220- break
221-
222- # Give highest priority to required devices
223- for resource in test.get("resources", []):
224- if "bus" in resource:
225- category = resource["category"]
226- if category in CATEGORY_TO_PACKAGE:
227- package = CATEGORY_TO_PACKAGE[category]
228- break
229-
230- if category in CATEGORY_TO_SYMPTOM:
231- symptom = CATEGORY_TO_SYMPTOM[category]
232- break
233-
234- # Default to configuration
235- if not package:
236- package = self.default_package
237-
238- # Do not report a bug if no package nor symptom is defined
239- if not package and not symptom:
240- return
241-
242- if test.get("suite"):
243- failed_test_message = _("Test %(name)s failed.") % {
244- 'name': test["name"]}
245- else:
246- failed_test_message = _("Test %s failed.") % test["name"]
247- failed_test_message += "\n" + _("Do you want to report a bug?")
248-
249- response = interface.show_info(failed_test_message,
250- ["yes", "no"], "no")
251- if response == "no":
252- return
253-
254- # Determine corresponding device
255- for resource in test.get("resources", []):
256- if "bus" in resource:
257- device = resource["category"].lower()
258- break
259-
260- try:
261- options = ApportOptions(test, device, package, symptom)
262- apport_interface = ApportUserInterface(interface, options)
263- except ImportError as e:
264- interface.show_error(_("Is a package upgrade in process? Error: %s") % e)
265- return
266-
267- try:
268- if symptom and hasattr(apport_interface, "run_symptom"):
269- apport_interface.run_symptom()
270- else:
271- apport_interface.run_report_bug()
272- except SystemExit as e:
273- # In case of error, show_error already have been called
274- raise StopAllException
275-
276- def exchange_success(self, response):
277- for message, filename in [
278- (self._submission_id, self.submission_filename),
279- (self._system_id, self.system_filename)]:
280- try:
281- file = open(filename, "w")
282- try:
283- file.write(message)
284- finally:
285- file.close()
286- except IOError as e:
287- logging.info("Failed to write to file '%s': %d %s",
288- filename, e.errno, e.strerror)
289-
290- def report_submission_id(self, submission_id):
291- self._submission_id = submission_id
292-
293- def report_system_id(self, system_id):
294- self._system_id = system_id
295-
296-
297-factory = ApportPrompt
298
299=== modified file 'po/POTFILES.in'
300--- po/POTFILES.in 2012-09-19 22:09:38 +0000
301+++ po/POTFILES.in 2012-09-27 16:14:24 +0000
302@@ -53,7 +53,6 @@
303 checkbox_urwid/urwid_interface.py
304 checkbox_gtk/gtk_interface.py
305 checkbox/user_interface.py
306-plugins/apport_prompt.py
307 plugins/final_prompt.py
308 plugins/gather_prompt.py
309 plugins/intro_prompt.py

Subscribers

People subscribed via source and target branches