← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/accept-translations-packagingjob into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/accept-translations-packagingjob into lp:launchpad.

Commit message:
Give process_accepted SELECT and INSERT permissions on packagingjob.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1482599 in Launchpad itself: "process-accepted fails to schedule packagingjob"
  https://bugs.launchpad.net/launchpad/+bug/1482599

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/accept-translations-packagingjob/+merge/267330

Give process_accepted SELECT and INSERT permissions on packagingjob.  This is needed because Translations schedules packaging jobs in response to SourcePackage.setPackaging.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/accept-translations-packagingjob into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg	2015-08-03 14:46:01 +0000
+++ database/schema/security.cfg	2015-08-07 11:29:31 +0000
@@ -1545,6 +1545,7 @@
 type=user
 groups=queued
 public.packaging                        = SELECT, INSERT
+public.packagingjob                     = SELECT, INSERT
 public.processacceptedbugsjob           = SELECT, INSERT
 
 [upload_package_translations_job]

=== modified file 'lib/lp/archivepublisher/tests/test_rosetta_translations.py'
--- lib/lp/archivepublisher/tests/test_rosetta_translations.py	2015-07-08 15:13:48 +0000
+++ lib/lp/archivepublisher/tests/test_rosetta_translations.py	2015-08-07 11:29:31 +0000
@@ -38,7 +38,11 @@
     person_logged_in,
     TestCaseWithFactory,
     )
+from lp.testing.dbuser import dbuser
 from lp.testing.layers import LaunchpadZopelessLayer
+from lp.translations.model.translationpackagingjob import (
+    TranslationPackagingJob,
+    )
 
 
 class TestRosettaTranslations(TestCaseWithFactory):
@@ -242,17 +246,20 @@
     def test_basic_from_copy(self):
         spr, pu, lfa = self.makeJobElementsFromCopyJob()
         transaction.commit()
-        process_rosetta_translations(pu, lfa)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(pu, lfa)
 
     def test_basic_from_upload(self):
         spr, pu, lfa = self.makeJobElements()
         transaction.commit()
-        process_rosetta_translations(pu, lfa)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(pu, lfa)
 
     def test_correct_job_is_created_from_upload(self):
         spr, packageupload, libraryfilealias = self.makeJobElements()
         transaction.commit()
-        process_rosetta_translations(packageupload, libraryfilealias)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(packageupload, libraryfilealias)
 
         jobs = list(PackageTranslationsUploadJob.iterReady())
         self.assertEqual(1, len(jobs))
@@ -265,7 +272,8 @@
         spr, packageupload, libraryfilealias = (
             self.makeJobElementsFromCopyJob())
         transaction.commit()
-        process_rosetta_translations(packageupload, libraryfilealias)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(packageupload, libraryfilealias)
 
         jobs = list(PackageTranslationsUploadJob.iterReady())
         self.assertEqual(1, len(jobs))
@@ -280,7 +288,8 @@
             distroseries_name="vivid", archive_name="stable-phone-overlay")
         self.ensureDistroSeries("ubuntu-rtm", "15.04")
         transaction.commit()
-        process_rosetta_translations(packageupload, libraryfilealias)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(packageupload, libraryfilealias)
 
         jobs = list(PackageTranslationsUploadJob.iterReady())
         self.assertEqual(1, len(jobs))
@@ -295,7 +304,8 @@
             distroseries_name="wily", archive_name="stable-phone-overlay")
         self.ensureDistroSeries("ubuntu-rtm", "15.04")
         transaction.commit()
-        process_rosetta_translations(packageupload, libraryfilealias)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(packageupload, libraryfilealias)
 
         jobs = list(PackageTranslationsUploadJob.iterReady())
         self.assertEqual(0, len(jobs))
@@ -306,7 +316,8 @@
             distroseries_name="vivid", archive_name="landing-001")
         self.ensureDistroSeries("ubuntu-rtm", "15.04")
         transaction.commit()
-        process_rosetta_translations(packageupload, libraryfilealias)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(packageupload, libraryfilealias)
 
         jobs = list(PackageTranslationsUploadJob.iterReady())
         self.assertEqual(0, len(jobs))
@@ -317,7 +328,8 @@
         transaction.commit()
         sourcepackage = packageupload.distroseries.getSourcePackage(spr.name)
         self.assertIsNone(sourcepackage.packaging)
-        process_rosetta_translations(packageupload, libraryfilealias)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(packageupload, libraryfilealias)
         self.assertIsNone(sourcepackage.packaging)
 
     def test_skips_packaging_for_redirected_ppa_no_original(self):
@@ -331,7 +343,8 @@
         transaction.commit()
         sourcepackage = packageupload.distroseries.getSourcePackage(spr.name)
         self.assertIsNone(sourcepackage.packaging)
-        process_rosetta_translations(packageupload, libraryfilealias)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(packageupload, libraryfilealias)
         self.assertIsNone(sourcepackage.packaging)
 
     def test_skips_existing_packaging_for_redirected_ppa(self):
@@ -353,7 +366,8 @@
         transaction.commit()
         self.assertEqual(
             current_upstream, sourcepackage.packaging.productseries)
-        process_rosetta_translations(packageupload, libraryfilealias)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(packageupload, libraryfilealias)
         self.assertEqual(
             current_upstream, sourcepackage.packaging.productseries)
 
@@ -373,5 +387,11 @@
         transaction.commit()
         sourcepackage = redirected_series.getSourcePackage(spr.name)
         self.assertIsNone(sourcepackage.packaging)
-        process_rosetta_translations(packageupload, libraryfilealias)
+        with dbuser("process_accepted"):
+            process_rosetta_translations(packageupload, libraryfilealias)
         self.assertEqual(upstream, sourcepackage.packaging.productseries)
+        # TranslationPackagingJobs are created to handle the Packaging
+        # change (one TranslationMergeJob for each of ubuntu/vivid and
+        # ubuntu-rtm/15.04).
+        jobs = list(TranslationPackagingJob.iterReady())
+        self.assertEqual(2, len(jobs))


Follow ups