Code review comment for lp:~adeuring/launchpad/hwdb-class-udev-device-1

Revision history for this message
Abel Deuring (adeuring) wrote :

This branch adds some sanity checks for HWDB submission containing udev data (as sent by the HWDB client in Karmic), and it defines a new class UdevDevice, representing a device described by udev data. (The class is quite rudimentary at present.)

The idea of class UdevDevice is to "mangle" the raw data provided in a submission so that we cana populate the HWDB tables from this data. (See the base class BaseDevice and sibling class HALDevice for details.)

A new method SubmissionParser.checkUdevPciProperties() ensures that udev data for PCI devices have certain properties and that these properties have useful data, thus allowing class UdevDevice to make some assumptions about the data it is based on, for example, that the value of the property PCI_CLASS is an integer represented as a hexdecimal string.

SubmissionParser.checkConsistency() now calls checkConsistentUdevDeviceData(). The former method also assumed that the data for each submission contains a dictionary for data from HAL, which is no longer true, so some sanity checks specific for submissions with HAL data are now skipped for submissinos with udev data.

tests:

./bin/test -t test_hwdb_submission_parser
./bin/test -t test_hwdb_submission_processing

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/canonical/launchpad/scripts/hwdbsubmissions.py
  lib/canonical/launchpad/scripts/tests/test_hwdb_submission_parser.py
  lib/canonical/launchpad/scripts/tests/test_hwdb_submission_processing.py

== Pyflakes notices ==

lib/canonical/launchpad/scripts/hwdbsubmissions.py
    22: redefinition of unused 'etree' from line 20

lib/canonical/launchpad/scripts/tests/test_hwdb_submission_parser.py
    11: redefinition of unused 'etree' from line 9

== Pylint notices ==

lib/canonical/launchpad/scripts/hwdbsubmissions.py
    1160: [C0301] Line too long (79/78)
    20: [F0401] Unable to import 'xml.etree.cElementTree' (No module named etree)

lib/canonical/launchpad/scripts/tests/test_hwdb_submission_parser.py
    9: [F0401] Unable to import 'xml.etree.cElementTree' (No module named etree)

These etree-related complaints are not caused by the changes in this branch.

« Back to merge proposal