launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #18937
[Merge] lp:~cjwatson/launchpad/rtu-copy-packaging into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/rtu-copy-packaging into lp:launchpad.
Commit message:
Copy Packaging records if necessary before importing translations uploaded to a redirected PPA.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/rtu-copy-packaging/+merge/264162
Copy Packaging records if necessary before importing translations uploaded to a redirected PPA. This ensures that we don't later have to run the translations merger.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/rtu-copy-packaging into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg 2015-06-08 05:02:31 +0000
+++ database/schema/security.cfg 2015-07-08 15:24:58 +0000
@@ -1522,6 +1522,7 @@
[process_accepted]
type=user
groups=queued
+public.packaging = SELECT, INSERT
public.processacceptedbugsjob = SELECT, INSERT
[upload_package_translations_job]
=== modified file 'lib/lp/archivepublisher/rosetta_translations.py'
--- lib/lp/archivepublisher/rosetta_translations.py 2015-07-04 00:11:01 +0000
+++ lib/lp/archivepublisher/rosetta_translations.py 2015-07-08 15:24:58 +0000
@@ -98,6 +98,21 @@
# packages in main.
return
+ if distroseries != packageupload.distroseries:
+ # Make sure that the target distroseries has a matching
+ # Packaging record, since we want to make sure that exists
+ # before importing translations so that message sharing works.
+ sourcepackage = distroseries.getSourcePackage(spr.name)
+ if sourcepackage is not None and sourcepackage.packaging is None:
+ original_sourcepackage = (
+ packageupload.distroseries.getSourcePackage(spr.name))
+ if original_sourcepackage is not None:
+ original_packaging = original_sourcepackage.packaging
+ if original_packaging is not None:
+ sourcepackage.setPackaging(
+ original_packaging.productseries,
+ original_packaging.owner)
+
blamee = (packageupload.findPersonToNotify() or
latest_publication.creator or
getUtility(ILaunchpadCelebrities).rosetta_experts)
=== modified file 'lib/lp/archivepublisher/tests/test_rosetta_translations.py'
--- lib/lp/archivepublisher/tests/test_rosetta_translations.py 2015-07-04 00:11:01 +0000
+++ lib/lp/archivepublisher/tests/test_rosetta_translations.py 2015-07-08 15:24:58 +0000
@@ -310,3 +310,68 @@
jobs = list(PackageTranslationsUploadJob.iterReady())
self.assertEqual(0, len(jobs))
+
+ def test_skips_packaging_for_primary(self):
+ # An upload to a primary archive leaves Packaging records untouched.
+ spr, packageupload, libraryfilealias = self.makeJobElements()
+ transaction.commit()
+ sourcepackage = packageupload.distroseries.getSourcePackage(spr.name)
+ self.assertIsNone(sourcepackage.packaging)
+ process_rosetta_translations(packageupload, libraryfilealias)
+ self.assertIsNone(sourcepackage.packaging)
+
+ def test_skips_packaging_for_redirected_ppa_no_original(self):
+ # If there is no suitable Packaging record in the original
+ # distroseries, then an upload to a redirected PPA leaves Packaging
+ # records untouched.
+ spr, packageupload, libraryfilealias = self.makeJobElementsForPPA(
+ owner_name="ci-train-ppa-service", distribution_name="ubuntu",
+ distroseries_name="vivid", archive_name="stable-phone-overlay")
+ self.ensureDistroSeries("ubuntu-rtm", "15.04")
+ transaction.commit()
+ sourcepackage = packageupload.distroseries.getSourcePackage(spr.name)
+ self.assertIsNone(sourcepackage.packaging)
+ process_rosetta_translations(packageupload, libraryfilealias)
+ self.assertIsNone(sourcepackage.packaging)
+
+ def test_skips_existing_packaging_for_redirected_ppa(self):
+ # If there is already a suitable Packaging record in the redirected
+ # distroseries, then an upload to a redirected PPA leaves it
+ # untouched.
+ person = self.factory.makePerson()
+ current_upstream = self.factory.makeProductSeries()
+ new_upstream = self.factory.makeProductSeries()
+ spr, packageupload, libraryfilealias = self.makeJobElementsForPPA(
+ owner_name="ci-train-ppa-service", distribution_name="ubuntu",
+ distroseries_name="vivid", archive_name="stable-phone-overlay")
+ redirected_series = self.ensureDistroSeries("ubuntu-rtm", "15.04")
+ sourcepackage = redirected_series.getSourcePackage(spr.name)
+ sourcepackage.setPackaging(current_upstream, person)
+ original_series = self.ensureDistroSeries("ubuntu", "vivid")
+ original_series.getSourcePackage(spr.name).setPackaging(
+ new_upstream, person)
+ transaction.commit()
+ self.assertEqual(
+ current_upstream, sourcepackage.packaging.productseries)
+ process_rosetta_translations(packageupload, libraryfilealias)
+ self.assertEqual(
+ current_upstream, sourcepackage.packaging.productseries)
+
+ def test_copies_packaging_for_redirected_ppa(self):
+ # If there is no suitable Packaging record in the redirected
+ # distroseries but there is one in the original distroseries, then
+ # an upload to a redirected PPA copies it from the original.
+ person = self.factory.makePerson()
+ upstream = self.factory.makeProductSeries()
+ spr, packageupload, libraryfilealias = self.makeJobElementsForPPA(
+ owner_name="ci-train-ppa-service", distribution_name="ubuntu",
+ distroseries_name="vivid", archive_name="stable-phone-overlay")
+ redirected_series = self.ensureDistroSeries("ubuntu-rtm", "15.04")
+ original_series = self.ensureDistroSeries("ubuntu", "vivid")
+ original_series.getSourcePackage(spr.name).setPackaging(
+ upstream, person)
+ transaction.commit()
+ sourcepackage = redirected_series.getSourcePackage(spr.name)
+ self.assertIsNone(sourcepackage.packaging)
+ process_rosetta_translations(packageupload, libraryfilealias)
+ self.assertEqual(upstream, sourcepackage.packaging.productseries)
Follow ups