← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~salgado/launchpad/do-not-migrate-ubuntu-work-items into lp:launchpad

 

Guilherme Salgado has proposed merging lp:~salgado/launchpad/do-not-migrate-ubuntu-work-items into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~salgado/launchpad/do-not-migrate-ubuntu-work-items/+merge/97088

Migrate work items only from the Blueprints of Linaro-related projects.

The Ubuntu project doesn't want their Blueprints migrated now, so we've agreed
to migrate only the Linaro blueprints for now.
-- 
https://code.launchpad.net/~salgado/launchpad/do-not-migrate-ubuntu-work-items/+merge/97088
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~salgado/launchpad/do-not-migrate-ubuntu-work-items into lp:launchpad.
=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py	2012-03-07 22:48:03 +0000
+++ lib/lp/scripts/garbo.py	2012-03-12 19:05:23 +0000
@@ -1075,6 +1075,31 @@
 
     maximum_chunk_size = 500
     offset = 0
+    projects_to_migrate = [
+        'linaro-graphics-misc', 'linaro-powerdebug', 'linaro-mm-sig',
+        'linaro-patchmetrics', 'linaro-android-mirror', 'u-boot-linaro',
+        'lava-dashboard-tool', 'lava-celery', 'smartt', 'linaro-power-kernel',
+        'linaro-django-xmlrpc', 'linaro-multimedia-testcontent',
+        'linaro-status-website', 'linaro-octo-armhf', 'svammel', 'libmatrix',
+        'glproxy', 'lava-test', 'cbuild', 'linaro-ci',
+        'linaro-multimedia-ucm', 'linaro-ubuntu',
+        'linaro-android-infrastructure', 'linaro-wordpress-registration-form',
+        'linux-linaro', 'lava-server', 'linaro-android-build-tools',
+        'linaro-graphics-dashboard', 'linaro-fetch-image', 'unity-gles',
+        'lava-kernel-ci-views', 'cortex-strings', 'glmark2-extra',
+        'lava-dashboard', 'linaro-multimedia-speex', 'glcompbench',
+        'igloocommunity', 'linaro-validation-misc', 'linaro-websites',
+        'linaro-graphics-tests', 'linaro-android',
+        'jenkins-plugin-shell-status', 'binutils-linaro',
+        'linaro-multimedia-project', 'lava-qatracker',
+        'linaro-toolchain-binaries', 'linaro-image-tools',
+        'linaro-toolchain-misc', 'qemu-linaro', 'linaro-toolchain-benchmarks',
+        'lava-dispatcher', 'gdb-linaro', 'lava-android-test', 'libjpeg-turbo',
+        'lava-scheduler-tool', 'glmark2', 'linaro-infrastructure-misc',
+        'lava-lab', 'linaro-android-frontend', 'linaro-powertop',
+        'linaro-license-protection', 'gcc-linaro', 'lava-scheduler',
+        'linaro-offspring', 'linaro-python-dashboard-bundle',
+        'linaro-power-qa', 'lava-tool', 'linaro']
 
     def __init__(self, log, abort_time=None):
         super(SpecificationWorkitemMigrator, self).__init__(
@@ -1090,9 +1115,13 @@
             self.total = 0
             return
 
+        quoted_names = [
+            "'%s'" % name for name in self.projects_to_migrate]
+        query = ("product in (select id from product where name in (%s))"
+            % ",".join(quoted_names))
         # Get only the specs which contain "work items" in their whiteboard
         # and which don't have any SpecificationWorkItems.
-        query = "whiteboard ilike '%%' || %s || '%%'" % quote_like(
+        query += " and whiteboard ilike '%%' || %s || '%%'" % quote_like(
             'work items')
         query += (" and id not in (select distinct specification from "
                   "SpecificationWorkItem)")

=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py	2012-03-08 22:48:17 +0000
+++ lib/lp/scripts/tests/test_garbo.py	2012-03-12 19:05:23 +0000
@@ -56,6 +56,7 @@
 from lp.code.model.codeimportresult import CodeImportResult
 from lp.registry.enums import InformationType
 from lp.registry.interfaces.accesspolicy import IAccessPolicySource
+from lp.registry.interfaces.distribution import IDistributionSet
 from lp.registry.interfaces.person import IPersonSet
 from lp.scripts.garbo import (
     AntiqueSessionPruner,
@@ -1061,7 +1062,8 @@
         # When the migration is successful we remove all work-items from the
         # whiteboard.
         switch_dbuser('testadmin')
-        milestone = self.factory.makeMilestone()
+        product = self.factory.makeProduct(name='linaro')
+        milestone = self.factory.makeMilestone(product=product)
         person = self.factory.makePerson()
         whiteboard = dedent("""
             Work items for %s:
@@ -1071,7 +1073,7 @@
             Another work item: DONE
             """ % (milestone.name, person.name))
         spec = self.factory.makeSpecification(
-            product=milestone.product, whiteboard=whiteboard)
+            product=product, whiteboard=whiteboard)
         IMasterStore(FeatureFlag).add(FeatureFlag(
             u'default', 0, u'garbo.workitem_migrator.enabled', u'True'))
         transaction.commit()
@@ -1089,6 +1091,20 @@
             status=SpecificationWorkItemStatus.DONE,
             milestone=None, specification=spec))
 
+    def test_SpecificationWorkitemMigrator_skips_ubuntu_blueprints(self):
+        switch_dbuser('testadmin')
+        whiteboard = "Work items:\nA work item: TODO"
+        spec = self.factory.makeSpecification(
+            whiteboard=whiteboard,
+            distribution=getUtility(IDistributionSet)['ubuntu'])
+        IMasterStore(FeatureFlag).add(FeatureFlag(
+            u'default', 0, u'garbo.workitem_migrator.enabled', u'True'))
+        transaction.commit()
+        self.runFrequently()
+
+        self.assertEqual(whiteboard, spec.whiteboard)
+        self.assertEqual(0, spec.work_items.count())
+
     def test_SpecificationWorkitemMigrator_parse_error(self):
         # When we fail to parse any work items in the whiteboard we leave it
         # untouched and don't create any SpecificationWorkItem entries.
@@ -1098,7 +1114,9 @@
             A work item: TODO
             Another work item: UNKNOWNSTATUSWILLFAILTOPARSE
             """)
-        spec = self.factory.makeSpecification(whiteboard=whiteboard)
+        product = self.factory.makeProduct(name='linaro')
+        spec = self.factory.makeSpecification(
+            product=product, whiteboard=whiteboard)
         IMasterStore(FeatureFlag).add(FeatureFlag(
             u'default', 0, u'garbo.workitem_migrator.enabled', u'True'))
         transaction.commit()