launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25236
[Merge] ~cjwatson/launchpad:remove-hwdb-bugs into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:remove-hwdb-bugs into launchpad:master.
Commit message:
Remove hardware DB integration from lp.bugs
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/389982
We're in the process of removing the disused hardware database. Remove the ability to link/unlink hardware submissions to/from bugs, the ability to get hardware submissions for existing bugs, and the various bug search parameters related to the hardware database.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-hwdb-bugs into launchpad:master.
diff --git a/lib/lp/_schema_circular_imports.py b/lib/lp/_schema_circular_imports.py
index 7e0a047..cb19d0c 100644
--- a/lib/lp/_schema_circular_imports.py
+++ b/lib/lp/_schema_circular_imports.py
@@ -85,7 +85,6 @@ from lp.code.interfaces.sourcepackagerecipebuild import (
ISourcePackageRecipeBuild,
)
from lp.hardwaredb.interfaces.hwdb import (
- HWBus,
IHWDBApplication,
IHWDevice,
IHWDeviceClass,
@@ -162,7 +161,6 @@ from lp.services.messages.interfaces.message import (
IUserToUserEmail,
)
from lp.services.webservice.apihelpers import (
- patch_choice_parameter_type,
patch_collection_property,
patch_collection_return_type,
patch_entry_explicit_version,
@@ -292,19 +290,12 @@ patch_plain_parameter_type(IHasCodeImports, 'newCodeImport', 'owner', IPerson)
# IBugTask
patch_collection_return_type(IBugTask, 'findSimilarBugs', IBug)
-patch_plain_parameter_type(
- IBug, 'linkHWSubmission', 'submission', IHWSubmission)
-patch_plain_parameter_type(
- IBug, 'unlinkHWSubmission', 'submission', IHWSubmission)
-patch_collection_return_type(IBug, 'getHWSubmissions', IHWSubmission)
patch_list_parameter_type(
IBug, 'getNominations', 'nominations', Reference(schema=IBugNomination))
patch_entry_return_type(IBug, 'addNomination', IBugNomination)
patch_entry_return_type(IBug, 'getNominationFor', IBugNomination)
patch_collection_return_type(IBug, 'getNominations', IBugNomination)
-patch_choice_parameter_type(IHasBugs, 'searchTasks', 'hardware_bus', HWBus)
-
patch_reference_property(
IPreviewDiff, 'branch_merge_proposal', IBranchMergeProposal)
@@ -778,11 +769,11 @@ patch_operations_explicit_version(
patch_entry_explicit_version(IBug, 'beta')
patch_operations_explicit_version(
IBug, 'beta', "addAttachment", "addNomination", "addTask", "addWatch",
- "canBeNominatedFor", "getHWSubmissions", "getNominationFor",
+ "canBeNominatedFor", "getNominationFor",
"getNominations", "isExpirable", "isUserAffected",
- "linkCVE", "linkHWSubmission", "markAsDuplicate",
+ "linkCVE", "markAsDuplicate",
"markUserAffected", "newMessage", "setCommentVisibility", "setPrivate",
- "setSecurityRelated", "subscribe", "unlinkCVE", "unlinkHWSubmission",
+ "setSecurityRelated", "subscribe", "unlinkCVE",
"unsubscribe", "unsubscribeFromDupes")
# IBugActivity
diff --git a/lib/lp/bugs/doc/bug.txt b/lib/lp/bugs/doc/bug.txt
index 9cdfd3b..5010450 100644
--- a/lib/lp/bugs/doc/bug.txt
+++ b/lib/lp/bugs/doc/bug.txt
@@ -1356,59 +1356,6 @@ altered by setting its limit parameter, which defaults to 10.
New bug 0
-Links to HWDB submissions
--------------------------
-
-We can link a HWDB submission to a bug, indicating that the
-submission contains information that could help developers
-fix the bug.
-
- >>> from lp.hardwaredb.interfaces.hwdb import IHWSubmissionSet
- >>> submission = getUtility(IHWSubmissionSet).getBySubmissionKey(
- ... 'sample-submission')
- >>> test_bug.linkHWSubmission(submission)
-
-Bug.getHWSubmissions() returns the HWDB submissions linked to a bug.
-
- >>> for submission in test_bug.getHWSubmissions():
- ... print(submission.submission_key)
- sample-submission
-
-Private submissions are only included if the current user is an admin
-or the owner of a private submission.
-
- >>> private_submission = factory.makeHWSubmission(
- ... emailaddress='test@xxxxxxxxxxxxx', private=True,
- ... submission_key='private-submission')
- >>> test_bug.linkHWSubmission(private_submission)
- >>> for submission in test_bug.getHWSubmissions(user=sample_person):
- ... print(submission.submission_key)
- private-submission
- sample-submission
-
- >>> for submission in test_bug.getHWSubmissions(user=foobar):
- ... print(submission.submission_key)
- private-submission
- sample-submission
-
-Other persons do not see Sample Person's private submission.
-
- >>> no_priv = personset.getByEmail('no-priv@xxxxxxxxxxxxx')
- >>> for submission in test_bug.getHWSubmissions(user=no_priv):
- ... print(submission.submission_key)
- sample-submission
-
- >>> for submission in test_bug.getHWSubmissions():
- ... print(submission.submission_key)
- sample-submission
-
-We can also delete links between a HWDB submission and a bug.
-
- >>> test_bug.unlinkHWSubmission(submission)
- >>> print(test_bug.getHWSubmissions().count())
- 0
-
-
Discovering subscription types
------------------------------
diff --git a/lib/lp/bugs/doc/bugtask-search.txt b/lib/lp/bugs/doc/bugtask-search.txt
index f733086..750b3c5 100644
--- a/lib/lp/bugs/doc/bugtask-search.txt
+++ b/lib/lp/bugs/doc/bugtask-search.txt
@@ -141,170 +141,6 @@ We can file a bug against it and see that show up in a search:
1
-== Searching for bugs related to hardware ==
-
-We can search for bugs which are related to a given hardware device or
-a given driver.
-
-We can search for bugs whose reporters own a given device. A device
-must be specified by a bus as enumerated by HWBus, a vendor ID and a
-product ID. If we search for bugs related to the PCI device (0x10de,
-0x0455), which appears in a HWDB submission from Sample Person, bugs
-reported by them will be returned.
-
- >>> from lp.hardwaredb.interfaces.hwdb import HWBus
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- ... hardware_product_id='0x0455', hardware_owner_is_bug_reporter=True)
- >>> for bugtask in ubuntu.searchTasks(search_params):
- ... print(bugtask.bug.title)
- Firefox does not support SVG
- Blackhole Trash folder
-
-If one of the parameters bus, vendor ID or prodct ID is missing,
-the query is not limited to any devices. In other words, we get
-the same result as if we would not have specified any hardware
-related parameters.
-
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- ... hardware_owner_is_bug_reporter=True)
- >>> for bugtask in ubuntu.searchTasks(search_params):
- ... print(bugtask.bug.title)
- Firefox does not support SVG
- Thunderbird crashes
- another test bug
- Blackhole Trash folder
- Bug to be fixed in trunk
-
-Similary, we can search for device drivers appearing in HWDB submissions
-of a bug reporter.
-
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_driver_name='ehci_hcd',
- ... hardware_owner_is_bug_reporter=True)
- >>> for bugtask in ubuntu.searchTasks(search_params):
- ... print(bugtask.bug.id, bugtask.bug.owner.displayname)
- 1 Sample Person
- 2 Sample Person
-
-We can additionally specify a packge name.
-
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_driver_name='ehci_hcd',
- ... hardware_driver_package_name='linux-image-2.6.24-19-generic',
- ... hardware_owner_is_bug_reporter=True)
- >>> for bugtask in ubuntu.searchTasks(search_params):
- ... print(bugtask.bug.id, bugtask.bug.owner.displayname)
- 1 Sample Person
- 2 Sample Person
-
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_driver_name='ehci_hcd',
- ... hardware_driver_package_name='linux-image',
- ... hardware_owner_is_bug_reporter=True)
- >>> ubuntu.searchTasks(search_params).count()
- 0
-
-If we specify a driver and a device, we'll get those bugs whose owners
-use the given device together with the given driver.
-
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- ... hardware_product_id='0x0455', hardware_driver_name='ehci_hcd',
- ... hardware_owner_is_bug_reporter=True)
- >>> for bugtask in ubuntu.searchTasks(search_params):
- ... print(bugtask.bug.id, bugtask.bug.owner.displayname)
- 1 Sample Person
- 2 Sample Person
-
-The PCI device (0x10de, 0x0455) is not controlled in any HWDB submission
-by the sd driver, so we'll get an empty result set for this query.
-
- >>> from lp.registry.interfaces.product import IProductSet
- >>> firefox = getUtility(IProductSet).getByName('firefox')
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- ... hardware_product_id='0x0455', hardware_driver_name='sd',
- ... hardware_owner_is_bug_reporter=True)
- >>> firefox.searchTasks(search_params).count()
- 0
-
-We can also search for device owners which are subscribed to a bug.
-
- >>> sample_person = getUtility(IPersonSet).getByEmail(
- ... 'test@xxxxxxxxxxxxx')
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- ... hardware_product_id='0x0455',
- ... hardware_owner_is_subscribed_to_bug=True)
- >>> for bugtask in ubuntu.searchTasks(search_params):
- ... print(bugtask.bug.id, bugtask.bug.isSubscribed(sample_person))
- 1 True
- 9 True
-
-And we can search for device owners who are affected by a bug.
-
- >>> bug_ten = getUtility(IBugSet).get(10)
- >>> bug_ten.markUserAffected(sample_person, affected=True)
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- ... hardware_product_id='0x0455',
- ... hardware_owner_is_affected_by_bug=True)
- >>> for bugtask in ubuntu.searchTasks(search_params):
- ... print(bugtask.bug.id, bugtask.bug.isUserAffected(sample_person))
- 10 True
-
-Finally, we can search for who bugs which are directly linked to
-a HWDB submission, where the submission contains the given device or
-driver.
-
- >>> from lp.hardwaredb.interfaces.hwdb import IHWSubmissionSet
- >>> hw_submission = getUtility(IHWSubmissionSet).getBySubmissionKey(
- ... 'sample-submission')
- >>> bug.linkHWSubmission(hw_submission)
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- ... hardware_product_id='0x0455', hardware_is_linked_to_bug=True)
- >>> [bug.default_bugtask] == list(ubuntu.searchTasks(search_params))
- True
-
-If a device appears in a private submission, related bugs are shown
-only if the user running the request is the owner of the submission
-or an admin.
-
- >>> naked_hw_submission = removeSecurityProxy(hw_submission)
- >>> naked_hw_submission.private = True
- >>> search_params = BugTaskSearchParams(
- ... user=sample_person, hardware_bus=HWBus.PCI,
- ... hardware_vendor_id='0x10de', hardware_product_id='0x0455',
- ... hardware_is_linked_to_bug=True)
- >>> [bug.default_bugtask] == list(ubuntu.searchTasks(search_params))
- True
-
- >>> foo_bar = getUtility(IPersonSet).getByEmail('foo.bar@xxxxxxxxxxxxx')
- >>> search_params = BugTaskSearchParams(
- ... user=foo_bar, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- ... hardware_product_id='0x0455', hardware_is_linked_to_bug=True)
- >>> [bug.default_bugtask] == list(ubuntu.searchTasks(search_params))
- True
-
-Other users cannot see that a bug is related to a device from a
-private submission.
-
- >>> search_params = BugTaskSearchParams(
- ... user=no_priv, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- ... hardware_product_id='0x0455', hardware_is_linked_to_bug=True)
- >>> ubuntu.searchTasks(search_params).count()
- 0
-
- >>> search_params = BugTaskSearchParams(
- ... user=None, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- ... hardware_product_id='0x0455', hardware_is_linked_to_bug=True)
- >>> ubuntu.searchTasks(search_params).count()
- 0
-
-
== Ordering search results ==
The result returned by bugtask searches can come sorted by a specified order
diff --git a/lib/lp/bugs/interfaces/bug.py b/lib/lp/bugs/interfaces/bug.py
index 74def4b..4c14118 100644
--- a/lib/lp/bugs/interfaces/bug.py
+++ b/lib/lp/bugs/interfaces/bug.py
@@ -613,20 +613,6 @@ class IBugView(Interface):
"""
- @call_with(user=REQUEST_USER)
- @operation_returns_collection_of(Interface)
- @export_read_operation()
- def getHWSubmissions(user=None):
- """Return HWDB submissions linked to this bug.
-
- :return: A sequence of HWDB submissions linked to this bug.
- :param user: The user making the request.
-
- Only those submissions are returned which the user can access.
- Public submissions are always included; private submisisons only
- if the user is the owner or an admin.
- """
-
@operation_parameters(
days_old=Int(
title=_('Number of days of inactivity for which to check.'),
@@ -883,20 +869,6 @@ class IBugAppend(Interface):
:who: The `IPerson` who is making the change.
"""
- @operation_parameters(
- submission=Reference(
- Interface, title=_('A HWDB submission'), required=True))
- @export_write_operation()
- def linkHWSubmission(submission):
- """Link a `HWSubmission` to this bug."""
-
- @operation_parameters(
- submission=Reference(
- Interface, title=_('A HWDB submission'), required=True))
- @export_write_operation()
- def unlinkHWSubmission(submission):
- """Remove a link to a `HWSubmission`."""
-
def linkMessage(message, bugwatch=None, user=None,
remote_comment_id=None):
"""Add a comment to this bug.
diff --git a/lib/lp/bugs/interfaces/bugtarget.py b/lib/lp/bugs/interfaces/bugtarget.py
index f944788..9951a34 100644
--- a/lib/lp/bugs/interfaces/bugtarget.py
+++ b/lib/lp/bugs/interfaces/bugtarget.py
@@ -20,7 +20,6 @@ __all__ = [
]
-from lazr.enum import DBEnumeratedType
from lazr.restful.declarations import (
call_with,
export_read_operation,
@@ -46,7 +45,6 @@ from zope.schema import (
List,
Object,
Text,
- TextLine,
)
from lp import _
@@ -98,74 +96,6 @@ search_tasks_params_common = {
"component": copy_field(IBugTaskSearch['component']),
"nominated_for": Reference(schema=Interface),
"has_no_package": copy_field(IBugTaskSearch['has_no_package']),
- "hardware_bus": Choice(
- title=_(u"The bus of a hardware device related to a bug"),
- # The vocabulary should be HWBus; this is fixed in
- # _schema_circular_imports to avoid circular imports.
- vocabulary=DBEnumeratedType, required=False),
- "hardware_vendor_id": TextLine(
- title=_(
- u"The vendor ID of a hardware device related to a bug."),
- description=_(
- u"Allowed values of the vendor ID depend on the bus of the "
- "device.\n\n"
- "Vendor IDs of PCI, PCCard and USB devices are hexadecimal "
- "string representations of 16 bit integers in the format "
- "'0x01ab': The prefix '0x', followed by exactly 4 digits; "
- "where a digit is one of the characters 0..9, a..f. The "
- "characters A..F are not allowed.\n\n"
- "SCSI vendor IDs are strings with exactly 8 characters. "
- "Shorter names are right-padded with space (0x20) characters."
- "\n\n"
- "IDs for other buses may be arbitrary strings."),
- required=False),
- "hardware_product_id": TextLine(
- title=_(
- u"The product ID of a hardware device related to a bug."),
- description=_(
- u"Allowed values of the product ID depend on the bus of the "
- "device.\n\n"
- "Product IDs of PCI, PCCard and USB devices are hexadecimal "
- "string representations of 16 bit integers in the format "
- "'0x01ab': The prefix '0x', followed by exactly 4 digits; "
- "where a digit is one of the characters 0..9, a..f. The "
- "characters A..F are not allowed.\n\n"
- "SCSI product IDs are strings with exactly 16 characters. "
- "Shorter names are right-padded with space (0x20) characters."
- "\n\n"
- "IDs for other buses may be arbitrary strings."),
- required=False),
- "hardware_driver_name": TextLine(
- title=_(
- u"The driver controlling a hardware device related to a "
- "bug."),
- required=False),
- "hardware_driver_package_name": TextLine(
- title=_(
- u"The package of the driver which controls a hardware "
- "device related to a bug."),
- required=False),
- "hardware_owner_is_bug_reporter": Bool(
- title=_(
- u"Search for bugs reported by people who own the given "
- "device or who use the given hardware driver."),
- required=False),
- "hardware_owner_is_affected_by_bug": Bool(
- title=_(
- u"Search for bugs where people affected by a bug own the "
- "given device or use the given hardware driver."),
- required=False),
- "hardware_owner_is_subscribed_to_bug": Bool(
- title=_(
- u"Search for bugs where a bug subscriber owns the "
- "given device or uses the given hardware driver."),
- required=False),
- "hardware_is_linked_to_bug": Bool(
- title=_(
- u"Search for bugs which are linked to hardware reports "
- "which contain the given device or whcih contain a device"
- "controlled by the given driver."),
- required=False),
"linked_branches": Choice(
title=_(
u"Search for bugs that are linked to branches or for bugs "
@@ -253,14 +183,7 @@ class IHasBugs(Interface):
omit_duplicates=True, omit_targeted=None,
status_upstream=None, milestone=None, component=None,
nominated_for=None, sourcepackagename=None,
- has_no_package=None, hardware_bus=None,
- hardware_vendor_id=None, hardware_product_id=None,
- hardware_driver_name=None,
- hardware_driver_package_name=None,
- hardware_owner_is_bug_reporter=None,
- hardware_owner_is_affected_by_bug=False,
- hardware_owner_is_subscribed_to_bug=False,
- hardware_is_linked_to_bug=False, linked_branches=None,
+ has_no_package=None, linked_branches=None,
linked_blueprints=None, structural_subscriber=None,
modified_since=None, created_since=None,
created_before=None, information_type=None):
@@ -272,14 +195,6 @@ class IHasBugs(Interface):
Note: milestone is currently ignored for all IBugTargets
except IProduct.
-
- In order to search bugs that are related to a given hardware
- device, you must specify the bus, the vendor ID, the product
- ID of the device and set at least one of
- hardware_owner_is_bug_reporter,
- hardware_owner_is_affected_by_bug,
- hardware_owner_is_subscribed_to_bug,
- hardware_is_linked_to_bug to True.
"""
def getBugTaskWeightFunction():
diff --git a/lib/lp/bugs/interfaces/bugtasksearch.py b/lib/lp/bugs/interfaces/bugtasksearch.py
index fb9a950..736c5e1 100644
--- a/lib/lp/bugs/interfaces/bugtasksearch.py
+++ b/lib/lp/bugs/interfaces/bugtasksearch.py
@@ -166,13 +166,6 @@ class BugTaskSearchParams:
has_cve=False, bug_supervisor=None, bug_reporter=None,
nominated_for=None, bug_commenter=None, omit_targeted=False,
date_closed=None, affected_user=None, affects_me=False,
- hardware_bus=None, hardware_vendor_id=None,
- hardware_product_id=None, hardware_driver_name=None,
- hardware_driver_package_name=None,
- hardware_owner_is_bug_reporter=None,
- hardware_owner_is_affected_by_bug=False,
- hardware_owner_is_subscribed_to_bug=False,
- hardware_is_linked_to_bug=False,
linked_branches=None, linked_merge_proposals=None,
linked_blueprints=None,
structural_subscriber=None, modified_since=None,
@@ -211,17 +204,6 @@ class BugTaskSearchParams:
self.date_closed = date_closed
self.affected_user = affected_user
self.affects_me = affects_me
- self.hardware_bus = hardware_bus
- self.hardware_vendor_id = hardware_vendor_id
- self.hardware_product_id = hardware_product_id
- self.hardware_driver_name = hardware_driver_name
- self.hardware_driver_package_name = hardware_driver_package_name
- self.hardware_owner_is_bug_reporter = hardware_owner_is_bug_reporter
- self.hardware_owner_is_affected_by_bug = (
- hardware_owner_is_affected_by_bug)
- self.hardware_owner_is_subscribed_to_bug = (
- hardware_owner_is_subscribed_to_bug)
- self.hardware_is_linked_to_bug = hardware_is_linked_to_bug
self.linked_branches = linked_branches
self.linked_merge_proposals = linked_merge_proposals
self.linked_blueprints = linked_blueprints
@@ -376,14 +358,7 @@ class BugTaskSearchParams:
omit_duplicates=True, omit_targeted=None,
status_upstream=None, milestone=None, component=None,
nominated_for=None, sourcepackagename=None,
- has_no_package=None, hardware_bus=None,
- hardware_vendor_id=None, hardware_product_id=None,
- hardware_driver_name=None,
- hardware_driver_package_name=None,
- hardware_owner_is_bug_reporter=None,
- hardware_owner_is_affected_by_bug=False,
- hardware_owner_is_subscribed_to_bug=False,
- hardware_is_linked_to_bug=False, linked_branches=None,
+ has_no_package=None, linked_branches=None,
linked_merge_proposals=None, linked_blueprints=None,
structural_subscriber=None,
modified_since=None, created_since=None,
@@ -439,20 +414,6 @@ class BugTaskSearchParams:
search_params.sourcepackagename = NULL
search_params.nominated_for = nominated_for
- search_params.hardware_bus = hardware_bus
- search_params.hardware_vendor_id = hardware_vendor_id
- search_params.hardware_product_id = hardware_product_id
- search_params.hardware_driver_name = hardware_driver_name
- search_params.hardware_driver_package_name = (
- hardware_driver_package_name)
- search_params.hardware_owner_is_bug_reporter = (
- hardware_owner_is_bug_reporter)
- search_params.hardware_owner_is_affected_by_bug = (
- hardware_owner_is_affected_by_bug)
- search_params.hardware_owner_is_subscribed_to_bug = (
- hardware_owner_is_subscribed_to_bug)
- search_params.hardware_is_linked_to_bug = (
- hardware_is_linked_to_bug)
search_params.linked_branches = linked_branches
search_params.linked_merge_proposals = linked_merge_proposals
search_params.linked_blueprints = linked_blueprints
diff --git a/lib/lp/bugs/model/bug.py b/lib/lp/bugs/model/bug.py
index 3000056..9e0f03b 100644
--- a/lib/lp/bugs/model/bug.py
+++ b/lib/lp/bugs/model/bug.py
@@ -166,7 +166,6 @@ from lp.bugs.model.structuralsubscription import (
)
from lp.code.interfaces.branchcollection import IAllBranches
from lp.code.interfaces.gitcollection import IAllGitRepositories
-from lp.hardwaredb.interfaces.hwdb import IHWSubmissionBugSet
from lp.registry.errors import CannotChangeInformationType
from lp.registry.interfaces.accesspolicy import (
IAccessArtifactGrantSource,
@@ -2071,18 +2070,6 @@ class Bug(SQLBase, InformationTypeMixin):
return getUtility(IService, 'sharing').checkPillarAccess(
self.affected_pillars, InformationType.USERDATA, user)
- def linkHWSubmission(self, submission):
- """See `IBug`."""
- getUtility(IHWSubmissionBugSet).create(submission, self)
-
- def unlinkHWSubmission(self, submission):
- """See `IBug`."""
- getUtility(IHWSubmissionBugSet).remove(submission, self)
-
- def getHWSubmissions(self, user=None):
- """See `IBug`."""
- return getUtility(IHWSubmissionBugSet).submissionsForBug(self, user)
-
def personIsDirectSubscriber(self, person):
"""See `IBug`."""
if person in self._subscriber_cache:
diff --git a/lib/lp/bugs/model/bugtarget.py b/lib/lp/bugs/model/bugtarget.py
index 50d0f0a..377980e 100644
--- a/lib/lp/bugs/model/bugtarget.py
+++ b/lib/lp/bugs/model/bugtarget.py
@@ -54,14 +54,7 @@ class HasBugsBase:
omit_duplicates=True, omit_targeted=None,
status_upstream=None, milestone=None, component=None,
nominated_for=None, sourcepackagename=None,
- has_no_package=None, hardware_bus=None,
- hardware_vendor_id=None, hardware_product_id=None,
- hardware_driver_name=None,
- hardware_driver_package_name=None,
- hardware_owner_is_bug_reporter=None,
- hardware_owner_is_affected_by_bug=False,
- hardware_owner_is_subscribed_to_bug=False,
- hardware_is_linked_to_bug=False, linked_branches=None,
+ has_no_package=None, linked_branches=None,
linked_blueprints=None, modified_since=None,
created_since=None, created_before=None,
information_type=None):
diff --git a/lib/lp/bugs/model/bugtasksearch.py b/lib/lp/bugs/model/bugtasksearch.py
index 334cd6a..832dada 100644
--- a/lib/lp/bugs/model/bugtasksearch.py
+++ b/lib/lp/bugs/model/bugtasksearch.py
@@ -697,10 +697,6 @@ def _build_query(params):
extra_clauses.append(clause)
decorators.append(decorator)
- hw_clause = _build_hardware_related_clause(params)
- if hw_clause is not None:
- extra_clauses.append(hw_clause)
-
def make_branch_clause(branches=None):
where = [BugBranch.bug_id == BugTaskFlat.bug_id]
if branches is not None:
@@ -1004,75 +1000,6 @@ def _build_exclude_conjoined_clause(milestone):
return (join_tables, extra_clauses)
-def _build_hardware_related_clause(params):
- """Hardware related SQL expressions and tables for bugtask searches.
-
- :return: (tables, clauses) where clauses is a list of SQL expressions
- which limit a bugtask search to bugs related to a device or
- driver specified in search_params. If search_params contains no
- hardware related data, empty lists are returned.
- :param params: A `BugTaskSearchParams` instance.
-
- Device related WHERE clauses are returned if
- params.hardware_bus, params.hardware_vendor_id,
- params.hardware_product_id are all not None.
- """
- # Avoid cyclic imports.
- from lp.hardwaredb.model.hwdb import (
- HWSubmission, HWSubmissionBug, HWSubmissionDevice,
- _userCanAccessSubmissionStormClause,
- make_submission_device_statistics_clause)
-
- bus = params.hardware_bus
- vendor_id = params.hardware_vendor_id
- product_id = params.hardware_product_id
- driver_name = params.hardware_driver_name
- package_name = params.hardware_driver_package_name
-
- if (bus is not None and vendor_id is not None and
- product_id is not None):
- tables, clauses = make_submission_device_statistics_clause(
- bus, vendor_id, product_id, driver_name, package_name, False)
- elif driver_name is not None or package_name is not None:
- tables, clauses = make_submission_device_statistics_clause(
- None, None, None, driver_name, package_name, False)
- else:
- return None
-
- tables.append(HWSubmission)
- tables.append(Bug)
- clauses.append(HWSubmissionDevice.submission == HWSubmission.id)
- bug_link_clauses = []
- if params.hardware_owner_is_bug_reporter:
- bug_link_clauses.append(
- HWSubmission.ownerID == Bug.ownerID)
- if params.hardware_owner_is_affected_by_bug:
- bug_link_clauses.append(
- And(BugAffectsPerson.personID == HWSubmission.ownerID,
- BugAffectsPerson.bug == Bug.id,
- BugAffectsPerson.affected))
- tables.append(BugAffectsPerson)
- if params.hardware_owner_is_subscribed_to_bug:
- bug_link_clauses.append(
- And(BugSubscription.person_id == HWSubmission.ownerID,
- BugSubscription.bug_id == Bug.id))
- tables.append(BugSubscription)
- if params.hardware_is_linked_to_bug:
- bug_link_clauses.append(
- And(HWSubmissionBug.bugID == Bug.id,
- HWSubmissionBug.submissionID == HWSubmission.id))
- tables.append(HWSubmissionBug)
-
- if len(bug_link_clauses) == 0:
- return None
-
- clauses.append(Or(*bug_link_clauses))
- clauses.append(_userCanAccessSubmissionStormClause(params.user))
-
- return BugTaskFlat.bug_id.is_in(
- Select(Bug.id, tables=tables, where=And(*clauses)))
-
-
def _build_blueprint_related_clause(params):
"""Find bugs related to Blueprints, or not."""
linked_blueprints = params.linked_blueprints
diff --git a/lib/lp/bugs/model/tests/test_bugtasksearch.py b/lib/lp/bugs/model/tests/test_bugtasksearch.py
index b5455f6..1b2a339 100644
--- a/lib/lp/bugs/model/tests/test_bugtasksearch.py
+++ b/lib/lp/bugs/model/tests/test_bugtasksearch.py
@@ -48,15 +48,8 @@ from lp.bugs.model.bugtasksearch import (
get_bug_bulk_privacy_filter_terms,
get_bug_privacy_filter_terms,
)
-from lp.hardwaredb.interfaces.hwdb import (
- HWBus,
- IHWDeviceSet,
- )
from lp.registry.enums import SharingPermission
-from lp.registry.interfaces.distribution import (
- IDistribution,
- IDistributionSet,
- )
+from lp.registry.interfaces.distribution import IDistribution
from lp.registry.interfaces.distributionsourcepackage import (
IDistributionSourcePackage,
)
@@ -90,7 +83,6 @@ from lp.testing import (
TestCase,
TestCaseWithFactory,
)
-from lp.testing.dbuser import dbuser
from lp.testing.layers import (
DatabaseFunctionalLayer,
LaunchpadFunctionalLayer,
@@ -2191,31 +2183,6 @@ class TestBugTaskTagSearchClauses(TestCase):
self.searchClause(all(u'*', u'-*')))
-class TestBugTaskHardwareSearch(TestCaseWithFactory):
-
- layer = LaunchpadFunctionalLayer
-
- def test_search_results_without_duplicates(self):
- # Searching for hardware related bugtasks returns each
- # matching task exactly once, even if devices from more than
- # one HWDB submission match the given criteria.
- new_submission = self.factory.makeHWSubmission(
- emailaddress=u'test@xxxxxxxxxxxxx')
- device = getUtility(IHWDeviceSet).getByDeviceID(
- HWBus.PCI, '0x10de', '0x0455')
- with dbuser('hwdb-submission-processor'):
- self.factory.makeHWSubmissionDevice(
- new_submission, device, None, None, 1)
- search_params = BugTaskSearchParams(
- user=None, hardware_bus=HWBus.PCI, hardware_vendor_id='0x10de',
- hardware_product_id='0x0455', hardware_owner_is_bug_reporter=True)
- ubuntu = getUtility(IDistributionSet).getByName('ubuntu')
- bugtasks = ubuntu.searchTasks(search_params)
- self.assertEqual(
- [1, 2],
- [bugtask.bug.id for bugtask in bugtasks])
-
-
class TestBugTaskSearch(TestCaseWithFactory):
layer = DatabaseFunctionalLayer
diff --git a/lib/lp/bugs/stories/webservice/xx-bug.txt b/lib/lp/bugs/stories/webservice/xx-bug.txt
index e36d172..a8f5d44 100644
--- a/lib/lp/bugs/stories/webservice/xx-bug.txt
+++ b/lib/lp/bugs/stories/webservice/xx-bug.txt
@@ -1559,142 +1559,6 @@ the advanced search interface.
True
-Hardware related bug tasks
-~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-We can search for bugs related to a given hardware device. We must
-specify a device by its bus, vendor and product IDs and the kind
-of link between a bug and a HWDB submission.
-
-We can search for bugs reported by owners of the PCI device (0x10de,
-0x045d).
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_bus='PCI',
- ... hardware_vendor_id='0x10de', hardware_product_id='0x045d',
- ... hardware_owner_is_bug_reporter=True).jsonBody()['entries']
- >>> for bugtask in bugtasks:
- ... print(bugtask['self_link'])
- http://api.launchpad.test/beta/ubuntu/+source/mozilla-firefox/+bug/1
- http://api.launchpad.test/beta/ubuntu/+bug/2
-
-We can further limit the search to devices controlled by a given driver.
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_bus='PCI',
- ... hardware_vendor_id='0x10de', hardware_product_id='0x045d',
- ... hardware_owner_is_bug_reporter=True,
- ... hardware_driver_name='ahci').jsonBody()['entries']
- >>> for bugtask in bugtasks:
- ... print(bugtask['self_link'])
- http://api.launchpad.test/beta/ubuntu/+source/mozilla-firefox/+bug/1
- http://api.launchpad.test/beta/ubuntu/+bug/2
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_bus='PCI',
- ... hardware_vendor_id='0x10de', hardware_product_id='0x045d',
- ... hardware_driver_name='nonsense',
- ... hardware_owner_is_bug_reporter=True).jsonBody()['entries']
- >>> print(len(bugtasks))
- 0
-
-We can search for bugs related to any hardware device controlled by a
-given driver.
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_driver_name='ahci',
- ... hardware_owner_is_bug_reporter=True).jsonBody()['entries']
- >>> for bugtask in bugtasks:
- ... print(bugtask['self_link'])
- http://api.launchpad.test/beta/ubuntu/+source/mozilla-firefox/+bug/1
- http://api.launchpad.test/beta/ubuntu/+bug/2
-
-We can limit the search to devices controlled by a driver from a given
-package.
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_driver_name='ahci',
- ... hardware_driver_package_name='linux-image-2.6.24-19-generic',
- ... hardware_owner_is_bug_reporter=True).jsonBody()['entries']
- >>> for bugtask in bugtasks:
- ... print(bugtask['self_link'])
- http://api.launchpad.test/beta/ubuntu/+source/mozilla-firefox/+bug/1
- http://api.launchpad.test/beta/ubuntu/+bug/2
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_driver_name='ahci',
- ... hardware_driver_package_name='nonsense',
- ... hardware_owner_is_bug_reporter=True).jsonBody()['entries']
- >>> print(len(bugtasks))
- 0
-
-Instead of searching for bugs reported by the owner of a given device,
-we can look for bugs where a device owner is affected by a bug...
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_bus='PCI',
- ... hardware_vendor_id='0x10de', hardware_product_id='0x045d',
- ... hardware_owner_is_affected_by_bug=True).jsonBody()['entries']
- >>> print(len(bugtasks))
- 0
-
- >>> login(ANONYMOUS)
- >>> sample_person = getUtility(IPersonSet).getByEmail('test@xxxxxxxxxxxxx')
- >>> logout()
- >>> sample_person_webservice = webservice_for_person(
- ... sample_person, permission=OAuthPermission.WRITE_PUBLIC)
- >>> sample_person_webservice.named_post(
- ... 'http://api.launchpad.test/beta/bugs/2', 'markUserAffected',
- ... affected=True).jsonBody()
-
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_bus='PCI',
- ... hardware_vendor_id='0x10de', hardware_product_id='0x045d',
- ... hardware_owner_is_affected_by_bug=True).jsonBody()['entries']
- >>> for bugtask in bugtasks:
- ... print(bugtask['self_link'])
- http://api.launchpad.test/beta/ubuntu/+bug/2
-
-...or for bugs to which owners of a given device are subscribed...
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_bus='PCI',
- ... hardware_vendor_id='0x10de', hardware_product_id='0x045d',
- ... hardware_owner_is_subscribed_to_bug=True).jsonBody()['entries']
- >>> for bugtask in bugtasks:
- ... print(bugtask['self_link'])
- http://api.launchpad.test/beta/ubuntu/+source/mozilla-firefox/+bug/1
- http://api.launchpad.test/beta/ubuntu/+source/thunderbird/+bug/9
-
-...or for bugs which are directly linked to a HWDB submission containing
-a given device.
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_bus='PCI',
- ... hardware_vendor_id='0x10de', hardware_product_id='0x045d',
- ... hardware_is_linked_to_bug=True).jsonBody()['entries']
- >>> print(len(bugtasks))
- 0
-
- >>> bug_ten = webservice.get('/bugs/10').jsonBody()
- >>> sample_submission = webservice.get(
- ... '/+hwdb/+submission/sample-submission').jsonBody()
- >>> print(webservice.named_post(
- ... bug_ten['self_link'], 'linkHWSubmission',
- ... submission=sample_submission['self_link']))
- HTTP/1.1 200 Ok
- ...
-
- >>> bugtasks = webservice.named_get(
- ... '/ubuntu', 'searchTasks', hardware_bus='PCI',
- ... hardware_vendor_id='0x10de', hardware_product_id='0x045d',
- ... hardware_is_linked_to_bug=True).jsonBody()['entries']
- >>> for bugtask in bugtasks:
- ... print(bugtask['self_link'])
- http://api.launchpad.test/beta/ubuntu/+source/linux-source-2.6.15/+bug/10
-
-
User related bug tasks
~~~~~~~~~~~~~~~~~~~~~~
@@ -1943,94 +1807,6 @@ Add a new task to the bug.
...
-HWDB submissions
-----------------
-
-We can create a link between a HWDB submission and a bug by calling
-bug.linkHWSubmission().
-
- >>> sample_submission = webservice.get(
- ... '/+hwdb/+submission/sample-submission').jsonBody()
- >>> print(webservice.named_post(
- ... bug_one['self_link'], 'linkHWSubmission',
- ... submission=sample_submission['self_link']))
- HTTP/1.1 200 Ok
- ...
-
-Existing links are returned by bug.getHWSubmissions().
-
- >>> linked_submissions = webservice.named_get(
- ... bug_one['self_link'], 'getHWSubmissions').jsonBody()
- >>> for submission in linked_submissions['entries']:
- ... print(submission['submission_key'])
- sample-submission
-
-Private submissions are returned only for their owners and for admins.
-
- >>> login(ANONYMOUS)
- >>> private_submission = factory.makeHWSubmission(
- ... emailaddress='no-priv@xxxxxxxxxxxxx', private=True,
- ... submission_key='private-submission')
- >>> logout()
-
- >>> private_submission = webservice.get(
- ... '/+hwdb/+submission/private-submission').jsonBody()
- >>> print(webservice.named_post(
- ... bug_one['self_link'], 'linkHWSubmission',
- ... submission=private_submission['self_link']))
- HTTP/1.1 200 Ok
- ...
-
-Note that our default webservice client runs for Guilherme Salgado, who
-is an admin, so this client returns the private submission.
-
- >>> linked_submissions = webservice.named_get(
- ... bug_one['self_link'], 'getHWSubmissions').jsonBody()
- >>> for submission in linked_submissions['entries']:
- ... print(submission['submission_key'])
- private-submission
- sample-submission
-
- >>> login(ANONYMOUS)
- >>> no_priv = getUtility(IPersonSet).getByEmail('no-priv@xxxxxxxxxxxxx')
- >>> logout()
- >>> no_priv_webservice = webservice_for_person(
- ... no_priv, permission=OAuthPermission.READ_PRIVATE)
- >>> linked_submissions = no_priv_webservice.named_get(
- ... bug_one['self_link'], 'getHWSubmissions').jsonBody()
- >>> for submission in linked_submissions['entries']:
- ... print(submission['submission_key'])
- private-submission
- sample-submission
-
-Other people do not see links to private submissions.
-
- >>> login(ANONYMOUS)
- >>> sample_person = getUtility(IPersonSet).getByEmail('test@xxxxxxxxxxxxx')
- >>> logout()
- >>> sample_person_webservice = webservice_for_person(
- ... sample_person, permission=OAuthPermission.READ_PRIVATE)
- >>> linked_submissions = sample_person_webservice.named_get(
- ... bug_one['self_link'], 'getHWSubmissions').jsonBody()
- >>> for submission in linked_submissions['entries']:
- ... print(submission['submission_key'])
- sample-submission
-
-We can delete links between a HWDB submission and a bug by calling
-bug.unlinkHWSubmission().
-
- >>> print(webservice.named_post(
- ... bug_one['self_link'], 'unlinkHWSubmission',
- ... submission=sample_submission['self_link']))
- HTTP/1.1 200 Ok
- ...
-
- >>> linked_submissions = webservice.named_get(
- ... bug_one['self_link'], 'getHWSubmissions').jsonBody()
- >>> for submission in linked_submissions['entries']:
- ... print(submission['submission_key'])
- private-submission
-
Bug branches
------------