Merge ~pieq/bugit/+git/qabro:add-fwts-logs into bugit:master

Proposed by Pierre Equoy
Status: Merged
Approved by: Pierre Equoy
Approved revision: 5844c4f9ae6a8f0c53ff3278dc5dd477823c9be7
Merged at revision: 4090a540e0eb2298f27f0b7ee80d9b78bbc1521d
Proposed branch: ~pieq/bugit/+git/qabro:add-fwts-logs
Merge into: bugit:master
Diff against target: 144 lines (+54/-16)
5 files modified
dev/null (+0/-10)
qabro/__version__.py (+1/-1)
qabro/bug_assistant.py (+23/-2)
qabro/ui.py (+2/-1)
snap/snapcraft.yaml (+28/-2)
Reviewer Review Type Date Requested Status
Maciej Kisielewski (community) Approve
Review via email: mp+349789@code.launchpad.net

Description of the change

To test:

- build a snap out of it:
    snapcraft cleanbuild
- install in devmode:
    snap install qabro_0.7_amd64.snap --devmode
- launch on Launchpad Staging instance:
    APPORT_STAGING=1 qabro
- fill the proper info, and select "Firmware" as issue type (or at least, make sure there is a `hwe-firmware` tag)

→ this should create an issue with fwts logs attached

Tested on 18.04 desktop and UC16.

To post a comment you must log in.
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

I need some explanation why FWTS has to be built afresh when snapping.
Also one nitpick inline.

review: Needs Information
Revision history for this message
Pierre Equoy (pieq) wrote :

Thanks for the review, Maciek!

I added an answer to your reply below.

Revision history for this message
Sylvain Pineau (sylvain-pineau) wrote :

One possible way to avoid compiling fwts is to fetch the deb packages from their ppa using the deb plugin.

See how I initially included tpm2-tools 1.1 in plano classic:

https://git.launchpad.net/~plano-team/plano/+git/checkbox-plano-classic/tree/snap/snapcraft.yaml?id=95fc6f624ffa4ab2842a2c1f1ea0458e3ac26a59

Downside is that you'll be stuck with one hardcoded version of fwts.

Revision history for this message
Pierre Equoy (pieq) wrote :

I took into account Maciek's comment regarding

    _ = subprocess.call(...)

Otherwise, for now FWTS will be compiled when snapping qabro, unfortunately :S
(the reason is because qabro needs to support different archs, and the `source-type: deb` feature only works for single arch)

Revision history for this message
Maciej Kisielewski (kissiel) wrote :

LGTM, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/bin/oembugreport b/bin/oembugreport
0deleted file mode 1007550deleted file mode 100755
index 26bae6c..0000000
--- a/bin/oembugreport
+++ /dev/null
@@ -1,10 +0,0 @@
1#!/usr/bin/env python
2
3import os, sys
4import oembugreport
5
6if __name__ == '__main__':
7 if os.getenv('SUDO_USER'):
8 oembugreport.main()
9 else:
10 sys.exit("Please run this tool using sudo!")
diff --git a/qabro/__version__.py b/qabro/__version__.py
index 07c4cf5..f480065 100644
--- a/qabro/__version__.py
+++ b/qabro/__version__.py
@@ -1,5 +1,5 @@
1__title__ = 'qabro'1__title__ = 'qabro'
2__version__ = '0.6'2__version__ = '0.7dev'
3__description__ = 'Report bug information with attachments in Launchpad'3__description__ = 'Report bug information with attachments in Launchpad'
4__author__ = 'Pierre Equoy'4__author__ = 'Pierre Equoy'
5__author_email__ = 'pierre.equoy@canonical.com'5__author_email__ = 'pierre.equoy@canonical.com'
diff --git a/qabro/bug_assistant.py b/qabro/bug_assistant.py
index 127a69a..6cb741b 100644
--- a/qabro/bug_assistant.py
+++ b/qabro/bug_assistant.py
@@ -206,10 +206,12 @@ class AttachmentAssistant:
206 def run_attachment_methods(self):206 def run_attachment_methods(self):
207 """Runs the different attachment methods to add logs to the207 """Runs the different attachment methods to add logs to the
208 attachments dictionary."""208 attachments dictionary."""
209 if self.options.get('include_checkbox_session'):
210 self.attach_last_checkbox_session()
211 if self.options.get('include_fwts_logs'):
212 self.attach_fwts_logs()
209 self.attach_snaplist()213 self.attach_snaplist()
210 self.attach_sosreport()214 self.attach_sosreport()
211 if 'include_checkbox_session' in self.options and self.options['include_checkbox_session']:
212 self.attach_last_checkbox_session()
213215
214 def attach_sosreport(self):216 def attach_sosreport(self):
215 home_dir = os.getenv('HOME')217 home_dir = os.getenv('HOME')
@@ -281,6 +283,25 @@ class AttachmentAssistant:
281 else:283 else:
282 print('There does not seem to be any Checkbox session here...')284 print('There does not seem to be any Checkbox session here...')
283285
286 def attach_fwts_logs(self):
287 p = os.getenv("PATH")
288 lp = os.getenv("LD_LIBRARY_PATH")
289 logfile = os.path.expandvars("$HOME/fwts_results.log")
290 if p and lp:
291 print("Running FWTS...")
292 command = ["sudo", "env", "PATH={}".format(p),
293 "LD_LIBRARY_PATH={}".format(lp), "fwts", "-q", "-r",
294 logfile, "version", "cpufreq", "maxfreq", "msr", "mtrr",
295 "nx", "virt", "aspm", "dmicheck", "apicedge", "klog",
296 "oops", "esrt", "uefibootpath", "uefirtvariable",
297 "uefirttime", "uefirtmisc", "--acpitests", "--log-level=high"]
298 subprocess.call(command)
299 with open(logfile) as f:
300 content = f.read()
301 self.attachments['fwts_results.log'] = content
302 else:
303 print("$PATH and/or $LD_LIBRARY_PATH missing. Cannot run FWTS!")
304
284 @classmethod305 @classmethod
285 def get_standard_info(cls):306 def get_standard_info(cls):
286 """Gather standard information that should be present in all bugs."""307 """Gather standard information that should be present in all bugs."""
diff --git a/qabro/ui.py b/qabro/ui.py
index cdf2ec5..b87ace4 100644
--- a/qabro/ui.py
+++ b/qabro/ui.py
@@ -127,7 +127,8 @@ class ReportScreen:
127127
128 def report(self):128 def report(self):
129 tags = self._tags.base_widget.text129 tags = self._tags.base_widget.text
130 options = {'include_checkbox_session': 'checkbox' in tags}130 options = {'include_checkbox_session': 'checkbox' in tags,
131 'include_fwts_logs': 'hwe-firmware' in tags}
131 return BugReport(title=self._title.base_widget.text,132 return BugReport(title=self._title.base_widget.text,
132 description=self._description.base_widget.text,133 description=self._description.base_widget.text,
133 project=self._project.base_widget.text,134 project=self._project.base_widget.text,
diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
index e75daf8..de2f615 100644
--- a/snap/snapcraft.yaml
+++ b/snap/snapcraft.yaml
@@ -1,5 +1,5 @@
1name: qabro1name: qabro
2version: '0.6'2version: '0.7dev'
3summary: QA OEM bug reporting tool3summary: QA OEM bug reporting tool
4description: |4description: |
5 Tool to generate a Launchpad bug report and attach useful logs (using5 Tool to generate a Launchpad bug report and attach useful logs (using
@@ -11,10 +11,17 @@ confinement: strict # use 'strict' once you have the right plugs and slots
11apps:11apps:
12 qabro:12 qabro:
13 command: qabro13 command: qabro
14 environment:
15 LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/lib/fwts
1416
15 sosreport:17 sosreport:
16 command: sosreport18 command: sosreport
1719
20 fwts:
21 command: bin/fwts
22 environment:
23 LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/lib/fwts
24
18parts:25parts:
19 qabro:26 qabro:
20 plugin: python27 plugin: python
@@ -39,8 +46,27 @@ parts:
39 - libc646 - libc6
40 - libdb5.347 - libdb5.3
4148
49 fwts:
50 plugin: autotools
51 source: git://kernel.ubuntu.com/hwe/fwts
52 source-tag: V18.06.02
53 stage-packages:
54 - libfdt1
55 build-packages:
56 - gcc
57 - make
58 - autoconf
59 - automake
60 - libtool
61 - libjson-c-dev
62 - flex
63 - bison
64 - dh-autoreconf
65 - libglib2.0-dev
66 - libfdt-dev
67
42 config:68 config:
43 source: config/
44 plugin: dump69 plugin: dump
70 source: config/
45 organize:71 organize:
46 '*.conf': etc/72 '*.conf': etc/

Subscribers

People subscribed via source and target branches

to all changes: