Merge lp://staging/~julian-edwards/launchpad/auto-accept-copy-archive-binaries-bug-520520 into lp://staging/launchpad

Proposed by Julian Edwards
Status: Merged
Merged at revision: not available
Proposed branch: lp://staging/~julian-edwards/launchpad/auto-accept-copy-archive-binaries-bug-520520
Merge into: lp://staging/launchpad
Diff against target: 67 lines (+31/-2)
2 files modified
lib/lp/archiveuploader/nascentupload.py (+9/-2)
lib/lp/archiveuploader/tests/test_uploadprocessor.py (+22/-0)
To merge this branch: bzr merge lp://staging/~julian-edwards/launchpad/auto-accept-copy-archive-binaries-bug-520520
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+20217@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) wrote :

= Summary =
Add copy archive binary upload overrides.

== Proposed fix ==
This is a further tweak to my previous version of this branch that auto-
accepts COPY archive binaries. We also need to make sure that the uploaded
binary gets overrides applied from the main archive - this means it has to get
the same component as the same version in the main archive.

== Pre-implementation notes ==
Thanks to wgrant for pointing this out :)

== Implementation details ==
Partial diff here in case LP doesn't work it out:
http://pastebin.ubuntu.com/384376/

== Tests ==
bin/test -cvv test_uploadprocessor

= Launchpad lint =

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/archiveuploader/nascentupload.py
  lib/lp/archiveuploader/tests/test_uploadprocessor.py

Revision history for this message
Abel Deuring (adeuring) :
review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/archiveuploader/nascentupload.py'
--- lib/lp/archiveuploader/nascentupload.py 2010-02-26 10:59:07 +0000
+++ lib/lp/archiveuploader/nascentupload.py 2010-02-26 15:45:37 +0000
@@ -582,7 +582,10 @@
582 # See the comment below, in getSourceAncestry582 # See the comment below, in getSourceAncestry
583 lookup_pockets = [self.policy.pocket, PackagePublishingPocket.RELEASE]583 lookup_pockets = [self.policy.pocket, PackagePublishingPocket.RELEASE]
584584
585 if self.policy.archive.purpose not in MAIN_ARCHIVE_PURPOSES:585 # If the archive is a main archive or a copy archive, we want to
586 # look up the ancestry in all the main archives.
587 if (self.policy.archive.purpose not in MAIN_ARCHIVE_PURPOSES and
588 not self.policy.archive.is_copy):
586 archive = self.policy.archive589 archive = self.policy.archive
587 else:590 else:
588 archive = None591 archive = None
@@ -777,7 +780,11 @@
777 # fine.780 # fine.
778 ancestry = self.getBinaryAncestry(781 ancestry = self.getBinaryAncestry(
779 uploaded_file, try_other_archs=False)782 uploaded_file, try_other_archs=False)
780 if ancestry is not None:783 if (ancestry is not None and
784 not self.policy.archive.is_copy):
785 # Ignore version checks for copy archives
786 # because the ancestry comes from the primary
787 # which may have changed since the copy.
781 self.checkBinaryVersion(uploaded_file, ancestry)788 self.checkBinaryVersion(uploaded_file, ancestry)
782 else:789 else:
783 self.logger.debug(790 self.logger.debug(
784791
=== modified file 'lib/lp/archiveuploader/tests/test_uploadprocessor.py'
--- lib/lp/archiveuploader/tests/test_uploadprocessor.py 2010-02-26 10:59:07 +0000
+++ lib/lp/archiveuploader/tests/test_uploadprocessor.py 2010-02-26 15:45:37 +0000
@@ -548,6 +548,22 @@
548 name="bar")548 name="bar")
549 queue_item.setDone()549 queue_item.setDone()
550550
551 # Upload and accept a binary for the primary archive source.
552 shutil.rmtree(upload_dir)
553 self.options.context = 'buildd'
554 self.options.buildid = bar_original_build.id
555 self.layer.txn.commit()
556 upload_dir = self.queueUpload("bar_1.0-1_binary")
557 self.processUpload(uploadprocessor, upload_dir)
558 self.assertEqual(
559 uploadprocessor.last_processed_upload.is_rejected, False)
560 bar_bin_pubs = self._publishPackage('bar', '1.0-1', source=False)
561 # Mangle its publishing component to "restricted" so we can check
562 # the copy archive ancestry override later.
563 restricted = getUtility(IComponentSet)["restricted"]
564 for pub in bar_bin_pubs:
565 pub.secure_record.component = restricted
566
551 # Create a COPY archive for building in non-virtual builds.567 # Create a COPY archive for building in non-virtual builds.
552 uploader = getUtility(IPersonSet).getByName('name16')568 uploader = getUtility(IPersonSet).getByName('name16')
553 copy_archive = getUtility(IArchiveSet).new(569 copy_archive = getUtility(IArchiveSet).new(
@@ -586,6 +602,12 @@
586 queue_items.count(), 1,602 queue_items.count(), 1,
587 "Binary upload was not accepted when it should have been.")603 "Binary upload was not accepted when it should have been.")
588604
605 # The copy archive binary published component should have been
606 # inherited from the main archive's.
607 copy_bin_pubs = queue_items[0].realiseUpload()
608 for pub in copy_bin_pubs:
609 self.assertEqual(pub.component.name, restricted.name)
610
589 def testCopyArchiveUploadToCurrentDistro(self):611 def testCopyArchiveUploadToCurrentDistro(self):
590 """Check binary copy archive uploads to RELEASE pockets.612 """Check binary copy archive uploads to RELEASE pockets.
591613