← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/remove-spr-dsc-binaries-updater into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/remove-spr-dsc-binaries-updater into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/remove-spr-dsc-binaries-updater/+merge/88528

Remove SourcePackageReleaseDscBinariesUpdater garbo job.  I added this as part of fixing bug 911943; David Ames has just confirmed on IRC that it has converted all the rows it was supposed to convert on production.
-- 
https://code.launchpad.net/~cjwatson/launchpad/remove-spr-dsc-binaries-updater/+merge/88528
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/remove-spr-dsc-binaries-updater into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg	2012-01-12 08:13:59 +0000
+++ database/schema/security.cfg	2012-01-13 16:28:34 +0000
@@ -2168,7 +2168,7 @@
 public.revisionauthor                   = SELECT, UPDATE
 public.revisioncache                    = SELECT, DELETE
 public.sourcepackagename                = SELECT
-public.sourcepackagerelease             = SELECT, UPDATE
+public.sourcepackagerelease             = SELECT
 public.sourcepackagepublishinghistory   = SELECT, UPDATE
 public.suggestivepotemplate             = INSERT, DELETE
 public.teamparticipation                = SELECT, DELETE

=== modified file 'lib/lp/scripts/garbo.py'
--- lib/lp/scripts/garbo.py	2012-01-12 08:13:59 +0000
+++ lib/lp/scripts/garbo.py	2012-01-13 16:28:34 +0000
@@ -86,7 +86,6 @@
     MAIN_STORE,
     MASTER_FLAVOR,
     )
-from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
 from lp.translations.interfaces.potemplate import IPOTemplateSet
 from lp.translations.model.potmsgset import POTMsgSet
 from lp.translations.model.potranslation import POTranslation
@@ -902,42 +901,6 @@
         self._update_oldest()
 
 
-class SourcePackageReleaseDscBinariesUpdater(TunableLoop):
-    """Fix incorrect values for SourcePackageRelease.dsc_binaries."""
-
-    maximum_chunk_size = 1000
-
-    def __init__(self, log, abort_time=None):
-        super(SourcePackageReleaseDscBinariesUpdater, self).__init__(
-            log, abort_time)
-        self.store = IMasterStore(SourcePackageRelease)
-        self.ids = list(
-            self.store.find(
-                SourcePackageRelease.id,
-                # Get all SPR IDs which have an incorrectly-separated
-                # dsc_binaries value (space rather than comma-space).
-                SQL("dsc_binaries ~ '[a-z0-9+.-] '"),
-                # Skip rows with dsc_binaries in dependency relationship
-                # format.  This is a different bug.
-                SQL("dsc_binaries NOT LIKE '%(%'")))
-
-    def isDone(self):
-        """See `TunableLoop`."""
-        return len(self.ids) == 0
-
-    def __call__(self, chunk_size):
-        """See `TunableLoop`."""
-        chunk_size = int(chunk_size + 0.5)
-        chunk_ids = self.ids[:chunk_size]
-        del self.ids[:chunk_size]
-        self.store.execute("""
-            UPDATE SourcePackageRelease
-            SET dsc_binaries = regexp_replace(
-                dsc_binaries, '([a-z0-9+.-]) ', E'\\\\1, ', 'g')
-            WHERE id IN %s""" % sqlvalues(chunk_ids), noresult=True)
-        transaction.commit()
-
-
 class SuggestiveTemplatesCacheUpdater(TunableLoop):
     """Refresh the SuggestivePOTemplate cache.
 
@@ -1302,7 +1265,6 @@
         ObsoleteBugAttachmentPruner,
         OldTimeLimitedTokenDeleter,
         RevisionAuthorEmailLinker,
-        SourcePackageReleaseDscBinariesUpdater,
         SuggestiveTemplatesCacheUpdater,
         POTranslationPruner,
         UnusedPOTMsgSetPruner,

=== modified file 'lib/lp/scripts/tests/test_garbo.py'
--- lib/lp/scripts/tests/test_garbo.py	2012-01-12 08:13:59 +0000
+++ lib/lp/scripts/tests/test_garbo.py	2012-01-13 16:28:34 +0000
@@ -996,42 +996,6 @@
         self.runDaily()
         self.assertEqual(0, unreferenced_msgsets.count())
 
-    def test_SourcePackageReleaseDscBinariesUpdater_updates_incorrect(self):
-        # SourcePackageReleaseDscBinariesUpdater fixes incorrectly-separated
-        # dsc_binaries values.
-        LaunchpadZopelessLayer.switchDbUser('testadmin')
-        spr = self.factory.makeSourcePackageRelease(
-            dsc_binaries="one two three")
-        transaction.commit()
-        self.runDaily()
-        self.assertEqual("one, two, three", spr.dsc_binaries)
-
-    def test_SourcePackageReleaseDscBinariesUpdater_skips_correct(self):
-        # SourcePackageReleaseDscBinariesUpdater leaves correct dsc_binaries
-        # values alone.
-        LaunchpadZopelessLayer.switchDbUser('testadmin')
-        spr_one = self.factory.makeSourcePackageRelease(dsc_binaries="one")
-        spr_three = self.factory.makeSourcePackageRelease(
-            dsc_binaries="one, two, three")
-        transaction.commit()
-        self.runDaily()
-        self.assertEqual("one", spr_one.dsc_binaries)
-        self.assertEqual("one, two, three", spr_three.dsc_binaries)
-
-    def test_SourcePackageReleaseDscBinariesUpdater_skips_broken(self):
-        # There have been a few instances of Binary fields in PPA packages
-        # that are formatted like a dependency relationship field, complete
-        # with (>= ...).  This is completely invalid (and failed to build),
-        # but does exist historically, so we have to deal with it.
-        # SourcePackageReleaseDscBinariesUpdater leaves such fields well
-        # alone.
-        LaunchpadZopelessLayer.switchDbUser('testadmin')
-        spr = self.factory.makeSourcePackageRelease(
-            dsc_binaries="one (>= 1), two")
-        transaction.commit()
-        self.runDaily()
-        self.assertEqual("one (>= 1), two", spr.dsc_binaries)
-
 
 class TestGarboTasks(TestCaseWithFactory):
     layer = LaunchpadZopelessLayer


Follow ups