Merge lp:~roadmr/checkbox/modalias-parsing into lp:checkbox

Proposed by Daniel Manrique
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 3760
Merged at revision: 3759
Proposed branch: lp:~roadmr/checkbox/modalias-parsing
Merge into: lp:checkbox
Diff against target: 66 lines (+40/-0)
3 files modified
checkbox-support/checkbox_support/parsers/submission.py (+2/-0)
checkbox-support/checkbox_support/parsers/tests/fixtures/submission_packages_modaliases.xml (+20/-0)
checkbox-support/checkbox_support/parsers/tests/test_submission.py (+18/-0)
To merge this branch: bzr merge lp:~roadmr/checkbox/modalias-parsing
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+258498@code.launchpad.net

Commit message

checkbox-support:parsers:submission: add modalias info to package elements

Description of the change

checkbox-support:parsers:submission: add modalias info to package elements

A "modalias" element is added to the package's data dict if the xml
element contains that property, taken from the package's Modalias Debian
control field.

This actually processes the new "modalias" data from package_resource at submission parsing time. As an example, when parsing, a package without modaliases looks like this:

            {
                "name": "oem-brightness-workaround-1076262",
                "version": "1stella4"
            },

One with modaliases is like this:
            {
                "modalias": "hwe(pci:*)",
                "name": "oem-all-disablemmc-1405558-dkms",
                "version": "1oem2"
            },

Users of the SubmissionParser such as hexr will receive this data and are then responsible for processing it suitably.

This shouldn't affect hexr until we actually add awareness of this key, because currently it only pays attention to the name and version keys of the dictionary, any additions are ignored at the moment.

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

16:31 <@zyga> roadmr: http://bazaar.launchpad.net/~roadmr/checkbox/modalias-parsing/revision/3760
16:31 <@zyga> roadmr: how is package_version related to the modalias?
16:33 < roadmr> zyga: good question... I think this is designed to express a package (identified by name) and convey that we may have different versions of the same package
16:33 < roadmr> zyga: this reflects how it's stored in hexr's database where there's a package table with just the names, and a packageversion intermediate table with versions and a link to packages
16:33 < roadmr> zyga: in here, a particular package version may contain a specific set of modaliases for which the package provides drivers or functionality
16:34 < roadmr> zyga: this is somewhat tied to version because conceivably a newer version of the same package may have a different set of modaliases
16:34 < roadmr> zyga: but mostly I think it's a "historical naming" convention, I would just call it "package" and it would have "name", "version" and "modalias" attributes
16:48 <@zyga> roadmr: ok, thanks
16:48 < roadmr> zyga: np, thanks for the review :D

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-support/checkbox_support/parsers/submission.py'
2--- checkbox-support/checkbox_support/parsers/submission.py 2014-11-11 05:47:37 +0000
3+++ checkbox-support/checkbox_support/parsers/submission.py 2015-05-07 13:42:53 +0000
4@@ -589,6 +589,8 @@
5 "name": package["name"],
6 "version": package["properties"]["version"],
7 }
8+ if 'modalias' in package["properties"]:
9+ package_version['modalias'] = package['properties']['modalias']
10 self.dispatcher.publishEvent("package_version", package_version)
11
12 def addPackageVersion(self, test_run, package_version):
13
14=== added file 'checkbox-support/checkbox_support/parsers/tests/fixtures/submission_packages_modaliases.xml'
15--- checkbox-support/checkbox_support/parsers/tests/fixtures/submission_packages_modaliases.xml 1970-01-01 00:00:00 +0000
16+++ checkbox-support/checkbox_support/parsers/tests/fixtures/submission_packages_modaliases.xml 2015-05-07 13:42:53 +0000
17@@ -0,0 +1,20 @@
18+<?xml version="1.0" ?>
19+<system version="1.0">
20+<software>
21+<packages>
22+<package id="4" name="accountsservice">
23+<property name="description" type="str">amd64</property>
24+<property name="desired" type="str">Install</property>
25+<property name="status" type="str">Installed</property>
26+<property name="version" type="str">0.6.21-6ubuntu2</property>
27+</package>
28+<package id="5" name="a_package_with_modaliases">
29+<property name="description" type="str">amd64</property>
30+<property name="desired" type="str">Install</property>
31+<property name="status" type="str">Installed</property>
32+<property name="version" type="str">1.0-1-ubuntu1~bogus</property>
33+<property name="modalias" type="str">nvidia_340(pci:v000010DEd000005E7sv*sd00000595bc03sc*i*)</property>
34+</package>
35+</packages>
36+</software>
37+</system>
38
39=== modified file 'checkbox-support/checkbox_support/parsers/tests/test_submission.py'
40--- checkbox-support/checkbox_support/parsers/tests/test_submission.py 2014-05-20 18:54:24 +0000
41+++ checkbox-support/checkbox_support/parsers/tests/test_submission.py 2015-05-07 13:42:53 +0000
42@@ -184,6 +184,24 @@
43 self.assertEqual(package_version["name"], "accountsservice")
44 self.assertEqual(package_version["version"], "0.6.21-6ubuntu2")
45
46+ def test_package_modaliases(self):
47+ """
48+ Modaliases information is in the packages element if a package
49+ contains it.
50+ """
51+ result = self.getResult("submission_packages_modaliases.xml")
52+ self.assertTrue("package_versions" in result)
53+ self.assertEqual(len(result["package_versions"]), 2)
54+
55+ package = result["package_versions"][0]
56+ self.assertEqual(package["name"], "accountsservice")
57+ self.assertNotIn("modalias", package)
58+
59+ package = result["package_versions"][1]
60+ self.assertEqual(package["name"], "a_package_with_modaliases")
61+ self.assertEqual(package["modalias"], "nvidia_340(pci:v000010DEd000005E7sv*sd00000595bc03sc*i*)")
62+ self.assertEqual(package["version"], "1.0-1-ubuntu1~bogus")
63+
64 def test_test_results(self):
65 """Test results are in the questions element."""
66 result = self.getResult("submission_questions.xml")

Subscribers

People subscribed via source and target branches