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
1diff --git a/bin/oembugreport b/bin/oembugreport
2deleted file mode 100755
3index 26bae6c..0000000
4--- a/bin/oembugreport
5+++ /dev/null
6@@ -1,10 +0,0 @@
7-#!/usr/bin/env python
8-
9-import os, sys
10-import oembugreport
11-
12-if __name__ == '__main__':
13- if os.getenv('SUDO_USER'):
14- oembugreport.main()
15- else:
16- sys.exit("Please run this tool using sudo!")
17diff --git a/qabro/__version__.py b/qabro/__version__.py
18index 07c4cf5..f480065 100644
19--- a/qabro/__version__.py
20+++ b/qabro/__version__.py
21@@ -1,5 +1,5 @@
22 __title__ = 'qabro'
23-__version__ = '0.6'
24+__version__ = '0.7dev'
25 __description__ = 'Report bug information with attachments in Launchpad'
26 __author__ = 'Pierre Equoy'
27 __author_email__ = 'pierre.equoy@canonical.com'
28diff --git a/qabro/bug_assistant.py b/qabro/bug_assistant.py
29index 127a69a..6cb741b 100644
30--- a/qabro/bug_assistant.py
31+++ b/qabro/bug_assistant.py
32@@ -206,10 +206,12 @@ class AttachmentAssistant:
33 def run_attachment_methods(self):
34 """Runs the different attachment methods to add logs to the
35 attachments dictionary."""
36+ if self.options.get('include_checkbox_session'):
37+ self.attach_last_checkbox_session()
38+ if self.options.get('include_fwts_logs'):
39+ self.attach_fwts_logs()
40 self.attach_snaplist()
41 self.attach_sosreport()
42- if 'include_checkbox_session' in self.options and self.options['include_checkbox_session']:
43- self.attach_last_checkbox_session()
44
45 def attach_sosreport(self):
46 home_dir = os.getenv('HOME')
47@@ -281,6 +283,25 @@ class AttachmentAssistant:
48 else:
49 print('There does not seem to be any Checkbox session here...')
50
51+ def attach_fwts_logs(self):
52+ p = os.getenv("PATH")
53+ lp = os.getenv("LD_LIBRARY_PATH")
54+ logfile = os.path.expandvars("$HOME/fwts_results.log")
55+ if p and lp:
56+ print("Running FWTS...")
57+ command = ["sudo", "env", "PATH={}".format(p),
58+ "LD_LIBRARY_PATH={}".format(lp), "fwts", "-q", "-r",
59+ logfile, "version", "cpufreq", "maxfreq", "msr", "mtrr",
60+ "nx", "virt", "aspm", "dmicheck", "apicedge", "klog",
61+ "oops", "esrt", "uefibootpath", "uefirtvariable",
62+ "uefirttime", "uefirtmisc", "--acpitests", "--log-level=high"]
63+ subprocess.call(command)
64+ with open(logfile) as f:
65+ content = f.read()
66+ self.attachments['fwts_results.log'] = content
67+ else:
68+ print("$PATH and/or $LD_LIBRARY_PATH missing. Cannot run FWTS!")
69+
70 @classmethod
71 def get_standard_info(cls):
72 """Gather standard information that should be present in all bugs."""
73diff --git a/qabro/ui.py b/qabro/ui.py
74index cdf2ec5..b87ace4 100644
75--- a/qabro/ui.py
76+++ b/qabro/ui.py
77@@ -127,7 +127,8 @@ class ReportScreen:
78
79 def report(self):
80 tags = self._tags.base_widget.text
81- options = {'include_checkbox_session': 'checkbox' in tags}
82+ options = {'include_checkbox_session': 'checkbox' in tags,
83+ 'include_fwts_logs': 'hwe-firmware' in tags}
84 return BugReport(title=self._title.base_widget.text,
85 description=self._description.base_widget.text,
86 project=self._project.base_widget.text,
87diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml
88index e75daf8..de2f615 100644
89--- a/snap/snapcraft.yaml
90+++ b/snap/snapcraft.yaml
91@@ -1,5 +1,5 @@
92 name: qabro
93-version: '0.6'
94+version: '0.7dev'
95 summary: QA OEM bug reporting tool
96 description: |
97 Tool to generate a Launchpad bug report and attach useful logs (using
98@@ -11,10 +11,17 @@ confinement: strict # use 'strict' once you have the right plugs and slots
99 apps:
100 qabro:
101 command: qabro
102+ environment:
103+ LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/lib/fwts
104
105 sosreport:
106 command: sosreport
107
108+ fwts:
109+ command: bin/fwts
110+ environment:
111+ LD_LIBRARY_PATH: $LD_LIBRARY_PATH:$SNAP/lib/fwts
112+
113 parts:
114 qabro:
115 plugin: python
116@@ -39,8 +46,27 @@ parts:
117 - libc6
118 - libdb5.3
119
120+ fwts:
121+ plugin: autotools
122+ source: git://kernel.ubuntu.com/hwe/fwts
123+ source-tag: V18.06.02
124+ stage-packages:
125+ - libfdt1
126+ build-packages:
127+ - gcc
128+ - make
129+ - autoconf
130+ - automake
131+ - libtool
132+ - libjson-c-dev
133+ - flex
134+ - bison
135+ - dh-autoreconf
136+ - libglib2.0-dev
137+ - libfdt-dev
138+
139 config:
140- source: config/
141 plugin: dump
142+ source: config/
143 organize:
144 '*.conf': etc/

Subscribers

People subscribed via source and target branches

to all changes: