Merge lp:~stevenk/launchpad/fixes-bug-503258 into lp:launchpad

Proposed by Steve Kowalik
Status: Merged
Approved by: Eleanor Berger
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~stevenk/launchpad/fixes-bug-503258
Merge into: lp:launchpad
Diff against target: 131 lines (+28/-8)
5 files modified
lib/lp/soyuz/configure.zcml (+2/-0)
lib/lp/soyuz/model/queue.py (+5/-0)
lib/lp/soyuz/scripts/packagecopier.py (+15/-6)
lib/lp/soyuz/scripts/tests/test_copypackage.py (+2/-2)
lib/lp/soyuz/tests/test_packageupload.py (+4/-0)
To merge this branch: bzr merge lp:~stevenk/launchpad/fixes-bug-503258
Reviewer Review Type Date Requested Status
Eleanor Berger (community) code Approve
Review via email: mp+21710@code.launchpad.net

Commit message

Also copy custom upload files from the restricted librarian to the unrestricted librarian when doing delayed copies.

Description of the change

This branch enables copying of custom upload files from the restricted librarian to the unrestricted librarian when doing delayed copies, and updates the test to exercise that.

To post a comment you must log in.
Revision history for this message
Eleanor Berger (intellectronica) wrote :

1. Please sort the imports alphabetically.
2. assertEquals(False... --> assertFalse.

Other than that it's all good.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/soyuz/configure.zcml'
--- lib/lp/soyuz/configure.zcml 2010-03-11 22:15:29 +0000
+++ lib/lp/soyuz/configure.zcml 2010-03-24 07:10:05 +0000
@@ -225,6 +225,8 @@
225 class="canonical.launchpad.database.PackageUploadCustom">225 class="canonical.launchpad.database.PackageUploadCustom">
226 <allow226 <allow
227 interface="lp.soyuz.interfaces.queue.IPackageUploadCustom"/>227 interface="lp.soyuz.interfaces.queue.IPackageUploadCustom"/>
228 <require
229 permission="launchpad.Admin" set_attributes="libraryfilealias"/>
228 </class>230 </class>
229231
230 <!-- PackageUploadSet -->232 <!-- PackageUploadSet -->
231233
=== modified file 'lib/lp/soyuz/model/queue.py'
--- lib/lp/soyuz/model/queue.py 2010-03-18 20:32:12 +0000
+++ lib/lp/soyuz/model/queue.py 2010-03-24 07:10:05 +0000
@@ -612,6 +612,11 @@
612 for new_file in update_files_privacy(pub_record):612 for new_file in update_files_privacy(pub_record):
613 debug(logger,613 debug(logger,
614 "Re-uploaded %s to librarian" % new_file.filename)614 "Re-uploaded %s to librarian" % new_file.filename)
615 for custom_file in self.customfiles:
616 update_files_privacy(custom_file)
617 debug(logger,
618 "Re-uploaded custom file %s to librarian" %
619 new_file.filename)
615 if ISourcePackagePublishingHistory.providedBy(pub_record):620 if ISourcePackagePublishingHistory.providedBy(pub_record):
616 pas_verify = BuildDaemonPackagesArchSpecific(621 pas_verify = BuildDaemonPackagesArchSpecific(
617 config.builddmaster.root, self.distroseries)622 config.builddmaster.root, self.distroseries)
618623
=== modified file 'lib/lp/soyuz/scripts/packagecopier.py'
--- lib/lp/soyuz/scripts/packagecopier.py 2010-03-06 04:57:40 +0000
+++ lib/lp/soyuz/scripts/packagecopier.py 2010-03-24 07:10:05 +0000
@@ -32,7 +32,8 @@
32from lp.soyuz.interfaces.publishing import (32from lp.soyuz.interfaces.publishing import (
33 IBinaryPackagePublishingHistory, IPublishingSet,33 IBinaryPackagePublishingHistory, IPublishingSet,
34 ISourcePackagePublishingHistory, active_publishing_status)34 ISourcePackagePublishingHistory, active_publishing_status)
35from lp.soyuz.interfaces.queue import IPackageUpload, IPackageUploadSet35from lp.soyuz.interfaces.queue import (
36 IPackageUpload, IPackageUploadCustom, IPackageUploadSet)
36from lp.soyuz.interfaces.sourcepackageformat import SourcePackageFormat37from lp.soyuz.interfaces.sourcepackageformat import SourcePackageFormat
37from lp.soyuz.scripts.ftpmasterbase import SoyuzScript, SoyuzScriptError38from lp.soyuz.scripts.ftpmasterbase import SoyuzScript, SoyuzScriptError
38from lp.soyuz.scripts.processaccepted import close_bugs_for_sourcepublication39from lp.soyuz.scripts.processaccepted import close_bugs_for_sourcepublication
@@ -74,7 +75,7 @@
74# XXX cprov 2009-06-12: this function should be incorporated in75# XXX cprov 2009-06-12: this function should be incorporated in
75# IPublishing.76# IPublishing.
76def update_files_privacy(pub_record):77def update_files_privacy(pub_record):
77 """Update file privacy according the publishing detination78 """Update file privacy according the publishing destination
7879
79 :param pub_record: One of a SourcePackagePublishingHistory or80 :param pub_record: One of a SourcePackagePublishingHistory or
80 BinaryPackagePublishingHistory record.81 BinaryPackagePublishingHistory record.
@@ -82,7 +83,9 @@
82 :return: a list of re-uploaded `LibraryFileAlias` objects.83 :return: a list of re-uploaded `LibraryFileAlias` objects.
83 """84 """
84 package_files = []85 package_files = []
86 archive = None
85 if ISourcePackagePublishingHistory.providedBy(pub_record):87 if ISourcePackagePublishingHistory.providedBy(pub_record):
88 archive = pub_record.archive
86 # Re-upload the package files files if necessary.89 # Re-upload the package files files if necessary.
87 sourcepackagerelease = pub_record.sourcepackagerelease90 sourcepackagerelease = pub_record.sourcepackagerelease
88 package_files.extend(91 package_files.extend(
@@ -96,6 +99,7 @@
96 package_upload = sourcepackagerelease.package_upload99 package_upload = sourcepackagerelease.package_upload
97 package_files.append((package_upload, 'changesfile'))100 package_files.append((package_upload, 'changesfile'))
98 elif IBinaryPackagePublishingHistory.providedBy(pub_record):101 elif IBinaryPackagePublishingHistory.providedBy(pub_record):
102 archive = pub_record.archive
99 # Re-upload the binary files if necessary.103 # Re-upload the binary files if necessary.
100 binarypackagerelease = pub_record.binarypackagerelease104 binarypackagerelease = pub_record.binarypackagerelease
101 package_files.extend(105 package_files.extend(
@@ -107,10 +111,15 @@
107 package_files.append((package_upload, 'changesfile'))111 package_files.append((package_upload, 'changesfile'))
108 # Re-upload the buildlog file as necessary.112 # Re-upload the buildlog file as necessary.
109 package_files.append((build, 'buildlog'))113 package_files.append((build, 'buildlog'))
114 elif IPackageUploadCustom.providedBy(pub_record):
115 # Re-upload the custom files included
116 package_files.append((pub_record, 'libraryfilealias'))
117 # And set archive to the right attribute for PUCs
118 archive = pub_record.packageupload.archive
110 else:119 else:
111 raise AssertionError(120 raise AssertionError(
112 "pub_record is not one of SourcePackagePublishingHistory "121 "pub_record is not one of SourcePackagePublishingHistory, "
113 "or BinaryPackagePublishingHistory.")122 "BinaryPackagePublishingHistory or PackageUploadCustom.")
114123
115 re_uploaded_files = []124 re_uploaded_files = []
116 for obj, attr_name in package_files:125 for obj, attr_name in package_files:
@@ -119,11 +128,11 @@
119 # not the opposite. We don't have a use-case for privatizing128 # not the opposite. We don't have a use-case for privatizing
120 # files yet.129 # files yet.
121 if (old_lfa is None or130 if (old_lfa is None or
122 old_lfa.restricted == pub_record.archive.private or131 old_lfa.restricted == archive.private or
123 old_lfa.restricted == False):132 old_lfa.restricted == False):
124 continue133 continue
125 new_lfa = re_upload_file(134 new_lfa = re_upload_file(
126 old_lfa, restricted=pub_record.archive.private)135 old_lfa, restricted=archive.private)
127 setattr(obj, attr_name, new_lfa)136 setattr(obj, attr_name, new_lfa)
128 re_uploaded_files.append(new_lfa)137 re_uploaded_files.append(new_lfa)
129138
130139
=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2010-03-06 04:57:40 +0000
+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2010-03-24 07:10:05 +0000
@@ -177,8 +177,8 @@
177 # or `IBinaryPackagePublishingHistory` objects.177 # or `IBinaryPackagePublishingHistory` objects.
178 self.assertRaisesWithContent(178 self.assertRaisesWithContent(
179 AssertionError,179 AssertionError,
180 'pub_record is not one of SourcePackagePublishingHistory '180 'pub_record is not one of SourcePackagePublishingHistory, '
181 'or BinaryPackagePublishingHistory.',181 'BinaryPackagePublishingHistory or PackageUploadCustom.',
182 update_files_privacy, None)182 update_files_privacy, None)
183183
184 def assertNewFiles(self, new_files, result):184 def assertNewFiles(self, new_files, result):
185185
=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
--- lib/lp/soyuz/tests/test_packageupload.py 2010-03-17 08:57:02 +0000
+++ lib/lp/soyuz/tests/test_packageupload.py 2010-03-24 07:10:05 +0000
@@ -273,6 +273,10 @@
273 'main/dist-upgrader-all')273 'main/dist-upgrader-all')
274 self.assertEquals(274 self.assertEquals(
275 ['20060302.0120', 'current'], sorted(os.listdir(custom_path)))275 ['20060302.0120', 'current'], sorted(os.listdir(custom_path)))
276
277 # The custom files were also copied to the public librarian
278 for customfile in delayed_copy.customfiles:
279 self.assertFalse(customfile.libraryfilealias.restricted)
276280
277 def test_realiseUpload_for_source_only_delayed_copies(self):281 def test_realiseUpload_for_source_only_delayed_copies(self):
278 # Source-only delayed-copies results in the source published282 # Source-only delayed-copies results in the source published