Code review comment for lp:~adeuring/launchpad/hwdb-build-udev-device-list-2

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

This branch renames the method SubmissionParser.buildDeviceList() to SubmissionParser.buildHalDeviceList(), and it adds a new method SubmissionParser.buildDeviceList(), which calls buildHalDeviceList() and buildUdevDeviceList().

HWDB Submissions coming from the clinet in Karmic do no longer contain data gathered by HAL; instead, the contain udev data.

The udev data looks quite different and is thus processed differently. Single devices found in submissions with HAL data are represented by instances of class HalDevice, while devices from submissions with udev data are represented by instances of class UdevDevice.

One step in the proeccsing of a HWDB submission is the creation of instances of HalDevice/Udevdevice, which is done in the methods buildHalDeviceList() and buildUdevDeviceList(), respectively.

Depending on the type of the submission, the "right" method from these two should be called, which is done in buildDeviceList().

SuubmissionParser.buildDveiceList makes the implicit assumption that parsed_data['hardware'] has either an item ith the key 'hal' or an item with the key 'udev' (needed in buldUdevDeviceList()), but not both. This is guaranteed by an earlier stage of submission processing.

A second change is mostly mechanical, but causes half of all diff lines: I renames the property SubmissisonParser.hal_devices to SubmissionParser.devices, so that it fits a bit better for submissions containg udev data.

The interesting part of the diff are the first 100 line and the last 20 lines; the remaining part of the diff just reflects the name change SubmissisonParser.hal_devices -> SubmissionParser.devices; I also changed the calls of parser.buildDeviceList() to parser.buildHalDeviceList() in those tests that are specific for HAL data.

« Back to merge proposal