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
1=== modified file 'lib/lp/soyuz/configure.zcml'
2--- lib/lp/soyuz/configure.zcml 2010-03-11 22:15:29 +0000
3+++ lib/lp/soyuz/configure.zcml 2010-03-24 07:10:05 +0000
4@@ -225,6 +225,8 @@
5 class="canonical.launchpad.database.PackageUploadCustom">
6 <allow
7 interface="lp.soyuz.interfaces.queue.IPackageUploadCustom"/>
8+ <require
9+ permission="launchpad.Admin" set_attributes="libraryfilealias"/>
10 </class>
11
12 <!-- PackageUploadSet -->
13
14=== modified file 'lib/lp/soyuz/model/queue.py'
15--- lib/lp/soyuz/model/queue.py 2010-03-18 20:32:12 +0000
16+++ lib/lp/soyuz/model/queue.py 2010-03-24 07:10:05 +0000
17@@ -612,6 +612,11 @@
18 for new_file in update_files_privacy(pub_record):
19 debug(logger,
20 "Re-uploaded %s to librarian" % new_file.filename)
21+ for custom_file in self.customfiles:
22+ update_files_privacy(custom_file)
23+ debug(logger,
24+ "Re-uploaded custom file %s to librarian" %
25+ new_file.filename)
26 if ISourcePackagePublishingHistory.providedBy(pub_record):
27 pas_verify = BuildDaemonPackagesArchSpecific(
28 config.builddmaster.root, self.distroseries)
29
30=== modified file 'lib/lp/soyuz/scripts/packagecopier.py'
31--- lib/lp/soyuz/scripts/packagecopier.py 2010-03-06 04:57:40 +0000
32+++ lib/lp/soyuz/scripts/packagecopier.py 2010-03-24 07:10:05 +0000
33@@ -32,7 +32,8 @@
34 from lp.soyuz.interfaces.publishing import (
35 IBinaryPackagePublishingHistory, IPublishingSet,
36 ISourcePackagePublishingHistory, active_publishing_status)
37-from lp.soyuz.interfaces.queue import IPackageUpload, IPackageUploadSet
38+from lp.soyuz.interfaces.queue import (
39+ IPackageUpload, IPackageUploadCustom, IPackageUploadSet)
40 from lp.soyuz.interfaces.sourcepackageformat import SourcePackageFormat
41 from lp.soyuz.scripts.ftpmasterbase import SoyuzScript, SoyuzScriptError
42 from lp.soyuz.scripts.processaccepted import close_bugs_for_sourcepublication
43@@ -74,7 +75,7 @@
44 # XXX cprov 2009-06-12: this function should be incorporated in
45 # IPublishing.
46 def update_files_privacy(pub_record):
47- """Update file privacy according the publishing detination
48+ """Update file privacy according the publishing destination
49
50 :param pub_record: One of a SourcePackagePublishingHistory or
51 BinaryPackagePublishingHistory record.
52@@ -82,7 +83,9 @@
53 :return: a list of re-uploaded `LibraryFileAlias` objects.
54 """
55 package_files = []
56+ archive = None
57 if ISourcePackagePublishingHistory.providedBy(pub_record):
58+ archive = pub_record.archive
59 # Re-upload the package files files if necessary.
60 sourcepackagerelease = pub_record.sourcepackagerelease
61 package_files.extend(
62@@ -96,6 +99,7 @@
63 package_upload = sourcepackagerelease.package_upload
64 package_files.append((package_upload, 'changesfile'))
65 elif IBinaryPackagePublishingHistory.providedBy(pub_record):
66+ archive = pub_record.archive
67 # Re-upload the binary files if necessary.
68 binarypackagerelease = pub_record.binarypackagerelease
69 package_files.extend(
70@@ -107,10 +111,15 @@
71 package_files.append((package_upload, 'changesfile'))
72 # Re-upload the buildlog file as necessary.
73 package_files.append((build, 'buildlog'))
74+ elif IPackageUploadCustom.providedBy(pub_record):
75+ # Re-upload the custom files included
76+ package_files.append((pub_record, 'libraryfilealias'))
77+ # And set archive to the right attribute for PUCs
78+ archive = pub_record.packageupload.archive
79 else:
80 raise AssertionError(
81- "pub_record is not one of SourcePackagePublishingHistory "
82- "or BinaryPackagePublishingHistory.")
83+ "pub_record is not one of SourcePackagePublishingHistory, "
84+ "BinaryPackagePublishingHistory or PackageUploadCustom.")
85
86 re_uploaded_files = []
87 for obj, attr_name in package_files:
88@@ -119,11 +128,11 @@
89 # not the opposite. We don't have a use-case for privatizing
90 # files yet.
91 if (old_lfa is None or
92- old_lfa.restricted == pub_record.archive.private or
93+ old_lfa.restricted == archive.private or
94 old_lfa.restricted == False):
95 continue
96 new_lfa = re_upload_file(
97- old_lfa, restricted=pub_record.archive.private)
98+ old_lfa, restricted=archive.private)
99 setattr(obj, attr_name, new_lfa)
100 re_uploaded_files.append(new_lfa)
101
102
103=== modified file 'lib/lp/soyuz/scripts/tests/test_copypackage.py'
104--- lib/lp/soyuz/scripts/tests/test_copypackage.py 2010-03-06 04:57:40 +0000
105+++ lib/lp/soyuz/scripts/tests/test_copypackage.py 2010-03-24 07:10:05 +0000
106@@ -177,8 +177,8 @@
107 # or `IBinaryPackagePublishingHistory` objects.
108 self.assertRaisesWithContent(
109 AssertionError,
110- 'pub_record is not one of SourcePackagePublishingHistory '
111- 'or BinaryPackagePublishingHistory.',
112+ 'pub_record is not one of SourcePackagePublishingHistory, '
113+ 'BinaryPackagePublishingHistory or PackageUploadCustom.',
114 update_files_privacy, None)
115
116 def assertNewFiles(self, new_files, result):
117
118=== modified file 'lib/lp/soyuz/tests/test_packageupload.py'
119--- lib/lp/soyuz/tests/test_packageupload.py 2010-03-17 08:57:02 +0000
120+++ lib/lp/soyuz/tests/test_packageupload.py 2010-03-24 07:10:05 +0000
121@@ -273,6 +273,10 @@
122 'main/dist-upgrader-all')
123 self.assertEquals(
124 ['20060302.0120', 'current'], sorted(os.listdir(custom_path)))
125+
126+ # The custom files were also copied to the public librarian
127+ for customfile in delayed_copy.customfiles:
128+ self.assertFalse(customfile.libraryfilealias.restricted)
129
130 def test_realiseUpload_for_source_only_delayed_copies(self):
131 # Source-only delayed-copies results in the source published