Merge lp:~jml/launchpad/allow-upload-without-coc into lp:launchpad

Proposed by Jonathan Lange
Status: Merged
Approved by: Māris Fogels
Approved revision: no longer in the source branch.
Merged at revision: 11894
Proposed branch: lp:~jml/launchpad/allow-upload-without-coc
Merge into: lp:launchpad
Diff against target: 152 lines (+9/-71)
2 files modified
lib/lp/archiveuploader/tests/test_ppauploadprocessor.py (+7/-41)
lib/lp/archiveuploader/uploadpolicy.py (+2/-30)
To merge this branch: bzr merge lp:~jml/launchpad/allow-upload-without-coc
Reviewer Review Type Date Requested Status
Māris Fogels (community) Approve
Review via email: mp+40218@code.launchpad.net

Description of the change

PPA uploaders shouldn't need to sign the code of conduct. This branch makes it so.

To post a comment you must log in.
Revision history for this message
Māris Fogels (mars) wrote :

Hi Jono,

This change looks great, r=mars. And you deserve bonus points for removing that XXX comment.

Maris

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/archiveuploader/tests/test_ppauploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2010-10-25 13:16:10 +0000
+++ lib/lp/archiveuploader/tests/test_ppauploadprocessor.py 2010-11-08 13:33:50 +0000
@@ -65,8 +65,8 @@
65 self.name16 = getUtility(IPersonSet).getByName("name16")65 self.name16 = getUtility(IPersonSet).getByName("name16")
66 beta_testers.addMember(self.name16, admin)66 beta_testers.addMember(self.name16, admin)
67 # Pop the two messages notifying the team modification.67 # Pop the two messages notifying the team modification.
68 unused = stub.test_emails.pop()68 stub.test_emails.pop()
69 unused = stub.test_emails.pop()69 stub.test_emails.pop()
7070
71 # create name16 PPA71 # create name16 PPA
72 self.name16_ppa = getUtility(IArchiveSet).new(72 self.name16_ppa = getUtility(IArchiveSet).new(
@@ -639,40 +639,6 @@
639 pub_foocomm.sourcepackagerelease.component.name, 'partner')639 pub_foocomm.sourcepackagerelease.component.name, 'partner')
640 self.assertEqual(pub_foocomm.component.name, 'main')640 self.assertEqual(pub_foocomm.component.name, 'main')
641641
642 def testUploadSignedByCodeOfConductNonSigner(self):
643 """Check if a CoC non-signer can upload to his PPA."""
644 self.name16.activesignatures[0].active = False
645 self.layer.commit()
646
647 upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu")
648 self.processUpload(self.uploadprocessor, upload_dir)
649
650 self.assertEqual(
651 self.uploadprocessor.last_processed_upload.rejection_message,
652 "PPA uploads must be signed by an Ubuntu Code of Conduct signer.")
653 self.assertTrue(self.name16.archive is not None)
654
655 def testUploadSignedByBetaTesterMember(self):
656 """Check if a non-member of launchpad-beta-testers can upload to PPA.
657
658 PPA was opened for public access in 1.1.11 (22th Nov 2007), so we will
659 keep this test as a simple reference to the check disabled in code
660 (uploadpolicy.py).
661 """
662 beta_testers = getUtility(
663 ILaunchpadCelebrities).launchpad_beta_testers
664 self.name16.leave(beta_testers)
665 # Pop the message notifying the membership modification.
666 run_mail_jobs()
667 unused = stub.test_emails.pop()
668
669 upload_dir = self.queueUpload("bar_1.0-1", "~name16/ubuntu")
670 self.processUpload(self.uploadprocessor, upload_dir)
671
672 self.assertEqual(
673 self.uploadprocessor.last_processed_upload.queue_root.status,
674 PackageUploadStatus.DONE)
675
676 def testMixedUpload(self):642 def testMixedUpload(self):
677 """Mixed PPA uploads are rejected with a appropriate message."""643 """Mixed PPA uploads are rejected with a appropriate message."""
678 upload_dir = self.queueUpload(644 upload_dir = self.queueUpload(
@@ -938,7 +904,7 @@
938 self.processUpload(self.uploadprocessor, upload_dir)904 self.processUpload(self.uploadprocessor, upload_dir)
939 # Discard the announcement email and check the acceptance message905 # Discard the announcement email and check the acceptance message
940 # content.906 # content.
941 announcement = stub.test_emails.pop()907 stub.test_emails.pop()
942908
943 self.assertEqual(909 self.assertEqual(
944 self.uploadprocessor.last_processed_upload.queue_root.status,910 self.uploadprocessor.last_processed_upload.queue_root.status,
@@ -972,7 +938,7 @@
972 # Create a fake "bar" package and publish it in section "web".938 # Create a fake "bar" package and publish it in section "web".
973 publisher = SoyuzTestPublisher()939 publisher = SoyuzTestPublisher()
974 publisher.prepareBreezyAutotest()940 publisher.prepareBreezyAutotest()
975 pub_src = publisher.getPubSource(941 publisher.getPubSource(
976 sourcename="bar", version="1.0-1", section="web",942 sourcename="bar", version="1.0-1", section="web",
977 archive=self.name16_ppa, distroseries=self.breezy,943 archive=self.name16_ppa, distroseries=self.breezy,
978 status=PackagePublishingStatus.PUBLISHED)944 status=PackagePublishingStatus.PUBLISHED)
@@ -1175,7 +1141,7 @@
1175 queue_item.setAccepted()1141 queue_item.setAccepted()
1176 queue_item.realiseUpload()1142 queue_item.realiseUpload()
1177 self.layer.commit()1143 self.layer.commit()
1178 unused = stub.test_emails.pop()1144 stub.test_emails.pop()
11791145
1180 # Now upload a 3.0 (quilt) source with missing orig*.tar.* to a1146 # Now upload a 3.0 (quilt) source with missing orig*.tar.* to a
1181 # PPA. All of the missing files will be retrieved from the1147 # PPA. All of the missing files will be retrieved from the
@@ -1328,7 +1294,7 @@
1328 publisher.prepareBreezyAutotest()1294 publisher.prepareBreezyAutotest()
13291295
1330 # Publish To Breezy:1296 # Publish To Breezy:
1331 pub_bin1 = publisher.getPubBinaries(1297 publisher.getPubBinaries(
1332 archive=self.name16.archive, distroseries=self.breezy,1298 archive=self.name16.archive, distroseries=self.breezy,
1333 status=PackagePublishingStatus.PUBLISHED)1299 status=PackagePublishingStatus.PUBLISHED)
13341300
@@ -1339,7 +1305,7 @@
1339 warty['i386'].addOrUpdateChroot(fake_chroot)1305 warty['i386'].addOrUpdateChroot(fake_chroot)
13401306
1341 # Publish To Warty:1307 # Publish To Warty:
1342 pub_bin2 = publisher.getPubBinaries(1308 publisher.getPubBinaries(
1343 archive=self.name16.archive, distroseries=warty,1309 archive=self.name16.archive, distroseries=warty,
1344 status=PackagePublishingStatus.PUBLISHED)1310 status=PackagePublishingStatus.PUBLISHED)
13451311
13461312
=== modified file 'lib/lp/archiveuploader/uploadpolicy.py'
--- lib/lp/archiveuploader/uploadpolicy.py 2010-11-05 14:17:11 +0000
+++ lib/lp/archiveuploader/uploadpolicy.py 2010-11-08 13:33:50 +0000
@@ -215,26 +215,6 @@
215 """Insecure policy allows PPA upload."""215 """Insecure policy allows PPA upload."""
216 return False216 return False
217217
218 def checkSignerIsUbuntuCodeOfConductSignee(self, upload):
219 """Reject the upload if not signed by an Ubuntu CoC signer."""
220 if not upload.changes.signer.is_ubuntu_coc_signer:
221 upload.reject(
222 'PPA uploads must be signed by an Ubuntu '
223 'Code of Conduct signer.')
224
225 def checkSignerIsBetaTester(self, upload):
226 """Reject the upload if the upload signer is not a 'beta-tester'.
227
228 For being a 'beta-tester' a person must be a valid member of
229 launchpad-beta-tester team/celebrity.
230 """
231 beta_testers = getUtility(
232 ILaunchpadCelebrities).launchpad_beta_testers
233 if not upload.changes.signer.inTeam(beta_testers):
234 upload.reject(
235 "PPA is only allowed for members of "
236 "launchpad-beta-testers team.")
237
238 def checkArchiveSizeQuota(self, upload):218 def checkArchiveSizeQuota(self, upload):
239 """Reject the upload if target archive size quota will be exceeded.219 """Reject the upload if target archive size quota will be exceeded.
240220
@@ -277,18 +257,10 @@
277 def policySpecificChecks(self, upload):257 def policySpecificChecks(self, upload):
278 """The insecure policy does not allow SECURITY uploads for now.258 """The insecure policy does not allow SECURITY uploads for now.
279259
280 If the upload is targeted to any PPA, checks if the signer is an260 If the upload is targeted to any PPA, checks if the upload is within
281 Ubuntu Code of Conduct signer, and if so is a member of261 the allowed quota.
282 'launchpad-beta-tests'.
283 """262 """
284 if upload.is_ppa:263 if upload.is_ppa:
285 # XXX cprov 2007-06-13: checks for PPA uploads are not yet
286 # established. We may decide for only one of the checks. Either
287 # in a specific team or having an Ubuntu CoC signer (or similar
288 # flag). This code will be revisited before releasing PPA
289 # publicly.
290 self.checkSignerIsUbuntuCodeOfConductSignee(upload)
291 #self.checkSignerIsBetaTester(upload)
292 self.checkArchiveSizeQuota(upload)264 self.checkArchiveSizeQuota(upload)
293 else:265 else:
294 if self.pocket == PackagePublishingPocket.SECURITY:266 if self.pocket == PackagePublishingPocket.SECURITY: