← Back to team overview

launchpad-reviewers team mailing list archive

lp:~allenap/launchpad/sync-packages-select-on-archivearch-bug-812867 into lp:launchpad

 

Gavin Panella has proposed merging lp:~allenap/launchpad/sync-packages-select-on-archivearch-bug-812867 into lp:launchpad with lp:~allenap/launchpad/wrong-needs-linking-count-bug-795359 as a prerequisite.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #812867 in Launchpad itself: "The sync_packages DB user is missing SELECT on archivearch"
  https://bugs.launchpad.net/launchpad/+bug/812867

For more details, see:
https://code.launchpad.net/~allenap/launchpad/sync-packages-select-on-archivearch-bug-812867/+merge/71731

Fixes the bug.
-- 
https://code.launchpad.net/~allenap/launchpad/sync-packages-select-on-archivearch-bug-812867/+merge/71731
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/launchpad/sync-packages-select-on-archivearch-bug-812867 into lp:launchpad.
=== modified file 'database/schema/security.cfg'
--- database/schema/security.cfg	2011-08-10 15:57:35 +0000
+++ database/schema/security.cfg	2011-08-16 16:23:25 +0000
@@ -1016,6 +1016,7 @@
 groups=script
 public.account                                = SELECT
 public.archive                                = SELECT
+public.archivearch                            = SELECT
 public.archivepermission                      = SELECT, INSERT
 public.binarypackagebuild                     = SELECT, INSERT
 public.binarypackagefile                      = SELECT, INSERT

=== modified file 'lib/lp/soyuz/tests/test_packagecopyjob.py'
--- lib/lp/soyuz/tests/test_packagecopyjob.py	2011-07-28 14:07:44 +0000
+++ lib/lp/soyuz/tests/test_packagecopyjob.py	2011-08-16 16:23:25 +0000
@@ -116,6 +116,8 @@
         except:
             transaction.abort()
             job.fail()
+        else:
+            job.complete()
 
 
 class PlainPackageCopyJobTests(TestCaseWithFactory, LocalTestHelper):
@@ -581,6 +583,47 @@
         self.assertEqual('restricted', new_publication.component.name)
         self.assertEqual('games', new_publication.section.name)
 
+    def test_copying_to_ppa_archive(self):
+        # Packages can be copied into PPA archives.
+        publisher = SoyuzTestPublisher()
+        publisher.prepareBreezyAutotest()
+        distroseries = publisher.breezy_autotest
+
+        target_archive = self.factory.makeArchive(
+            distroseries.distribution, purpose=ArchivePurpose.PPA)
+        source_archive = self.factory.makeArchive()
+
+        # Publish a package in the source archive with some overridable
+        # properties set to known values.
+        publisher.getPubSource(
+            distroseries=distroseries, sourcename="libc",
+            component='universe', section='web',
+            version="2.8-1", status=PackagePublishingStatus.PUBLISHED,
+            archive=source_archive)
+
+        # Now, run the copy job.
+        source = getUtility(IPlainPackageCopyJobSource)
+        requester = self.factory.makePerson()
+        with person_logged_in(target_archive.owner):
+            target_archive.newComponentUploader(requester, "main")
+        job = source.create(
+            package_name="libc",
+            package_version="2.8-1",
+            source_archive=source_archive,
+            target_archive=target_archive,
+            target_distroseries=distroseries,
+            target_pocket=PackagePublishingPocket.RELEASE,
+            include_binaries=False,
+            requester=requester)
+
+        self.runJob(job)
+        self.assertEqual(JobStatus.COMPLETED, job.status)
+
+        new_publication = target_archive.getPublishedSources(
+            name='libc', version='2.8-1').one()
+        self.assertEqual('main', new_publication.component.name)
+        self.assertEqual('web', new_publication.section.name)
+
     def test_copying_to_main_archive_manual_overrides(self):
         # Test processing a packagecopyjob that has manual overrides.
         publisher = SoyuzTestPublisher()