Merge ~cjwatson/launchpad:stormify-publishinghistory into launchpad:master

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: 88cec55c0c38130fe873aac082cc14d2c6b43dfb
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~cjwatson/launchpad:stormify-publishinghistory
Merge into: launchpad:master
Diff against target: 3142 lines (+611/-501)
51 files modified
lib/lp/archivepublisher/deathrow.py (+6/-6)
lib/lp/archivepublisher/domination.py (+10/-16)
lib/lp/archivepublisher/model/ftparchive.py (+10/-10)
lib/lp/archivepublisher/publishing.py (+8/-8)
lib/lp/archivepublisher/scripts/publish_ftpmaster.py (+1/-1)
lib/lp/archivepublisher/tests/test_publisher.py (+17/-16)
lib/lp/bugs/model/bugtasksearch.py (+2/-2)
lib/lp/registry/browser/distributionsourcepackage.py (+1/-1)
lib/lp/registry/model/distribution.py (+9/-6)
lib/lp/registry/model/distributionmirror.py (+1/-1)
lib/lp/registry/model/distributionsourcepackage.py (+9/-9)
lib/lp/registry/model/distroseries.py (+10/-10)
lib/lp/registry/model/distroseriesdifference.py (+8/-8)
lib/lp/registry/model/person.py (+16/-14)
lib/lp/registry/model/sourcepackage.py (+3/-3)
lib/lp/scripts/garbo.py (+7/-6)
lib/lp/services/database/doc/decoratedresultset.rst (+1/-1)
lib/lp/soyuz/adapters/overrides.py (+21/-22)
lib/lp/soyuz/doc/distribution.rst (+1/-1)
lib/lp/soyuz/doc/distroarchseriesbinarypackage.rst (+2/-10)
lib/lp/soyuz/doc/distroseriesqueue-translations.rst (+1/-1)
lib/lp/soyuz/doc/gina-multiple-arch.rst (+9/-6)
lib/lp/soyuz/doc/gina.rst (+76/-53)
lib/lp/soyuz/doc/soyuz-set-of-uploads.rst (+16/-22)
lib/lp/soyuz/doc/soyuz-upload.rst (+15/-7)
lib/lp/soyuz/interfaces/publishing.py (+9/-9)
lib/lp/soyuz/interfaces/sourcepackagerelease.py (+1/-1)
lib/lp/soyuz/model/archive.py (+30/-32)
lib/lp/soyuz/model/binarypackagebuild.py (+1/-1)
lib/lp/soyuz/model/binarypackagename.py (+4/-4)
lib/lp/soyuz/model/binarysourcereference.py (+1/-1)
lib/lp/soyuz/model/distributionsourcepackagecache.py (+3/-3)
lib/lp/soyuz/model/distributionsourcepackagerelease.py (+11/-11)
lib/lp/soyuz/model/distroarchseries.py (+2/-2)
lib/lp/soyuz/model/distroarchseriesbinarypackage.py (+2/-2)
lib/lp/soyuz/model/distroarchseriesbinarypackagerelease.py (+2/-2)
lib/lp/soyuz/model/distroseriesbinarypackage.py (+1/-1)
lib/lp/soyuz/model/distroseriesdifferencejob.py (+1/-1)
lib/lp/soyuz/model/distroseriespackagecache.py (+6/-6)
lib/lp/soyuz/model/publishing.py (+217/-137)
lib/lp/soyuz/model/queue.py (+2/-2)
lib/lp/soyuz/model/sourcepackagerelease.py (+29/-16)
lib/lp/soyuz/scripts/expire_archive_files.py (+4/-4)
lib/lp/soyuz/scripts/gina/handlers.py (+1/-5)
lib/lp/soyuz/scripts/packagecopier.py (+4/-2)
lib/lp/soyuz/scripts/tests/test_copypackage.py (+1/-1)
lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py (+2/-2)
lib/lp/soyuz/tests/test_hasbuildrecords.py (+1/-1)
lib/lp/soyuz/tests/test_publishing.py (+13/-12)
lib/lp/translations/model/vpoexport.py (+1/-1)
lib/lp/translations/scripts/copy_distroseries_translations.py (+2/-2)
Reviewer Review Type Date Requested Status
Guruprasad Approve
Review via email: mp+446200@code.launchpad.net

Commit message

Convert {Source,Binary}PackagePublishingHistory to Storm

To post a comment you must log in.
Revision history for this message
Guruprasad (lgp171188) wrote :

Phew! That was a huge diff! Great work on meticulously and carefully updating all the relevant lines! 🎉

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/archivepublisher/deathrow.py b/lib/lp/archivepublisher/deathrow.py
2index cca0368..38a0ca4 100644
3--- a/lib/lp/archivepublisher/deathrow.py
4+++ b/lib/lp/archivepublisher/deathrow.py
5@@ -115,9 +115,9 @@ class DeathRow:
6 1,
7 tables=[OtherSPPH],
8 where=And(
9- SourcePackagePublishingHistory.sourcepackagereleaseID
10- == OtherSPPH.sourcepackagereleaseID,
11- OtherSPPH.archiveID == self.archive.id,
12+ SourcePackagePublishingHistory.sourcepackagerelease_id
13+ == OtherSPPH.sourcepackagerelease_id,
14+ OtherSPPH.archive_id == self.archive.id,
15 Not(OtherSPPH.status.is_in(inactive_publishing_status)),
16 ),
17 )
18@@ -139,9 +139,9 @@ class DeathRow:
19 1,
20 tables=[OtherBPPH],
21 where=And(
22- BinaryPackagePublishingHistory.binarypackagereleaseID
23- == OtherBPPH.binarypackagereleaseID,
24- OtherBPPH.archiveID == self.archive.id,
25+ BinaryPackagePublishingHistory.binarypackagerelease_id
26+ == OtherBPPH.binarypackagerelease_id,
27+ OtherBPPH.archive_id == self.archive.id,
28 Not(OtherBPPH.status.is_in(inactive_publishing_status)),
29 ),
30 )
31diff --git a/lib/lp/archivepublisher/domination.py b/lib/lp/archivepublisher/domination.py
32index 466d1ba..a8df607 100644
33--- a/lib/lp/archivepublisher/domination.py
34+++ b/lib/lp/archivepublisher/domination.py
35@@ -101,7 +101,7 @@ def join_spph_spn():
36 SPPH = SourcePackagePublishingHistory
37 SPN = SourcePackageName
38
39- return SPN.id == SPPH.sourcepackagenameID
40+ return SPN.id == SPPH.sourcepackagename_id
41
42
43 def join_spph_spr():
44@@ -109,7 +109,7 @@ def join_spph_spr():
45 SPPH = SourcePackagePublishingHistory
46 SPR = SourcePackageRelease
47
48- return SPR.id == SPPH.sourcepackagereleaseID
49+ return SPR.id == SPPH.sourcepackagerelease_id
50
51
52 class SourcePublicationTraits:
53@@ -119,9 +119,6 @@ class SourcePublicationTraits:
54 `BinaryPackagePublishingHistory`.
55 """
56
57- release_class = SourcePackageRelease
58- release_reference_name = "sourcepackagereleaseID"
59-
60 @staticmethod
61 def getPackageName(spph):
62 """Return the name of this publication's source package."""
63@@ -140,9 +137,6 @@ class BinaryPublicationTraits:
64 `SourcePackagePublishingHistory`.
65 """
66
67- release_class = BinaryPackageRelease
68- release_reference_name = "binarypackagereleaseID"
69-
70 @staticmethod
71 def getPackageName(bpph):
72 """Return the name of this publication's binary package."""
73@@ -654,13 +648,13 @@ class Dominator:
74 BPPH.pocket == pocket,
75 ]
76 candidate_binary_names = Select(
77- BPPH.binarypackagenameID,
78+ BPPH.binarypackagename_id,
79 And(*bpph_location_clauses),
80- group_by=(BPPH.binarypackagenameID, BPPH._channel),
81+ group_by=(BPPH.binarypackagename_id, BPPH._channel),
82 having=(Count() > 1),
83 )
84 main_clauses = bpph_location_clauses + [
85- BPR.id == BPPH.binarypackagereleaseID,
86+ BPR.id == BPPH.binarypackagerelease_id,
87 BPR.binarypackagenameID.is_in(candidate_binary_names),
88 BPR.binpackageformat != BinaryPackageFormat.DDEB,
89 ]
90@@ -672,7 +666,7 @@ class Dominator:
91 # the join would complicate the query.
92 query = IStore(BPPH).find((BPPH, BPR), *main_clauses)
93 bpphs = list(DecoratedResultSet(query, itemgetter(0)))
94- load_related(BinaryPackageName, bpphs, ["binarypackagenameID"])
95+ load_related(BinaryPackageName, bpphs, ["binarypackagename_id"])
96 return bpphs
97
98 def dominateBinaries(self, distroseries, pocket):
99@@ -814,9 +808,9 @@ class Dominator:
100 distroseries, pocket
101 )
102 candidate_source_names = Select(
103- SPPH.sourcepackagenameID,
104+ SPPH.sourcepackagename_id,
105 And(join_spph_spr(), spph_location_clauses),
106- group_by=(SPPH.sourcepackagenameID, SPPH._channel),
107+ group_by=(SPPH.sourcepackagename_id, SPPH._channel),
108 having=(Count() > 1),
109 )
110
111@@ -829,11 +823,11 @@ class Dominator:
112 query = IStore(SPPH).find(
113 (SPPH, SPR),
114 join_spph_spr(),
115- SPPH.sourcepackagenameID.is_in(candidate_source_names),
116+ SPPH.sourcepackagename_id.is_in(candidate_source_names),
117 spph_location_clauses,
118 )
119 spphs = DecoratedResultSet(query, itemgetter(0))
120- load_related(SourcePackageName, spphs, ["sourcepackagenameID"])
121+ load_related(SourcePackageName, spphs, ["sourcepackagename_id"])
122 return spphs
123
124 def dominateSources(self, distroseries, pocket):
125diff --git a/lib/lp/archivepublisher/model/ftparchive.py b/lib/lp/archivepublisher/model/ftparchive.py
126index ba801ae..3492a7a 100644
127--- a/lib/lp/archivepublisher/model/ftparchive.py
128+++ b/lib/lp/archivepublisher/model/ftparchive.py
129@@ -306,7 +306,7 @@ class FTPArchiveHandler:
130 Join(
131 SourcePackageRelease,
132 SourcePackageRelease.id
133- == SourcePackagePublishingHistory.sourcepackagereleaseID,
134+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
135 ),
136 Join(
137 SourcePackageName,
138@@ -356,7 +356,7 @@ class FTPArchiveHandler:
139 Join(
140 BinaryPackageRelease,
141 BinaryPackageRelease.id
142- == BinaryPackagePublishingHistory.binarypackagereleaseID,
143+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
144 ),
145 Join(
146 BinaryPackageName,
147@@ -366,7 +366,7 @@ class FTPArchiveHandler:
148 Join(
149 DistroArchSeries,
150 DistroArchSeries.id
151- == BinaryPackagePublishingHistory.distroarchseriesID,
152+ == BinaryPackagePublishingHistory.distroarchseries_id,
153 ),
154 )
155
156@@ -376,7 +376,7 @@ class FTPArchiveHandler:
157
158 conditions = [
159 BinaryPackagePublishingHistory.archive == self.publisher.archive,
160- BinaryPackagePublishingHistory.distroarchseriesID.is_in(
161+ BinaryPackagePublishingHistory.distroarchseries_id.is_in(
162 architectures_ids
163 ),
164 BinaryPackagePublishingHistory.pocket == pocket,
165@@ -672,15 +672,15 @@ class FTPArchiveHandler:
166 )
167 join_conditions = [
168 SourcePackageReleaseFile.sourcepackagerelease_id
169- == SourcePackagePublishingHistory.sourcepackagereleaseID,
170+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
171 SourcePackageName.id
172- == SourcePackagePublishingHistory.sourcepackagenameID,
173+ == SourcePackagePublishingHistory.sourcepackagename_id,
174 LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
175 Component.id == SourcePackagePublishingHistory.component_id,
176 ]
177 select_conditions = [
178 SourcePackagePublishingHistory.archive == self.publisher.archive,
179- SourcePackagePublishingHistory.distroseriesID == distroseries.id,
180+ SourcePackagePublishingHistory.distroseries_id == distroseries.id,
181 SourcePackagePublishingHistory.pocket == pocket,
182 SourcePackagePublishingHistory.status
183 == PackagePublishingStatus.PUBLISHED,
184@@ -712,14 +712,14 @@ class FTPArchiveHandler:
185 )
186 join_conditions = [
187 BinaryPackageRelease.id
188- == BinaryPackagePublishingHistory.binarypackagereleaseID,
189+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
190 BinaryPackageFile.binarypackagerelease_id
191- == BinaryPackagePublishingHistory.binarypackagereleaseID,
192+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
193 BinaryPackageBuild.id == BinaryPackageRelease.buildID,
194 SourcePackageName.id == BinaryPackageBuild.source_package_name_id,
195 LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
196 DistroArchSeries.id
197- == BinaryPackagePublishingHistory.distroarchseriesID,
198+ == BinaryPackagePublishingHistory.distroarchseries_id,
199 Component.id == BinaryPackagePublishingHistory.component_id,
200 ]
201 select_conditions = [
202diff --git a/lib/lp/archivepublisher/publishing.py b/lib/lp/archivepublisher/publishing.py
203index 8eee4ed..30fee6a 100644
204--- a/lib/lp/archivepublisher/publishing.py
205+++ b/lib/lp/archivepublisher/publishing.py
206@@ -522,7 +522,7 @@ class Publisher:
207 SourcePackagePublishingHistory, *clauses
208 )
209 return publications.order_by(
210- SourcePackagePublishingHistory.distroseriesID,
211+ SourcePackagePublishingHistory.distroseries_id,
212 SourcePackagePublishingHistory.pocket,
213 Desc(SourcePackagePublishingHistory.id),
214 )
215@@ -571,7 +571,7 @@ class Publisher:
216 """Return the specific group of binary records to be published."""
217 clauses = [
218 BinaryPackagePublishingHistory.archive == self.archive,
219- BinaryPackagePublishingHistory.distroarchseriesID
220+ BinaryPackagePublishingHistory.distroarchseries_id
221 == DistroArchSeries.id,
222 BinaryPackagePublishingHistory.status.is_in(
223 active_publishing_status
224@@ -678,7 +678,7 @@ class Publisher:
225 # Make the source publications query.
226 conditions = base_conditions(SourcePackagePublishingHistory)
227 conditions.append(
228- SourcePackagePublishingHistory.distroseriesID == DistroSeries.id
229+ SourcePackagePublishingHistory.distroseries_id == DistroSeries.id
230 )
231 source_suites = (
232 IStore(SourcePackagePublishingHistory)
233@@ -694,7 +694,7 @@ class Publisher:
234 conditions = base_conditions(BinaryPackagePublishingHistory)
235 conditions.extend(
236 [
237- BinaryPackagePublishingHistory.distroarchseriesID
238+ BinaryPackagePublishingHistory.distroarchseries_id
239 == DistroArchSeries.id,
240 DistroArchSeries.distroseriesID == DistroSeries.id,
241 ]
242@@ -794,15 +794,15 @@ class Publisher:
243 for spph in publishing_set.getSourcesForPublishing(
244 archive=self.archive
245 ):
246- spphs_by_spr[spph.sourcepackagereleaseID].append(spph)
247- release_id = "source:%d" % spph.sourcepackagereleaseID
248+ spphs_by_spr[spph.sourcepackagerelease_id].append(spph)
249+ release_id = "source:%d" % spph.sourcepackagerelease_id
250 releases_by_id.setdefault(release_id, spph.sourcepackagerelease)
251 pubs_by_id[release_id].append(spph)
252 for bpph in publishing_set.getBinariesForPublishing(
253 archive=self.archive
254 ):
255- bpphs_by_bpr[bpph.binarypackagereleaseID].append(bpph)
256- release_id = "binary:%d" % bpph.binarypackagereleaseID
257+ bpphs_by_bpr[bpph.binarypackagerelease_id].append(bpph)
258+ release_id = "binary:%d" % bpph.binarypackagerelease_id
259 releases_by_id.setdefault(release_id, bpph.binarypackagerelease)
260 pubs_by_id[release_id].append(bpph)
261 artifacts = self._diskpool.getAllArtifacts(
262diff --git a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
263index 2054e6e..b62e3b1 100644
264--- a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
265+++ b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
266@@ -290,7 +290,7 @@ class PublishFTPMaster(LaunchpadCronScript):
267 archive.getAllPublishedBinaries(only_unpublished=True)
268 )
269 load_related(
270- DistroArchSeries, pending_binaries, ["distroarchseriesID"]
271+ DistroArchSeries, pending_binaries, ["distroarchseries_id"]
272 )
273 return {
274 pub.distroseries.name + pocketsuffix[pub.pocket]
275diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
276index ab3fd82..be57298 100644
277--- a/lib/lp/archivepublisher/tests/test_publisher.py
278+++ b/lib/lp/archivepublisher/tests/test_publisher.py
279@@ -71,6 +71,7 @@ from lp.registry.interfaces.pocket import PackagePublishingPocket, pocketsuffix
280 from lp.registry.interfaces.series import SeriesStatus
281 from lp.services.config import config
282 from lp.services.database.constants import UTC_NOW
283+from lp.services.database.interfaces import IStore
284 from lp.services.database.sqlbase import flush_database_caches
285 from lp.services.gpg.interfaces import IGPGHandler
286 from lp.services.log.logger import BufferLogger, DevNullLogger
287@@ -302,8 +303,8 @@ class TestPublisherSeries(TestNativePublishingBase):
288 self._publish(pocket=pocket)
289
290 # source and binary PUBLISHED in database.
291- pub_source.sync()
292- pub_bin.sync()
293+ IStore(pub_source).flush()
294+ IStore(pub_bin).flush()
295 self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
296 self.assertEqual(pub_bin.status, PackagePublishingStatus.PUBLISHED)
297
298@@ -847,7 +848,7 @@ class TestPublisher(TestPublisherBase):
299 publisher.A_publish(False)
300 self.layer.txn.commit()
301
302- pub_source.sync()
303+ IStore(pub_source).flush()
304 self.assertEqual({"breezy-autotest"}, publisher.dirty_suites)
305 self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status)
306
307@@ -1122,8 +1123,8 @@ class TestPublisher(TestPublisherBase):
308 publisher.A_publish(force_publishing=False)
309 self.layer.txn.commit()
310
311- pub_source.sync()
312- pub_source2.sync()
313+ IStore(pub_source).flush()
314+ IStore(pub_source2).flush()
315 self.assertEqual({"hoary-test"}, publisher.dirty_suites)
316 self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source2.status)
317 self.assertEqual(PackagePublishingStatus.PENDING, pub_source.status)
318@@ -1156,8 +1157,8 @@ class TestPublisher(TestPublisherBase):
319 publisher.A_publish(force_publishing=False)
320 self.layer.txn.commit()
321
322- pub_source.sync()
323- pub_source2.sync()
324+ IStore(pub_source).flush()
325+ IStore(pub_source2).flush()
326 self.assertEqual({"breezy-autotest-updates"}, publisher.dirty_suites)
327 self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status)
328 self.assertEqual(PackagePublishingStatus.PENDING, pub_source2.status)
329@@ -1284,7 +1285,7 @@ class TestPublisher(TestPublisherBase):
330 publisher.A_publish(False)
331 self.layer.txn.commit()
332
333- pub_source.sync()
334+ IStore(pub_source).flush()
335 self.assertEqual({"breezy-autotest"}, publisher.dirty_suites)
336 self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status)
337
338@@ -4326,7 +4327,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
339 "deb.name": ["hello"],
340 "deb.version": ["1.0"],
341 "launchpad.release-id": [
342- "source:%d" % source.sourcepackagereleaseID
343+ "source:%d" % source.sourcepackagerelease_id
344 ],
345 "launchpad.source-name": ["hello"],
346 "launchpad.source-version": ["1.0"],
347@@ -4347,7 +4348,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
348 "deb.component": ["main"],
349 "deb.distribution": ["breezy-autotest"],
350 "launchpad.release-id": [
351- "binary:%d" % binary.binarypackagereleaseID
352+ "binary:%d" % binary.binarypackagerelease_id
353 ],
354 "launchpad.source-name": ["hello"],
355 "launchpad.source-version": ["1.0"],
356@@ -4429,7 +4430,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
357 "deb.name": ["hello"],
358 "deb.version": ["1.0"],
359 "launchpad.release-id": [
360- "source:%d" % source.sourcepackagereleaseID
361+ "source:%d" % source.sourcepackagerelease_id
362 ],
363 "launchpad.source-name": ["hello"],
364 "launchpad.source-version": ["1.0"],
365@@ -4445,7 +4446,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
366 "deb.name": ["hello"],
367 "deb.version": ["1.0"],
368 "launchpad.release-id": [
369- "source:%d" % source.sourcepackagereleaseID
370+ "source:%d" % source.sourcepackagerelease_id
371 ],
372 "launchpad.source-name": ["hello"],
373 "launchpad.source-version": ["1.0"],
374@@ -4460,7 +4461,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
375 "deb.component": ["main"],
376 "deb.distribution": ["breezy-autotest", "hoary-test"],
377 "launchpad.release-id": [
378- "binary:%d" % binary.binarypackagereleaseID
379+ "binary:%d" % binary.binarypackagerelease_id
380 ],
381 "launchpad.source-name": ["hello"],
382 "launchpad.source-version": ["1.0"],
383@@ -4538,7 +4539,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
384 "deb.name": ["hello"],
385 "deb.version": ["1.0-2"],
386 "launchpad.release-id": [
387- "source:%d" % spph.sourcepackagereleaseID
388+ "source:%d" % spph.sourcepackagerelease_id
389 ],
390 "launchpad.source-name": ["hello"],
391 "launchpad.source-version": ["1.0-2"],
392@@ -4600,7 +4601,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
393 "deb.name": ["hello"],
394 "deb.version": ["1.0"],
395 "launchpad.release-id": [
396- "source:%d" % source.sourcepackagereleaseID
397+ "source:%d" % source.sourcepackagerelease_id
398 ],
399 "launchpad.source-name": ["hello"],
400 "launchpad.source-version": ["1.0"],
401@@ -4612,7 +4613,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
402 self.assertEqual(
403 {
404 "launchpad.release-id": [
405- "binary:%d" % binary.binarypackagereleaseID
406+ "binary:%d" % binary.binarypackagerelease_id
407 ],
408 "launchpad.source-name": ["hello"],
409 "launchpad.source-version": ["1.0"],
410diff --git a/lib/lp/bugs/model/bugtasksearch.py b/lib/lp/bugs/model/bugtasksearch.py
411index 19598bc..9ec4c25 100644
412--- a/lib/lp/bugs/model/bugtasksearch.py
413+++ b/lib/lp/bugs/model/bugtasksearch.py
414@@ -649,10 +649,10 @@ def _build_query(params):
415 extra_clauses.append(
416 BugTaskFlat.sourcepackagename_id.is_in(
417 Select(
418- SourcePackagePublishingHistory.sourcepackagenameID,
419+ SourcePackagePublishingHistory.sourcepackagename_id,
420 tables=[SourcePackagePublishingHistory],
421 where=And(
422- SourcePackagePublishingHistory.archiveID.is_in(
423+ SourcePackagePublishingHistory.archive_id.is_in(
424 archive_ids
425 ),
426 SourcePackagePublishingHistory.distroseries
427diff --git a/lib/lp/registry/browser/distributionsourcepackage.py b/lib/lp/registry/browser/distributionsourcepackage.py
428index 78c31de..5590db8 100644
429--- a/lib/lp/registry/browser/distributionsourcepackage.py
430+++ b/lib/lp/registry/browser/distributionsourcepackage.py
431@@ -641,7 +641,7 @@ class PublishingHistoryViewMixin:
432 def _preload_people(self, pubs):
433 ids = set()
434 for spph in pubs:
435- ids.update((spph.removed_byID, spph.creatorID, spph.sponsorID))
436+ ids.update((spph.removed_by_id, spph.creator_id, spph.sponsor_id))
437 ids.discard(None)
438 if ids:
439 list(
440diff --git a/lib/lp/registry/model/distribution.py b/lib/lp/registry/model/distribution.py
441index 045fb98..cf764f9 100644
442--- a/lib/lp/registry/model/distribution.py
443+++ b/lib/lp/registry/model/distribution.py
444@@ -1622,7 +1622,7 @@ class Distribution(
445 origin.append(
446 Join(
447 SourcePackagePublishingHistory,
448- SourcePackagePublishingHistory.sourcepackagenameID
449+ SourcePackagePublishingHistory.sourcepackagename_id
450 == DistributionSourcePackageCache.sourcepackagename_id,
451 )
452 )
453@@ -1630,7 +1630,7 @@ class Distribution(
454 [
455 SourcePackagePublishingHistory.distroseries
456 == publishing_distroseries,
457- SourcePackagePublishingHistory.archiveID.is_in(
458+ SourcePackagePublishingHistory.archive_id.is_in(
459 self.all_distro_archive_ids
460 ),
461 ]
462@@ -1764,7 +1764,7 @@ class Distribution(
463 # archive data. (There are many, many PPAs to consider
464 # and PostgreSQL picks a bad query plan resulting in
465 # timeouts).
466- SourcePackagePublishingHistory.archiveID.is_in(
467+ SourcePackagePublishingHistory.archive_id.is_in(
468 self.all_distro_archive_ids
469 ),
470 SourcePackagePublishingHistory.sourcepackagename
471@@ -1804,7 +1804,7 @@ class Distribution(
472 # See comment above for rationale for using an extra query
473 # instead of an inner join. (Bottom line, it would time out
474 # otherwise.)
475- BinaryPackagePublishingHistory.archiveID.is_in(
476+ BinaryPackagePublishingHistory.archive_id.is_in(
477 self.all_distro_archive_ids
478 ),
479 BinaryPackagePublishingHistory.binarypackagename
480@@ -2163,7 +2163,7 @@ class Distribution(
481 Store.of(self)
482 .find(
483 SourcePackagePublishingHistory,
484- SourcePackagePublishingHistory.archiveID.is_in(
485+ SourcePackagePublishingHistory.archive_id.is_in(
486 self.all_distro_archive_ids
487 ),
488 )
489@@ -2456,7 +2456,10 @@ class DistributionSet:
490 distro_source_packagenames,
491 lambda distro: distro.all_distro_archive_ids,
492 lambda distro: DistroSeries.distribution == distro,
493- [SourcePackagePublishingHistory.distroseriesID == DistroSeries.id],
494+ [
495+ SourcePackagePublishingHistory.distroseries_id
496+ == DistroSeries.id
497+ ],
498 DistroSeries.distributionID,
499 )
500 result = {}
501diff --git a/lib/lp/registry/model/distributionmirror.py b/lib/lp/registry/model/distributionmirror.py
502index 7e5ec72..a672691 100644
503--- a/lib/lp/registry/model/distributionmirror.py
504+++ b/lib/lp/registry/model/distributionmirror.py
505@@ -981,7 +981,7 @@ class MirrorDistroArchSeries(StormBase, _MirrorSeriesMixIn):
506 if deb_only:
507 clauses.extend(
508 [
509- BinaryPackagePublishingHistory.binarypackagereleaseID
510+ BinaryPackagePublishingHistory.binarypackagerelease_id
511 == BinaryPackageFile.binarypackagerelease_id,
512 BinaryPackageFile.filetype == BinaryPackageFileType.DEB,
513 ]
514diff --git a/lib/lp/registry/model/distributionsourcepackage.py b/lib/lp/registry/model/distributionsourcepackage.py
515index 5235ff7..42a452d 100644
516--- a/lib/lp/registry/model/distributionsourcepackage.py
517+++ b/lib/lp/registry/model/distributionsourcepackage.py
518@@ -210,7 +210,7 @@ class DistributionSourcePackage(
519 DistroSeries.distribution == self.distribution,
520 SourcePackagePublishingHistory.sourcepackagename
521 == self.sourcepackagename,
522- SourcePackagePublishingHistory.archiveID.is_in(
523+ SourcePackagePublishingHistory.archive_id.is_in(
524 self.distribution.all_distro_archive_ids
525 ),
526 Not(
527@@ -245,7 +245,7 @@ class DistributionSourcePackage(
528 SourcePackageRelease,
529 SourcePackagePublishingHistory.distroseries == DistroSeries.id,
530 DistroSeries.distribution == self.distribution,
531- SourcePackagePublishingHistory.archiveID.is_in(
532+ SourcePackagePublishingHistory.archive_id.is_in(
533 self.distribution.all_distro_archive_ids
534 ),
535 SourcePackagePublishingHistory.sourcepackagerelease
536@@ -384,15 +384,15 @@ class DistributionSourcePackage(
537
538 def _getPublishingHistoryQuery(self, status=None):
539 conditions = [
540- SourcePackagePublishingHistory.archiveID.is_in(
541+ SourcePackagePublishingHistory.archive_id.is_in(
542 self.distribution.all_distro_archive_ids
543 ),
544- SourcePackagePublishingHistory.distroseriesID == DistroSeries.id,
545+ SourcePackagePublishingHistory.distroseries_id == DistroSeries.id,
546 DistroSeries.distribution == self.distribution,
547 SourcePackagePublishingHistory.sourcepackagename
548 == self.sourcepackagename,
549 SourcePackageRelease.id
550- == SourcePackagePublishingHistory.sourcepackagereleaseID,
551+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
552 ]
553
554 if status is not None:
555@@ -412,7 +412,7 @@ class DistributionSourcePackage(
556 pub_constraints = (
557 DistroSeries.distribution == self.distribution,
558 SourcePackagePublishingHistory.distroseries == DistroSeries.id,
559- SourcePackagePublishingHistory.archiveID.is_in(
560+ SourcePackagePublishingHistory.archive_id.is_in(
561 self.distribution.all_distro_archive_ids
562 ),
563 SourcePackagePublishingHistory.sourcepackagename
564@@ -423,11 +423,11 @@ class DistributionSourcePackage(
565 spr_ids = (
566 Store.of(self.distribution)
567 .find(
568- SourcePackagePublishingHistory.sourcepackagereleaseID,
569+ SourcePackagePublishingHistory.sourcepackagerelease_id,
570 *pub_constraints,
571 )
572 .order_by(
573- Desc(SourcePackagePublishingHistory.sourcepackagereleaseID)
574+ Desc(SourcePackagePublishingHistory.sourcepackagerelease_id)
575 )
576 .config(distinct=True)
577 )
578@@ -442,7 +442,7 @@ class DistributionSourcePackage(
579 sprs_by_id = {
580 spr: list(pubs)
581 for (spr, pubs) in itertools.groupby(
582- pubs, attrgetter("sourcepackagereleaseID")
583+ pubs, attrgetter("sourcepackagerelease_id")
584 )
585 }
586 return [
587diff --git a/lib/lp/registry/model/distroseries.py b/lib/lp/registry/model/distroseries.py
588index 68b7275..a585613 100644
589--- a/lib/lp/registry/model/distroseries.py
590+++ b/lib/lp/registry/model/distroseries.py
591@@ -784,9 +784,9 @@ class DistroSeries(
592 self.sourcecount = (
593 IStore(SourcePackagePublishingHistory)
594 .find(
595- SourcePackagePublishingHistory.sourcepackagenameID,
596+ SourcePackagePublishingHistory.sourcepackagename_id,
597 SourcePackagePublishingHistory.distroseries == self,
598- SourcePackagePublishingHistory.archiveID.is_in(
599+ SourcePackagePublishingHistory.archive_id.is_in(
600 self.distribution.all_distro_archive_ids
601 ),
602 SourcePackagePublishingHistory.status.is_in(
603@@ -802,11 +802,11 @@ class DistroSeries(
604 self.binarycount = (
605 IStore(BinaryPackagePublishingHistory)
606 .find(
607- BinaryPackagePublishingHistory.binarypackagenameID,
608+ BinaryPackagePublishingHistory.binarypackagename_id,
609 DistroArchSeries.distroseries == self,
610- BinaryPackagePublishingHistory.distroarchseriesID
611+ BinaryPackagePublishingHistory.distroarchseries_id
612 == DistroArchSeries.id,
613- BinaryPackagePublishingHistory.archiveID.is_in(
614+ BinaryPackagePublishingHistory.archive_id.is_in(
615 self.distribution.all_distro_archive_ids
616 ),
617 BinaryPackagePublishingHistory.status.is_in(
618@@ -1121,8 +1121,8 @@ class DistroSeries(
619 IStore(SourcePackagePublishingHistory)
620 .find(
621 SourcePackagePublishingHistory,
622- SourcePackagePublishingHistory.distroseriesID == self.id,
623- SourcePackagePublishingHistory.archiveID.is_in(
624+ SourcePackagePublishingHistory.distroseries_id == self.id,
625+ SourcePackagePublishingHistory.archive_id.is_in(
626 self.distribution.all_distro_archive_ids
627 ),
628 )
629@@ -1136,9 +1136,9 @@ class DistroSeries(
630 .find(
631 BinaryPackagePublishingHistory,
632 DistroArchSeries.distroseriesID == self.id,
633- BinaryPackagePublishingHistory.distroarchseriesID
634+ BinaryPackagePublishingHistory.distroarchseries_id
635 == DistroArchSeries.id,
636- BinaryPackagePublishingHistory.archiveID.is_in(
637+ BinaryPackagePublishingHistory.archive_id.is_in(
638 self.distribution.all_distro_archive_ids
639 ),
640 )
641@@ -1812,7 +1812,7 @@ class DistroSeriesSet:
642 == series
643 ),
644 [],
645- SourcePackagePublishingHistory.distroseriesID,
646+ SourcePackagePublishingHistory.distroseries_id,
647 )
648 result = {}
649 for spr, series_id in releases:
650diff --git a/lib/lp/registry/model/distroseriesdifference.py b/lib/lp/registry/model/distroseriesdifference.py
651index 64c3a0b..030e521 100644
652--- a/lib/lp/registry/model/distroseriesdifference.py
653+++ b/lib/lp/registry/model/distroseriesdifference.py
654@@ -104,10 +104,10 @@ def most_recent_publications(dsds, in_parent, statuses, match_version=False):
655 )
656 conditions = And(
657 DistroSeriesDifference.id.is_in(dsd.id for dsd in dsds),
658- SourcePackagePublishingHistory.archiveID == archive_subselect,
659- SourcePackagePublishingHistory.distroseriesID == series_col,
660+ SourcePackagePublishingHistory.archive_id == archive_subselect,
661+ SourcePackagePublishingHistory.distroseries_id == series_col,
662 SourcePackagePublishingHistory.status.is_in(statuses),
663- SourcePackagePublishingHistory.sourcepackagenameID
664+ SourcePackagePublishingHistory.sourcepackagename_id
665 == (DistroSeriesDifference.source_package_name_id),
666 )
667 # Do we match on DistroSeriesDifference.(parent_)source_version?
668@@ -115,7 +115,7 @@ def most_recent_publications(dsds, in_parent, statuses, match_version=False):
669 conditions = And(
670 conditions,
671 SourcePackageRelease.id
672- == SourcePackagePublishingHistory.sourcepackagereleaseID,
673+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
674 Cast(SourcePackageRelease.version, "text") == version_col,
675 )
676 # The sort order is critical so that the DISTINCT ON clause selects the
677@@ -284,7 +284,7 @@ def eager_load_dsds(dsds):
678 source_pubs_for_release.values(),
679 parent_source_pubs_for_release.values(),
680 ),
681- ("sourcepackagereleaseID",),
682+ ("sourcepackagerelease_id",),
683 )
684
685 # Get packagesets and parent_packagesets for each DSD.
686@@ -501,9 +501,9 @@ class DistroSeriesDifference(StormBase):
687 # the already established differences.
688 differences_changed_by_conditions = And(
689 basic_conditions,
690- SPPH.archiveID == distro_series.main_archive.id,
691- SPPH.distroseriesID == distro_series.id,
692- SPPH.sourcepackagereleaseID == SPR.id,
693+ SPPH.archive == distro_series.main_archive,
694+ SPPH.distroseries == distro_series,
695+ SPPH.sourcepackagerelease_id == SPR.id,
696 SPPH.status.is_in(active_publishing_status),
697 SPR.creatorID == TP.personID,
698 SPR.sourcepackagenameID == DSD.source_package_name_id,
699diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
700index 53e2358..d7bbb75 100644
701--- a/lib/lp/registry/model/person.py
702+++ b/lib/lp/registry/model/person.py
703@@ -3350,17 +3350,19 @@ class Person(
704 )
705 tables = (
706 SourcePackageRelease,
707- Join(spph, spph.sourcepackagereleaseID == SourcePackageRelease.id),
708- Join(Archive, Archive.id == spph.archiveID),
709- Join(ancestor_spph, ancestor_spph.id == spph.ancestorID),
710+ Join(
711+ spph, spph.sourcepackagerelease_id == SourcePackageRelease.id
712+ ),
713+ Join(Archive, Archive.id == spph.archive_id),
714+ Join(ancestor_spph, ancestor_spph.id == spph.ancestor_id),
715 )
716 rs = (
717 Store.of(self)
718 .using(*tables)
719 .find(
720 spph.id,
721- spph.creatorID == self.id,
722- ancestor_spph.archiveID != spph.archiveID,
723+ spph.creator_id == self.id,
724+ ancestor_spph.archive_id != spph.archive_id,
725 Archive.purpose == ArchivePurpose.PRIMARY,
726 )
727 )
728@@ -3383,28 +3385,28 @@ class Person(
729 SourcePackageRelease,
730 Join(
731 spph,
732- spph.sourcepackagereleaseID
733+ spph.sourcepackagerelease_id
734 == SourcePackageRelease.id,
735 ),
736- Join(Archive, Archive.id == spph.archiveID),
737+ Join(Archive, Archive.id == spph.archive_id),
738 Join(
739 ancestor_spph,
740- ancestor_spph.id == spph.ancestorID,
741+ ancestor_spph.id == spph.ancestor_id,
742 ),
743 ],
744 where=And(
745- spph.creatorID == self.id,
746- ancestor_spph.archiveID != spph.archiveID,
747+ spph.creator_id == self.id,
748+ ancestor_spph.archive_id != spph.archive_id,
749 Archive.purpose == ArchivePurpose.PRIMARY,
750 ),
751 order_by=[
752- spph.distroseriesID,
753+ spph.distroseries_id,
754 SourcePackageRelease.sourcepackagenameID,
755 Desc(spph.datecreated),
756 Desc(spph.id),
757 ],
758 distinct=(
759- spph.distroseriesID,
760+ spph.distroseries_id,
761 SourcePackageRelease.sourcepackagenameID,
762 ),
763 )
764@@ -3418,9 +3420,9 @@ class Person(
765
766 def load_related_objects(rows):
767 bulk.load_related(
768- SourcePackageRelease, rows, ["sourcepackagereleaseID"]
769+ SourcePackageRelease, rows, ["sourcepackagerelease_id"]
770 )
771- bulk.load_related(Archive, rows, ["archiveID"])
772+ bulk.load_related(Archive, rows, ["archive_id"])
773
774 return DecoratedResultSet(rs, pre_iter_hook=load_related_objects)
775
776diff --git a/lib/lp/registry/model/sourcepackage.py b/lib/lp/registry/model/sourcepackage.py
777index 119dc09..928996c 100644
778--- a/lib/lp/registry/model/sourcepackage.py
779+++ b/lib/lp/registry/model/sourcepackage.py
780@@ -242,7 +242,7 @@ class SourcePackage(
781 == self.sourcepackagename,
782 SourcePackagePublishingHistory.distroseries
783 == self.distroseries,
784- SourcePackagePublishingHistory.archiveID.is_in(
785+ SourcePackagePublishingHistory.archive_id.is_in(
786 self.distribution.all_distro_archive_ids
787 ),
788 ]
789@@ -383,13 +383,13 @@ class SourcePackage(
790 SourcePackageRelease,
791 Join(
792 SourcePackagePublishingHistory,
793- SourcePackagePublishingHistory.sourcepackagereleaseID
794+ SourcePackagePublishingHistory.sourcepackagerelease_id
795 == SourcePackageRelease.id,
796 ),
797 )
798 .find(
799 SourcePackageRelease,
800- SourcePackagePublishingHistory.archiveID.is_in(
801+ SourcePackagePublishingHistory.archive_id.is_in(
802 self.distribution.all_distro_archive_ids
803 ),
804 SourcePackagePublishingHistory.distroseries
805diff --git a/lib/lp/scripts/garbo.py b/lib/lp/scripts/garbo.py
806index 86adeaa..c4dfc20 100644
807--- a/lib/lp/scripts/garbo.py
808+++ b/lib/lp/scripts/garbo.py
809@@ -494,10 +494,11 @@ class PopulateDistributionSourcePackageCache(TunableLoop):
810 Join(
811 SourcePackageName,
812 SourcePackageName.id
813- == SourcePackagePublishingHistory.sourcepackagenameID,
814+ == SourcePackagePublishingHistory.sourcepackagename_id,
815 ),
816 Join(
817- Archive, Archive.id == SourcePackagePublishingHistory.archiveID
818+ Archive,
819+ Archive.id == SourcePackagePublishingHistory.archive_id,
820 ),
821 ]
822 rows = self.store.using(*origin).find(
823@@ -624,11 +625,11 @@ class PopulateLatestPersonSourcePackageReleaseCache(TunableLoop):
824 Join(
825 spph,
826 And(
827- spph.sourcepackagereleaseID == SourcePackageRelease.id,
828- spph.archiveID == SourcePackageRelease.upload_archiveID,
829+ spph.sourcepackagerelease_id == SourcePackageRelease.id,
830+ spph.archive_id == SourcePackageRelease.upload_archiveID,
831 ),
832 ),
833- Join(Archive, Archive.id == spph.archiveID),
834+ Join(Archive, Archive.id == spph.archive_id),
835 ]
836 rs = (
837 self.store.using(*origin)
838@@ -2197,7 +2198,7 @@ class BinaryPackagePublishingHistorySPNPopulator(BulkPruner):
839 update = Returning(
840 BulkUpdate(
841 {
842- BPPH.sourcepackagenameID: (
843+ BPPH.sourcepackagename_id: (
844 SourcePackageRelease.sourcepackagenameID
845 )
846 },
847diff --git a/lib/lp/services/database/doc/decoratedresultset.rst b/lib/lp/services/database/doc/decoratedresultset.rst
848index 8b4b624..ee7265b 100644
849--- a/lib/lp/services/database/doc/decoratedresultset.rst
850+++ b/lib/lp/services/database/doc/decoratedresultset.rst
851@@ -117,7 +117,7 @@ config option (https://bugs.launchpad.net/storm/+bug/217644):
852 >>> results = store.find(
853 ... BinaryPackageRelease,
854 ... BinaryPackageRelease.id
855- ... == BinaryPackagePublishingHistory.binarypackagereleaseID,
856+ ... == BinaryPackagePublishingHistory.binarypackagerelease_id,
857 ... )
858 >>> results = results.config(distinct=True)
859 >>> len(list(results))
860diff --git a/lib/lp/soyuz/adapters/overrides.py b/lib/lp/soyuz/adapters/overrides.py
861index dfb4aaf..b71a12e 100644
862--- a/lib/lp/soyuz/adapters/overrides.py
863+++ b/lib/lp/soyuz/adapters/overrides.py
864@@ -269,32 +269,32 @@ class FromExistingOverridePolicy(BaseOverridePolicy):
865 already_published = DecoratedResultSet(
866 store.find(
867 (
868- SourcePackagePublishingHistory.sourcepackagenameID,
869+ SourcePackagePublishingHistory.sourcepackagename_id,
870 SourcePackagePublishingHistory.component_id,
871 SourcePackagePublishingHistory.section_id,
872 SourcePackagePublishingHistory.status,
873 SourcePackageRelease.version,
874 ),
875 SourcePackageRelease.id
876- == SourcePackagePublishingHistory.sourcepackagereleaseID,
877- SourcePackagePublishingHistory.archiveID == self.archive.id,
878- SourcePackagePublishingHistory.distroseriesID
879- == self.distroseries.id,
880+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
881+ SourcePackagePublishingHistory.archive == self.archive,
882+ SourcePackagePublishingHistory.distroseries
883+ == self.distroseries,
884 SourcePackagePublishingHistory.status.is_in(
885 self.getExistingPublishingStatuses(self.include_deleted)
886 ),
887- SourcePackagePublishingHistory.sourcepackagenameID.is_in(
888+ SourcePackagePublishingHistory.sourcepackagename_id.is_in(
889 spn.id for spn in spns
890 ),
891 *other_conditions,
892 )
893 .order_by(
894- SourcePackagePublishingHistory.sourcepackagenameID,
895+ SourcePackagePublishingHistory.sourcepackagename_id,
896 Desc(SourcePackagePublishingHistory.datecreated),
897 Desc(SourcePackagePublishingHistory.id),
898 )
899 .config(
900- distinct=(SourcePackagePublishingHistory.sourcepackagenameID,)
901+ distinct=(SourcePackagePublishingHistory.sourcepackagename_id,)
902 ),
903 id_resolver((SourcePackageName, Component, Section, None, None)),
904 pre_iter_hook=eager_load,
905@@ -334,16 +334,15 @@ class FromExistingOverridePolicy(BaseOverridePolicy):
906 archtags = set()
907 for bpn, archtag in binaries.keys():
908 candidates.append(
909- BinaryPackagePublishingHistory.binarypackagenameID
910+ BinaryPackagePublishingHistory.binarypackagename_id
911 == bpn.id
912 )
913 archtags.add(archtag)
914 other_conditions.extend(
915 [
916- BinaryPackagePublishingHistory.archiveID
917- == self.archive.id,
918+ BinaryPackagePublishingHistory.archive == self.archive,
919 DistroArchSeries.distroseriesID == self.distroseries.id,
920- BinaryPackagePublishingHistory.distroarchseriesID
921+ BinaryPackagePublishingHistory.distroarchseries_id
922 == DistroArchSeries.id,
923 ]
924 )
925@@ -358,8 +357,8 @@ class FromExistingOverridePolicy(BaseOverridePolicy):
926 already_published = DecoratedResultSet(
927 store.find(
928 (
929- BinaryPackagePublishingHistory.binarypackagenameID,
930- BinaryPackagePublishingHistory.distroarchseriesID,
931+ BinaryPackagePublishingHistory.binarypackagename_id,
932+ BinaryPackagePublishingHistory.distroarchseries_id,
933 BinaryPackagePublishingHistory.component_id,
934 BinaryPackagePublishingHistory.section_id,
935 BinaryPackagePublishingHistory.priority,
936@@ -367,7 +366,7 @@ class FromExistingOverridePolicy(BaseOverridePolicy):
937 BinaryPackageRelease.version,
938 ),
939 BinaryPackageRelease.id
940- == BinaryPackagePublishingHistory.binarypackagereleaseID,
941+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
942 BinaryPackagePublishingHistory.status.is_in(
943 self.getExistingPublishingStatuses(self.include_deleted)
944 ),
945@@ -375,15 +374,15 @@ class FromExistingOverridePolicy(BaseOverridePolicy):
946 *other_conditions,
947 )
948 .order_by(
949- BinaryPackagePublishingHistory.distroarchseriesID,
950- BinaryPackagePublishingHistory.binarypackagenameID,
951+ BinaryPackagePublishingHistory.distroarchseries_id,
952+ BinaryPackagePublishingHistory.binarypackagename_id,
953 Desc(BinaryPackagePublishingHistory.datecreated),
954 Desc(BinaryPackagePublishingHistory.id),
955 )
956 .config(
957 distinct=(
958- BinaryPackagePublishingHistory.distroarchseriesID,
959- BinaryPackagePublishingHistory.binarypackagenameID,
960+ BinaryPackagePublishingHistory.distroarchseries_id,
961+ BinaryPackagePublishingHistory.binarypackagename_id,
962 )
963 ),
964 id_resolver(
965@@ -597,9 +596,9 @@ def calculate_target_das(distroseries, binaries):
966
967 def make_package_condition(archive, das, bpn):
968 return And(
969- BinaryPackagePublishingHistory.archiveID == archive.id,
970- BinaryPackagePublishingHistory.distroarchseriesID == das.id,
971- BinaryPackagePublishingHistory.binarypackagenameID == bpn.id,
972+ BinaryPackagePublishingHistory.archive == archive,
973+ BinaryPackagePublishingHistory.distroarchseries == das,
974+ BinaryPackagePublishingHistory.binarypackagename == bpn,
975 )
976
977
978diff --git a/lib/lp/soyuz/doc/distribution.rst b/lib/lp/soyuz/doc/distribution.rst
979index 485fa14..cb5c996 100644
980--- a/lib/lp/soyuz/doc/distribution.rst
981+++ b/lib/lp/soyuz/doc/distribution.rst
982@@ -278,7 +278,7 @@ Celso's PPA.
983 ... archive=cprov.archive, status=PackagePublishingStatus.PUBLISHED
984 ... )
985 >>> spr = cprov_bin.binarypackagerelease.build.source_package_release
986- >>> spr.publishings[0].setPublished()
987+ >>> spr.publishings.first().setPublished()
988 >>> pending_binaries = cprov_bin.copyTo(
989 ... warty, pocket_release, cprov.archive
990 ... )
991diff --git a/lib/lp/soyuz/doc/distroarchseriesbinarypackage.rst b/lib/lp/soyuz/doc/distroarchseriesbinarypackage.rst
992index 60957e5..1a36167 100644
993--- a/lib/lp/soyuz/doc/distroarchseriesbinarypackage.rst
994+++ b/lib/lp/soyuz/doc/distroarchseriesbinarypackage.rst
995@@ -77,7 +77,7 @@ needs to be removed.
996 >>> pe = BinaryPackagePublishingHistory(
997 ... binarypackagerelease=bpr.id,
998 ... binarypackagename=bpr.binarypackagename,
999- ... _binarypackageformat=bpr.binpackageformat,
1000+ ... binarypackageformat=bpr.binpackageformat,
1001 ... component=main_component.id,
1002 ... section=misc_section.id,
1003 ... priority=priority,
1004@@ -86,10 +86,6 @@ needs to be removed.
1005 ... datecreated=UTC_NOW,
1006 ... datepublished=UTC_NOW,
1007 ... pocket=PackagePublishingPocket.RELEASE,
1008- ... datesuperseded=None,
1009- ... supersededby=None,
1010- ... datemadepending=None,
1011- ... dateremoved=None,
1012 ... archive=hoary_i386.main_archive,
1013 ... sourcepackagename=bpr.build.source_package_name,
1014 ... )
1015@@ -126,7 +122,7 @@ needs to be removed.
1016 >>> pe = BinaryPackagePublishingHistory(
1017 ... binarypackagerelease=bpr.id,
1018 ... binarypackagename=bpr.binarypackagename,
1019- ... _binarypackageformat=bpr.binpackageformat,
1020+ ... binarypackageformat=bpr.binpackageformat,
1021 ... component=main_component.id,
1022 ... section=misc_section.id,
1023 ... priority=priority,
1024@@ -135,10 +131,6 @@ needs to be removed.
1025 ... datecreated=UTC_NOW,
1026 ... datepublished=UTC_NOW,
1027 ... pocket=PackagePublishingPocket.RELEASE,
1028- ... datesuperseded=None,
1029- ... supersededby=None,
1030- ... datemadepending=None,
1031- ... dateremoved=None,
1032 ... archive=hoary_i386.main_archive,
1033 ... sourcepackagename=bpr.build.source_package_name,
1034 ... )
1035diff --git a/lib/lp/soyuz/doc/distroseriesqueue-translations.rst b/lib/lp/soyuz/doc/distroseriesqueue-translations.rst
1036index 7a82713..f758a6c 100644
1037--- a/lib/lp/soyuz/doc/distroseriesqueue-translations.rst
1038+++ b/lib/lp/soyuz/doc/distroseriesqueue-translations.rst
1039@@ -76,7 +76,7 @@ queue:
1040 ... distroseries=dapper.id,
1041 ... sourcepackagerelease=source_package_release.id,
1042 ... sourcepackagename=source_package_release.sourcepackagename,
1043- ... _format=source_package_release.format,
1044+ ... format=source_package_release.format,
1045 ... component=source_package_release.component.id,
1046 ... section=source_package_release.section.id,
1047 ... status=PackagePublishingStatus.PUBLISHED,
1048diff --git a/lib/lp/soyuz/doc/gina-multiple-arch.rst b/lib/lp/soyuz/doc/gina-multiple-arch.rst
1049index 70c851a..fa9ca09 100644
1050--- a/lib/lp/soyuz/doc/gina-multiple-arch.rst
1051+++ b/lib/lp/soyuz/doc/gina-multiple-arch.rst
1052@@ -3,6 +3,7 @@ Gina over Multiple Architectures (and Pockets, and Components)
1053
1054 Get the current counts of stuff in the database:
1055
1056+ >>> from lp.services.database.interfaces import IStore
1057 >>> from lp.services.identity.model.emailaddress import EmailAddress
1058 >>> from lp.registry.model.person import Person
1059 >>> from lp.registry.model.teammembership import TeamParticipation
1060@@ -17,13 +18,13 @@ Get the current counts of stuff in the database:
1061 >>> SBPPH = BinaryPackagePublishingHistory
1062
1063 >>> orig_spr_count = SourcePackageRelease.select().count()
1064- >>> orig_sspph_count = SSPPH.select().count()
1065+ >>> orig_sspph_count = IStore(SSPPH).find(SSPPH).count()
1066 >>> orig_person_count = Person.select().count()
1067 >>> orig_tp_count = TeamParticipation.select().count()
1068 >>> orig_email_count = EmailAddress.select().count()
1069 >>> orig_bpr_count = BinaryPackageRelease.select().count()
1070 >>> orig_build_count = BinaryPackageBuild.select().count()
1071- >>> orig_sbpph_count = SBPPH.select().count()
1072+ >>> orig_sbpph_count = IStore(SBPPH).find(SBPPH).count()
1073
1074 Create a distribution series and an arch series for dapper:
1075
1076@@ -127,7 +128,7 @@ breezy:
1077
1078 >>> SourcePackageRelease.select().count() - orig_spr_count
1079 2
1080- >>> print(SSPPH.select().count() - orig_sspph_count)
1081+ >>> print(IStore(SSPPH).find(SSPPH).count() - orig_sspph_count)
1082 2
1083
1084 Each source package has its own maintainer (in this case, fabbione and
1085@@ -148,7 +149,7 @@ distroarchseries:
1086 4
1087 >>> BinaryPackageBuild.select().count() - orig_build_count
1088 2
1089- >>> SBPPH.select().count() - orig_sbpph_count
1090+ >>> IStore(SBPPH).find(SBPPH).count() - orig_sbpph_count
1091 4
1092
1093 Check that the source package was correctly imported:
1094@@ -228,8 +229,10 @@ Check that we publishing bdftopcf into the correct distroarchseries:
1095 ... )
1096 >>> print(dar.architecturetag)
1097 i386
1098- >>> for entry in SBPPH.selectBy(
1099- ... distroarchseriesID=dar.id, orderBy="binarypackagerelease"
1100+ >>> for entry in (
1101+ ... IStore(SBPPH)
1102+ ... .find(SBPPH, distroarchseries=dar)
1103+ ... .order_by("binarypackagerelease")
1104 ... ):
1105 ... package = entry.binarypackagerelease
1106 ... print(package.binarypackagename.name, package.version)
1107diff --git a/lib/lp/soyuz/doc/gina.rst b/lib/lp/soyuz/doc/gina.rst
1108index ae17b6e..405cf53 100644
1109--- a/lib/lp/soyuz/doc/gina.rst
1110+++ b/lib/lp/soyuz/doc/gina.rst
1111@@ -7,6 +7,7 @@ quiet mode over it.
1112
1113 Get the current counts of stuff in the database:
1114
1115+ >>> from storm.locals import Desc
1116 >>> from lp.services.database.interfaces import IStore
1117 >>> from lp.services.identity.model.emailaddress import EmailAddress
1118 >>> from lp.soyuz.interfaces.publishing import active_publishing_status
1119@@ -24,16 +25,20 @@ Get the current counts of stuff in the database:
1120 >>> SBPPH = BinaryPackagePublishingHistory
1121
1122 >>> orig_spr_count = SourcePackageRelease.select().count()
1123- >>> orig_sspph_count = SSPPH.select().count()
1124+ >>> orig_sspph_count = IStore(SSPPH).find(SSPPH).count()
1125 >>> orig_person_count = Person.select().count()
1126 >>> orig_tp_count = TeamParticipation.select().count()
1127 >>> orig_email_count = EmailAddress.select().count()
1128 >>> orig_bpr_count = BinaryPackageRelease.select().count()
1129 >>> orig_build_count = BinaryPackageBuild.select().count()
1130- >>> orig_sbpph_count = SBPPH.select().count()
1131- >>> orig_sspph_main_count = SSPPH.selectBy(
1132- ... component_id=1, pocket=PackagePublishingPocket.RELEASE
1133- ... ).count()
1134+ >>> orig_sbpph_count = IStore(SBPPH).find(SBPPH).count()
1135+ >>> orig_sspph_main_count = (
1136+ ... IStore(SSPPH)
1137+ ... .find(
1138+ ... SSPPH, component_id=1, pocket=PackagePublishingPocket.RELEASE
1139+ ... )
1140+ ... .count()
1141+ ... )
1142
1143 Create a distribution release and an arch release for breezy:
1144
1145@@ -367,8 +372,10 @@ Testing Source Package Publishing
1146
1147 We check that the source package publishing override facility works:
1148
1149- >>> for pub in SSPPH.selectBy(
1150- ... sourcepackagereleaseID=db1.id, orderBy="distroseries"
1151+ >>> for pub in (
1152+ ... IStore(SSPPH)
1153+ ... .find(SSPPH, sourcepackagerelease=db1)
1154+ ... .order_by(SSPPH.distroseries_id)
1155 ... ):
1156 ... print(
1157 ... "%s %s %s"
1158@@ -390,12 +397,16 @@ successfully processed.
1159 - We had 2 errors (out of 10 Sources stanzas) in breezy: python-sqllite
1160 and util-linux (again, poor thing).
1161
1162- >>> print(SSPPH.select().count() - orig_sspph_count)
1163+ >>> print(IStore(SSPPH).find(SSPPH).count() - orig_sspph_count)
1164 21
1165
1166- >>> new_count = SSPPH.selectBy(
1167- ... component_id=1, pocket=PackagePublishingPocket.RELEASE
1168- ... ).count()
1169+ >>> new_count = (
1170+ ... IStore(SSPPH)
1171+ ... .find(
1172+ ... SSPPH, component_id=1, pocket=PackagePublishingPocket.RELEASE
1173+ ... )
1174+ ... .count()
1175+ ... )
1176 >>> print(new_count - orig_sspph_main_count)
1177 21
1178
1179@@ -415,7 +426,7 @@ work.
1180 40
1181 >>> BinaryPackageBuild.select().count() - orig_build_count
1182 13
1183- >>> SBPPH.select().count() - orig_sbpph_count
1184+ >>> IStore(SBPPH).find(SBPPH).count() - orig_sbpph_count
1185 46
1186
1187 Check that the shlibs parsing and bin-only-NMU version handling works as
1188@@ -455,8 +466,12 @@ priority was correctly munged to "extra":
1189
1190 We now check if the Breezy publication record has the correct priority:
1191
1192- >>> ed_pub = SBPPH.selectOneBy(
1193- ... binarypackagereleaseID=ed.id, distroarchseriesID=breezy_i386.id
1194+ >>> ed_pub = (
1195+ ... IStore(SBPPH)
1196+ ... .find(
1197+ ... SBPPH, binarypackagerelease=ed, distroarchseries=breezy_i386
1198+ ... )
1199+ ... .one()
1200 ... )
1201 >>> print(ed_pub.priority)
1202 Standard
1203@@ -637,51 +652,53 @@ changed, etc.
1204
1205 But the overrides do generate extra publishing entries:
1206
1207- >>> SBPPH.select().count() - orig_sbpph_count
1208+ >>> IStore(SBPPH).find(SBPPH).count() - orig_sbpph_count
1209 47
1210- >>> print(SSPPH.select().count() - orig_sspph_count)
1211+ >>> IStore(SSPPH).find(SSPPH).count() - orig_sspph_count
1212 23
1213
1214 Check that the overrides we did were correctly issued. We can't use
1215-selectOneBy because, of course, there may be multiple rows published for that
1216+``.one()`` because, of course, there may be multiple rows published for that
1217 package -- that's what overrides actually do.
1218
1219- >>> from lp.services.database.sqlbase import sqlvalues
1220- >>> x11_pub = SSPPH.select(
1221- ... """
1222- ... sourcepackagerelease = %s AND
1223- ... distroseries = %s AND
1224- ... status in %s
1225- ... """
1226- ... % sqlvalues(x11p, breezy, active_publishing_status),
1227- ... orderBy=["-datecreated"],
1228- ... )[0]
1229+ >>> x11_pub = (
1230+ ... IStore(SSPPH)
1231+ ... .find(
1232+ ... SSPPH,
1233+ ... SSPPH.sourcepackagerelease == x11p,
1234+ ... SSPPH.distroseries == breezy,
1235+ ... SSPPH.status.is_in(active_publishing_status),
1236+ ... )
1237+ ... .order_by(Desc(SSPPH.datecreated))[0]
1238+ ... )
1239 >>> print(x11_pub.section.name)
1240 net
1241- >>> ed_pub = SBPPH.select(
1242- ... """
1243- ... binarypackagerelease = %s AND
1244- ... distroarchseries = %s AND
1245- ... status in %s
1246- ... """
1247- ... % sqlvalues(ed, breezy_i386, active_publishing_status),
1248- ... orderBy=["-datecreated"],
1249- ... )[0]
1250+ >>> ed_pub = (
1251+ ... IStore(SBPPH)
1252+ ... .find(
1253+ ... SBPPH,
1254+ ... SBPPH.binarypackagerelease == ed,
1255+ ... SBPPH.distroarchseries == breezy_i386,
1256+ ... SBPPH.status.is_in(active_publishing_status),
1257+ ... )
1258+ ... .order_by(Desc(SBPPH.datecreated))[0]
1259+ ... )
1260 >>> print(ed_pub.priority)
1261 Extra
1262 >>> n = SourcePackageName.selectOneBy(name="archive-copier")
1263 >>> ac = SourcePackageRelease.selectOneBy(
1264 ... sourcepackagenameID=n.id, version="0.3.6"
1265 ... )
1266- >>> ac_pub = SSPPH.select(
1267- ... """
1268- ... sourcepackagerelease = %s AND
1269- ... distroseries = %s AND
1270- ... status in %s
1271- ... """
1272- ... % sqlvalues(ac, breezy, active_publishing_status),
1273- ... orderBy=["-datecreated"],
1274- ... )[0]
1275+ >>> ac_pub = (
1276+ ... IStore(SSPPH)
1277+ ... .find(
1278+ ... SSPPH,
1279+ ... SSPPH.sourcepackagerelease == ac,
1280+ ... SSPPH.distroseries == breezy,
1281+ ... SSPPH.status.is_in(active_publishing_status),
1282+ ... )
1283+ ... .order_by(Desc(SSPPH.datecreated))[0]
1284+ ... )
1285 >>> print(ac_pub.component.name)
1286 universe
1287
1288@@ -699,11 +716,11 @@ First get a set of existing publishings for both source and binary:
1289 >>> hoary = ubuntu["hoary"]
1290 >>> hoary_i386 = hoary["i386"]
1291 >>> partner_source_set = set(
1292- ... SSPPH.select("distroseries = %s" % sqlvalues(hoary))
1293+ ... IStore(SSPPH).find(SSPPH, distroseries=hoary)
1294 ... )
1295
1296 >>> partner_binary_set = set(
1297- ... SBPPH.select("distroarchseries = %s" % sqlvalues(hoary_i386))
1298+ ... IStore(SBPPH).find(SBPPH, distroarchseries=hoary_i386)
1299 ... )
1300
1301 Now run gina to import packages and convert them to partner:
1302@@ -719,11 +736,11 @@ Now run gina to import packages and convert them to partner:
1303 There will now be a number of publishings in the partner archive:
1304
1305 >>> partner_source_set_after = set(
1306- ... SSPPH.select("distroseries = %s" % sqlvalues(hoary))
1307+ ... IStore(SSPPH).find(SSPPH, distroseries=hoary)
1308 ... )
1309
1310 >>> partner_binary_set_after = set(
1311- ... SBPPH.select("distroarchseries = %s" % sqlvalues(hoary_i386))
1312+ ... IStore(SBPPH).find(SBPPH, distroarchseries=hoary_i386)
1313 ... )
1314
1315 >>> source_difference = partner_source_set_after - partner_source_set
1316@@ -818,7 +835,9 @@ We will also store the number of binaries already published in debian
1317 PRIMARY archive, so we can check later it was unaffected by the
1318 import.
1319
1320- >>> debian_binaries = SBPPH.selectBy(archive=debian.main_archive)
1321+ >>> debian_binaries = IStore(SBPPH).find(
1322+ ... SBPPH, archive=debian.main_archive
1323+ ... )
1324 >>> number_of_debian_binaries = debian_binaries.count()
1325
1326 Commit the changes and run the importer script.
1327@@ -837,7 +856,7 @@ Commit the changes and run the importer script.
1328 There is now a number of source publications in PUBLISHED status for the
1329 targeted distroseries, 'lenny'.
1330
1331- >>> lenny_sources = SSPPH.select("distroseries = %s" % sqlvalues(lenny))
1332+ >>> lenny_sources = IStore(SSPPH).find(SSPPH, distroseries=lenny)
1333 >>> lenny_sources.count()
1334 12
1335
1336@@ -850,11 +869,15 @@ As mentioned before, lenny/i386 is empty, no binaries were imported.
1337 Also, the number of binaries published in the whole debian distribution
1338 hasn't changed.
1339
1340- >>> lenny_binaries = SBPPH.selectBy(distroarchseries=lenny_i386)
1341+ >>> lenny_binaries = IStore(SBPPH).find(
1342+ ... SBPPH, distroarchseries=lenny_i386
1343+ ... )
1344 >>> lenny_binaries.count()
1345 0
1346
1347- >>> debian_binaries = SBPPH.selectBy(archive=debian.main_archive)
1348+ >>> debian_binaries = IStore(SBPPH).find(
1349+ ... SBPPH, archive=debian.main_archive
1350+ ... )
1351 >>> debian_binaries.count() == number_of_debian_binaries
1352 True
1353
1354diff --git a/lib/lp/soyuz/doc/soyuz-set-of-uploads.rst b/lib/lp/soyuz/doc/soyuz-set-of-uploads.rst
1355index 6b73a73..1ba2b35 100644
1356--- a/lib/lp/soyuz/doc/soyuz-set-of-uploads.rst
1357+++ b/lib/lp/soyuz/doc/soyuz-set-of-uploads.rst
1358@@ -214,6 +214,9 @@ it into the accepted queue
1359 Finally, as a very simplistic publishing process, we may need to punt any
1360 given upload into the published state, so here's a very simplistic publisher
1361
1362+ >>> from lp.registry.model.distroseries import DistroSeries
1363+ >>> from lp.services.database.interfaces import IStore
1364+ >>> from lp.soyuz.model.distroarchseries import DistroArchSeries
1365 >>> from lp.soyuz.model.publishing import (
1366 ... SourcePackagePublishingHistory as SPPH,
1367 ... BinaryPackagePublishingHistory as BPPH,
1368@@ -221,29 +224,20 @@ given upload into the published state, so here's a very simplistic publisher
1369 >>> from lp.soyuz.enums import PackagePublishingStatus as PPS
1370 >>> from lp.services.database.constants import UTC_NOW
1371 >>> def simple_publish(distro):
1372- ... srcs_to_publish = SPPH.select(
1373- ... """
1374- ... SourcePackagePublishingHistory.distroseries = DistroSeries.id
1375- ... AND DistroSeries.distribution = Distribution.id
1376- ... AND Distribution.name = '%s'
1377- ... AND SourcePackagePublishingHistory.status = 1"""
1378- ... % distro,
1379- ... clauseTables=["DistroSeries", "Distribution"],
1380+ ... srcs_to_publish = IStore(SPPH).find(
1381+ ... SPPH,
1382+ ... SPPH.distroseries == DistroSeries.id,
1383+ ... DistroSeries.distribution == Distribution.id,
1384+ ... Distribution.name == distro,
1385+ ... SPPH.status == PPS.PENDING,
1386 ... )
1387- ... bins_to_publish = BPPH.select(
1388- ... """
1389- ... BinaryPackagePublishingHistory.distroarchseries =
1390- ... DistroArchSeries.id
1391- ... AND DistroArchSeries.distroseries = DistroSeries.id
1392- ... AND DistroSeries.distribution = Distribution.id
1393- ... AND Distribution.name = '%s'
1394- ... AND BinaryPackagePublishingHistory.status = 1"""
1395- ... % distro,
1396- ... clauseTables=[
1397- ... "DistroArchSeries",
1398- ... "DistroSeries",
1399- ... "Distribution",
1400- ... ],
1401+ ... bins_to_publish = IStore(BPPH).find(
1402+ ... BPPH,
1403+ ... BPPH.distroarchseries == DistroArchSeries.id,
1404+ ... DistroArchSeries.distroseries == DistroSeries.id,
1405+ ... DistroSeries.distribution == Distribution.id,
1406+ ... Distribution.name == distro,
1407+ ... BPPH.status == PPS.PENDING,
1408 ... )
1409 ... published_one = False
1410 ... for src in srcs_to_publish:
1411diff --git a/lib/lp/soyuz/doc/soyuz-upload.rst b/lib/lp/soyuz/doc/soyuz-upload.rst
1412index 0b4fd40..f6027d6 100644
1413--- a/lib/lp/soyuz/doc/soyuz-upload.rst
1414+++ b/lib/lp/soyuz/doc/soyuz-upload.rst
1415@@ -498,7 +498,7 @@ These packages must now be in the publishing history. Let's check it.
1416 >>> for name in package_names:
1417 ... spn = SourcePackageName.selectOneBy(name=name)
1418 ... spr = SourcePackageRelease.selectOneBy(sourcepackagenameID=spn.id)
1419- ... sspph = SSPPH.selectOneBy(sourcepackagereleaseID=spr.id)
1420+ ... sspph = IStore(SSPPH).find(SSPPH, sourcepackagerelease=spr).one()
1421 ... if sspph:
1422 ... print(name, sspph.status.title)
1423 ... else:
1424@@ -604,9 +604,13 @@ component 'multiverse'.
1425
1426 Check if we have new pending publishing record as expected
1427
1428- >>> for pub in SSPPH.selectBy(
1429- ... sourcepackagereleaseID=etherwake_drspr.sourcepackagerelease.id,
1430- ... orderBy=["id"],
1431+ >>> for pub in (
1432+ ... IStore(SSPPH)
1433+ ... .find(
1434+ ... SSPPH,
1435+ ... sourcepackagerelease=etherwake_drspr.sourcepackagerelease,
1436+ ... )
1437+ ... .order_by(SSPPH.id)
1438 ... ):
1439 ... print(pub.status.name, pub.component.name, pub.pocket.name)
1440 PUBLISHED universe RELEASE
1441@@ -636,9 +640,13 @@ already on disk, verify the contents are as expected.
1442
1443 Check the publishing history again
1444
1445- >>> for pub in SSPPH.selectBy(
1446- ... sourcepackagereleaseID=etherwake_drspr.sourcepackagerelease.id,
1447- ... orderBy=["id"],
1448+ >>> for pub in (
1449+ ... IStore(SSPPH)
1450+ ... .find(
1451+ ... SSPPH,
1452+ ... sourcepackagerelease=etherwake_drspr.sourcepackagerelease,
1453+ ... )
1454+ ... .order_by(SSPPH.id)
1455 ... ):
1456 ... print(pub.status.name, pub.component.name, pub.pocket.name)
1457 SUPERSEDED universe RELEASE
1458diff --git a/lib/lp/soyuz/interfaces/publishing.py b/lib/lp/soyuz/interfaces/publishing.py
1459index 600f089..f0689a0 100644
1460--- a/lib/lp/soyuz/interfaces/publishing.py
1461+++ b/lib/lp/soyuz/interfaces/publishing.py
1462@@ -212,13 +212,13 @@ class ISourcePackagePublishingHistoryPublic(IPublishingView):
1463 required=True,
1464 readonly=True,
1465 )
1466- sourcepackagenameID = Int(
1467+ sourcepackagename_id = Int(
1468 title=_("The DB id for the sourcepackagename."),
1469 required=False,
1470 readonly=False,
1471 )
1472 sourcepackagename = Attribute("The source package name being published")
1473- sourcepackagereleaseID = Int(
1474+ sourcepackagerelease_id = Int(
1475 title=_("The DB id for the sourcepackagerelease."),
1476 required=False,
1477 readonly=False,
1478@@ -241,7 +241,7 @@ class ISourcePackagePublishingHistoryPublic(IPublishingView):
1479 readonly=False,
1480 )
1481 )
1482- distroseriesID = Attribute("DB ID for distroseries.")
1483+ distroseries_id = Attribute("DB ID for distroseries.")
1484 distroseries = exported(
1485 Reference(
1486 IDistroSeries,
1487@@ -358,7 +358,7 @@ class ISourcePackagePublishingHistoryPublic(IPublishingView):
1488 ),
1489 exported_as="date_removed",
1490 )
1491- removed_byID = Attribute("DB ID for removed_by.")
1492+ removed_by_id = Attribute("DB ID for removed_by.")
1493 removed_by = exported(
1494 Reference(
1495 IPerson,
1496@@ -438,7 +438,7 @@ class ISourcePackagePublishingHistoryPublic(IPublishingView):
1497 readonly=True,
1498 )
1499
1500- creatorID = Attribute("DB ID for creator.")
1501+ creator_id = Attribute("DB ID for creator.")
1502 creator = exported(
1503 Reference(
1504 IPerson,
1505@@ -449,7 +449,7 @@ class ISourcePackagePublishingHistoryPublic(IPublishingView):
1506 )
1507 )
1508
1509- sponsorID = Attribute("DB ID for sponsor.")
1510+ sponsor_id = Attribute("DB ID for sponsor.")
1511 sponsor = exported(
1512 Reference(
1513 IPerson,
1514@@ -692,13 +692,13 @@ class IBinaryPackagePublishingHistoryPublic(IPublishingView):
1515 """A binary package publishing record."""
1516
1517 id = Int(title=_("ID"), required=True, readonly=True)
1518- binarypackagenameID = Int(
1519+ binarypackagename_id = Int(
1520 title=_("The DB id for the binarypackagename."),
1521 required=False,
1522 readonly=False,
1523 )
1524 binarypackagename = Attribute("The binary package name being published")
1525- binarypackagereleaseID = Int(
1526+ binarypackagerelease_id = Int(
1527 title=_("The DB id for the binarypackagerelease."),
1528 required=False,
1529 readonly=False,
1530@@ -734,7 +734,7 @@ class IBinaryPackagePublishingHistoryPublic(IPublishingView):
1531 readonly=True,
1532 )
1533 )
1534- distroarchseriesID = Int(
1535+ distroarchseries_id = Int(
1536 title=_("The DB id for the distroarchseries."),
1537 required=False,
1538 readonly=False,
1539diff --git a/lib/lp/soyuz/interfaces/sourcepackagerelease.py b/lib/lp/soyuz/interfaces/sourcepackagerelease.py
1540index 8fba1f1..a6f1c64 100644
1541--- a/lib/lp/soyuz/interfaces/sourcepackagerelease.py
1542+++ b/lib/lp/soyuz/interfaces/sourcepackagerelease.py
1543@@ -117,7 +117,7 @@ class ISourcePackageRelease(Interface):
1544 "The distroseries in which this package "
1545 "was first uploaded in Launchpad"
1546 )
1547- publishings = Attribute("MultipleJoin on SourcepackagePublishing")
1548+ publishings = Attribute("Publishing records that link to this release")
1549
1550 user_defined_fields = List(
1551 title=_("Sequence of user-defined fields as key-value pairs.")
1552diff --git a/lib/lp/soyuz/model/archive.py b/lib/lp/soyuz/model/archive.py
1553index 1e82709..505b278 100644
1554--- a/lib/lp/soyuz/model/archive.py
1555+++ b/lib/lp/soyuz/model/archive.py
1556@@ -730,7 +730,7 @@ class Archive(SQLBase):
1557 only_unpublished=False,
1558 ):
1559 """See `IArchive`."""
1560- clauses = [SourcePackagePublishingHistory.archiveID == self.id]
1561+ clauses = [SourcePackagePublishingHistory.archive == self]
1562
1563 if order_by_date:
1564 order_by = [
1565@@ -745,7 +745,7 @@ class Archive(SQLBase):
1566
1567 if not order_by_date or name is not None:
1568 clauses.append(
1569- SourcePackagePublishingHistory.sourcepackagenameID
1570+ SourcePackagePublishingHistory.sourcepackagename_id
1571 == SourcePackageName.id
1572 )
1573
1574@@ -762,7 +762,7 @@ class Archive(SQLBase):
1575
1576 if not order_by_date or version is not None:
1577 clauses.append(
1578- SourcePackagePublishingHistory.sourcepackagereleaseID
1579+ SourcePackagePublishingHistory.sourcepackagerelease_id
1580 == SourcePackageRelease.id
1581 )
1582
1583@@ -797,8 +797,7 @@ class Archive(SQLBase):
1584
1585 if distroseries is not None:
1586 clauses.append(
1587- SourcePackagePublishingHistory.distroseriesID
1588- == distroseries.id
1589+ SourcePackagePublishingHistory.distroseries == distroseries
1590 )
1591
1592 if pocket is not None:
1593@@ -837,7 +836,7 @@ class Archive(SQLBase):
1594 # \o/ circular imports.
1595 from lp.registry.model.distroseries import DistroSeries
1596
1597- ids = set(map(attrgetter("distroseriesID"), rows))
1598+ ids = set(map(attrgetter("distroseries_id"), rows))
1599 ids.discard(None)
1600 if ids:
1601 list(store.find(DistroSeries, DistroSeries.id.is_in(ids)))
1602@@ -845,7 +844,7 @@ class Archive(SQLBase):
1603 ids.discard(None)
1604 if ids:
1605 list(store.find(Section, Section.id.is_in(ids)))
1606- ids = set(map(attrgetter("sourcepackagereleaseID"), rows))
1607+ ids = set(map(attrgetter("sourcepackagerelease_id"), rows))
1608 ids.discard(None)
1609 if not ids:
1610 return
1611@@ -868,10 +867,10 @@ class Archive(SQLBase):
1612 # rather than linking through BPB, BPR and BPPH since we don't condemn
1613 # sources until their binaries are all gone due to GPL compliance.
1614 clauses = [
1615- SourcePackagePublishingHistory.archiveID == self.id,
1616- SourcePackagePublishingHistory.sourcepackagereleaseID
1617+ SourcePackagePublishingHistory.archive == self,
1618+ SourcePackagePublishingHistory.sourcepackagerelease_id
1619 == SourcePackageRelease.id,
1620- SourcePackagePublishingHistory.sourcepackagenameID
1621+ SourcePackagePublishingHistory.sourcepackagename_id
1622 == SourcePackageName.id,
1623 SourcePackagePublishingHistory.scheduleddeletiondate == None,
1624 ]
1625@@ -885,8 +884,7 @@ class Archive(SQLBase):
1626
1627 if distroseries:
1628 clauses.append(
1629- SourcePackagePublishingHistory.distroseriesID
1630- == distroseries.id
1631+ SourcePackagePublishingHistory.distroseries == distroseries
1632 )
1633
1634 if name:
1635@@ -904,7 +902,7 @@ class Archive(SQLBase):
1636
1637 def eager_load(rows):
1638 load_related(
1639- SourcePackageRelease, rows, ["sourcepackagereleaseID"]
1640+ SourcePackageRelease, rows, ["sourcepackagerelease_id"]
1641 )
1642
1643 return DecoratedResultSet(sources, pre_iter_hook=eager_load)
1644@@ -927,7 +925,7 @@ class Archive(SQLBase):
1645 ),
1646 SourcePackagePublishingHistory.archive == self.id,
1647 SourcePackagePublishingHistory.dateremoved == None,
1648- SourcePackagePublishingHistory.sourcepackagereleaseID
1649+ SourcePackagePublishingHistory.sourcepackagerelease_id
1650 == SourcePackageReleaseFile.sourcepackagerelease_id,
1651 SourcePackageReleaseFile.libraryfile_id == LibraryFileAlias.id,
1652 LibraryFileAlias.contentID == LibraryFileContent.id,
1653@@ -968,7 +966,7 @@ class Archive(SQLBase):
1654
1655 Returns a list of 'clauses' (to be joined in the callsite).
1656 """
1657- clauses = [BinaryPackagePublishingHistory.archiveID == self.id]
1658+ clauses = [BinaryPackagePublishingHistory.archive == self]
1659
1660 if order_by_date:
1661 ordered = False
1662@@ -991,7 +989,7 @@ class Archive(SQLBase):
1663
1664 if ordered or name is not None:
1665 clauses.append(
1666- BinaryPackagePublishingHistory.binarypackagenameID
1667+ BinaryPackagePublishingHistory.binarypackagename_id
1668 == BinaryPackageName.id
1669 )
1670
1671@@ -1003,7 +1001,7 @@ class Archive(SQLBase):
1672
1673 if need_bpr or ordered or version is not None:
1674 clauses.append(
1675- BinaryPackagePublishingHistory.binarypackagereleaseID
1676+ BinaryPackagePublishingHistory.binarypackagerelease_id
1677 == BinaryPackageRelease.id
1678 )
1679
1680@@ -1034,7 +1032,7 @@ class Archive(SQLBase):
1681 except TypeError:
1682 distroarchseries = (distroarchseries,)
1683 clauses.append(
1684- BinaryPackagePublishingHistory.distroarchseriesID.is_in(
1685+ BinaryPackagePublishingHistory.distroarchseries_id.is_in(
1686 [d.id for d in distroarchseries]
1687 )
1688 )
1689@@ -1111,7 +1109,7 @@ class Archive(SQLBase):
1690
1691 def eager_load_api(bpphs):
1692 bprs = load_related(
1693- BinaryPackageRelease, bpphs, ["binarypackagereleaseID"]
1694+ BinaryPackageRelease, bpphs, ["binarypackagerelease_id"]
1695 )
1696 load_related(BinaryPackageName, bprs, ["binarypackagenameID"])
1697 bpbs = load_related(BinaryPackageBuild, bprs, ["buildID"])
1698@@ -1122,7 +1120,7 @@ class Archive(SQLBase):
1699 load_related(Component, bpphs, ["component_id"])
1700 load_related(Section, bpphs, ["section_id"])
1701 dases = load_related(
1702- DistroArchSeries, bpphs, ["distroarchseriesID"]
1703+ DistroArchSeries, bpphs, ["distroarchseries_id"]
1704 )
1705 load_related(DistroSeries, dases, ["distroseriesID"])
1706
1707@@ -1156,7 +1154,7 @@ class Archive(SQLBase):
1708
1709 clauses.extend(
1710 [
1711- BinaryPackagePublishingHistory.distroarchseriesID
1712+ BinaryPackagePublishingHistory.distroarchseries_id
1713 == DistroArchSeries.id,
1714 DistroArchSeries.distroseriesID == DistroSeries.id,
1715 ]
1716@@ -1170,7 +1168,7 @@ class Archive(SQLBase):
1717 # architecture-specific built for 'nominatedarchindep'.
1718 nominated_arch_independent_clauses = clauses + [
1719 DistroSeries.nominatedarchindepID
1720- == BinaryPackagePublishingHistory.distroarchseriesID,
1721+ == BinaryPackagePublishingHistory.distroarchseries_id,
1722 ]
1723 nominated_arch_independents = store.find(
1724 BinaryPackagePublishingHistory, *nominated_arch_independent_clauses
1725@@ -1180,7 +1178,7 @@ class Archive(SQLBase):
1726 # 'nominatedarchindep' (already included in the previous query).
1727 no_nominated_arch_independent_clauses = clauses + [
1728 DistroSeries.nominatedarchindepID
1729- != BinaryPackagePublishingHistory.distroarchseriesID,
1730+ != BinaryPackagePublishingHistory.distroarchseries_id,
1731 BinaryPackageRelease.architecturespecific == True,
1732 ]
1733 no_nominated_arch_independents = store.find(
1734@@ -1216,7 +1214,7 @@ class Archive(SQLBase):
1735 ),
1736 BinaryPackagePublishingHistory.archive == self.id,
1737 BinaryPackagePublishingHistory.dateremoved == None,
1738- BinaryPackagePublishingHistory.binarypackagereleaseID
1739+ BinaryPackagePublishingHistory.binarypackagerelease_id
1740 == BinaryPackageFile.binarypackagerelease_id,
1741 BinaryPackageFile.libraryfile_id == LibraryFileAlias.id,
1742 LibraryFileAlias.contentID == LibraryFileContent.id,
1743@@ -1342,7 +1340,7 @@ class Archive(SQLBase):
1744 archive_clause = Or(
1745 [
1746 And(
1747- BinaryPackagePublishingHistory.archiveID == archive.id,
1748+ BinaryPackagePublishingHistory.archive == archive,
1749 BinaryPackagePublishingHistory.pocket == pocket,
1750 Component.name.is_in(components),
1751 )
1752@@ -2009,21 +2007,21 @@ class Archive(SQLBase):
1753 if re_issource.match(filename):
1754 clauses = (
1755 SourcePackagePublishingHistory.archive == self.id,
1756- SourcePackagePublishingHistory.sourcepackagereleaseID
1757+ SourcePackagePublishingHistory.sourcepackagerelease_id
1758 == SourcePackageReleaseFile.sourcepackagerelease_id,
1759 SourcePackageReleaseFile.libraryfile_id == LibraryFileAlias.id,
1760 )
1761 elif re_isadeb.match(filename):
1762 clauses = (
1763 BinaryPackagePublishingHistory.archive == self.id,
1764- BinaryPackagePublishingHistory.binarypackagereleaseID
1765+ BinaryPackagePublishingHistory.binarypackagerelease_id
1766 == BinaryPackageFile.binarypackagerelease_id,
1767 BinaryPackageFile.libraryfile_id == LibraryFileAlias.id,
1768 )
1769 elif filename.endswith(".changes"):
1770 clauses = (
1771 SourcePackagePublishingHistory.archive == self.id,
1772- SourcePackagePublishingHistory.sourcepackagereleaseID
1773+ SourcePackagePublishingHistory.sourcepackagerelease_id
1774 == PackageUploadSource.sourcepackagerelease_id,
1775 PackageUploadSource.packageupload_id == PackageUpload.id,
1776 PackageUpload.status == PackageUploadStatus.DONE,
1777@@ -2048,7 +2046,7 @@ class Archive(SQLBase):
1778 if filename.endswith(".diff.gz"):
1779 clauses = (
1780 SourcePackagePublishingHistory.archive == self.id,
1781- SourcePackagePublishingHistory.sourcepackagereleaseID
1782+ SourcePackagePublishingHistory.sourcepackagerelease_id
1783 == PackageDiff.to_source_id,
1784 PackageDiff.diff_content_id == LibraryFileAlias.id,
1785 )
1786@@ -2065,7 +2063,7 @@ class Archive(SQLBase):
1787 result = IStore(LibraryFileAlias).find(
1788 LibraryFileAlias,
1789 SourcePackagePublishingHistory.archive == self,
1790- SourcePackagePublishingHistory.sourcepackagereleaseID
1791+ SourcePackagePublishingHistory.sourcepackagerelease_id
1792 == SourcePackageRelease.id,
1793 SourcePackageRelease.sourcepackagename == SourcePackageName.id,
1794 SourcePackageName.name == name,
1795@@ -2170,7 +2168,7 @@ class Archive(SQLBase):
1796 BinaryPackageRelease,
1797 BinaryPackagePublishingHistory.archive == self,
1798 BinaryPackagePublishingHistory.binarypackagename == name,
1799- BinaryPackagePublishingHistory.binarypackagereleaseID
1800+ BinaryPackagePublishingHistory.binarypackagerelease_id
1801 == BinaryPackageRelease.id,
1802 Cast(BinaryPackageRelease.version, "text") == version,
1803 BinaryPackageBuild.id == BinaryPackageRelease.buildID,
1804@@ -2194,7 +2192,7 @@ class Archive(SQLBase):
1805 BinaryPackageFile.libraryfile_id == LibraryFileAlias.id,
1806 LibraryFileAlias.filename == filename,
1807 BinaryPackagePublishingHistory.archive == self,
1808- BinaryPackagePublishingHistory.binarypackagereleaseID
1809+ BinaryPackagePublishingHistory.binarypackagerelease_id
1810 == BinaryPackageRelease.id,
1811 )
1812 .order_by(Desc(BinaryPackagePublishingHistory.id))
1813diff --git a/lib/lp/soyuz/model/binarypackagebuild.py b/lib/lp/soyuz/model/binarypackagebuild.py
1814index 22351b8..22ca39a 100644
1815--- a/lib/lp/soyuz/model/binarypackagebuild.py
1816+++ b/lib/lp/soyuz/model/binarypackagebuild.py
1817@@ -1170,7 +1170,7 @@ class BinaryPackageBuildSet(SpecificBuildFarmJobSourceMixin):
1818 Join(
1819 BinaryPackageRelease,
1820 BinaryPackageRelease.id
1821- == BinaryPackagePublishingHistory.binarypackagereleaseID,
1822+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
1823 ),
1824 ),
1825 where=And(
1826diff --git a/lib/lp/soyuz/model/binarypackagename.py b/lib/lp/soyuz/model/binarypackagename.py
1827index 1516166..a60dbab 100644
1828--- a/lib/lp/soyuz/model/binarypackagename.py
1829+++ b/lib/lp/soyuz/model/binarypackagename.py
1830@@ -88,12 +88,12 @@ class BinaryPackageNameSet:
1831 BinaryPackagePublishingHistory,
1832 Join(
1833 BinaryPackageName,
1834- BinaryPackagePublishingHistory.binarypackagenameID
1835+ BinaryPackagePublishingHistory.binarypackagename_id
1836 == BinaryPackageName.id,
1837 ),
1838 Join(
1839 DistroArchSeries,
1840- BinaryPackagePublishingHistory.distroarchseriesID
1841+ BinaryPackagePublishingHistory.distroarchseries_id
1842 == DistroArchSeries.id,
1843 ),
1844 )
1845@@ -103,8 +103,8 @@ class BinaryPackageNameSet:
1846 BinaryPackagePublishingHistory.status.is_in(
1847 active_publishing_status
1848 ),
1849- BinaryPackagePublishingHistory.archiveID.is_in(archive_ids),
1850- BinaryPackagePublishingHistory.binarypackagenameID.is_in(
1851+ BinaryPackagePublishingHistory.archive_id.is_in(archive_ids),
1852+ BinaryPackagePublishingHistory.binarypackagename_id.is_in(
1853 name_ids
1854 ),
1855 )
1856diff --git a/lib/lp/soyuz/model/binarysourcereference.py b/lib/lp/soyuz/model/binarysourcereference.py
1857index 0962186..a65a7f9 100644
1858--- a/lib/lp/soyuz/model/binarysourcereference.py
1859+++ b/lib/lp/soyuz/model/binarysourcereference.py
1860@@ -134,7 +134,7 @@ class BinarySourceReferenceSet:
1861 )
1862 )
1863 values.append(
1864- (bpr.id, closest_spph.sourcepackagereleaseID, reference_type)
1865+ (bpr.id, closest_spph.sourcepackagerelease_id, reference_type)
1866 )
1867
1868 return create(
1869diff --git a/lib/lp/soyuz/model/distributionsourcepackagecache.py b/lib/lp/soyuz/model/distributionsourcepackagecache.py
1870index 31ee732..aba6e2d 100644
1871--- a/lib/lp/soyuz/model/distributionsourcepackagecache.py
1872+++ b/lib/lp/soyuz/model/distributionsourcepackagecache.py
1873@@ -89,7 +89,7 @@ class DistributionSourcePackageCache(StormBase):
1874 )
1875 else:
1876 spn_ids = IStore(SourcePackagePublishingHistory).find(
1877- SourcePackagePublishingHistory.sourcepackagenameID,
1878+ SourcePackagePublishingHistory.sourcepackagename_id,
1879 SourcePackagePublishingHistory.archive == archive,
1880 SourcePackagePublishingHistory.status.is_in(
1881 active_publishing_status
1882@@ -174,8 +174,8 @@ class DistributionSourcePackageCache(StormBase):
1883 SourcePackageRelease.version,
1884 ),
1885 SourcePackageRelease.id
1886- == SourcePackagePublishingHistory.sourcepackagereleaseID,
1887- SourcePackagePublishingHistory.sourcepackagenameID.is_in(
1888+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
1889+ SourcePackagePublishingHistory.sourcepackagename_id.is_in(
1890 [spn.id for spn in sourcepackagenames]
1891 ),
1892 SourcePackagePublishingHistory.archive == archive,
1893diff --git a/lib/lp/soyuz/model/distributionsourcepackagerelease.py b/lib/lp/soyuz/model/distributionsourcepackagerelease.py
1894index 9002ce6..19eb9f3 100644
1895--- a/lib/lp/soyuz/model/distributionsourcepackagerelease.py
1896+++ b/lib/lp/soyuz/model/distributionsourcepackagerelease.py
1897@@ -49,17 +49,17 @@ class DistributionSourcePackageRelease:
1898
1899 res = Store.of(distribution).find(
1900 SourcePackagePublishingHistory,
1901- SourcePackagePublishingHistory.archiveID.is_in(
1902+ SourcePackagePublishingHistory.archive_id.is_in(
1903 distribution.all_distro_archive_ids
1904 ),
1905- SourcePackagePublishingHistory.distroseriesID == DistroSeries.id,
1906+ SourcePackagePublishingHistory.distroseries_id == DistroSeries.id,
1907 DistroSeries.distribution == distribution,
1908- SourcePackagePublishingHistory.sourcepackagereleaseID.is_in(
1909+ SourcePackagePublishingHistory.sourcepackagerelease_id.is_in(
1910 spr.id for spr in sprs
1911 ),
1912 )
1913 return res.order_by(
1914- Desc(SourcePackagePublishingHistory.sourcepackagereleaseID),
1915+ Desc(SourcePackagePublishingHistory.sourcepackagerelease_id),
1916 Desc(SourcePackagePublishingHistory.datecreated),
1917 Desc(SourcePackagePublishingHistory.id),
1918 )
1919@@ -118,7 +118,7 @@ class DistributionSourcePackageRelease:
1920 BinaryPackageRelease.build == BinaryPackageBuild.id,
1921 BinaryPackagePublishingHistory.binarypackagerelease
1922 == BinaryPackageRelease.id,
1923- BinaryPackagePublishingHistory.archiveID.is_in(
1924+ BinaryPackagePublishingHistory.archive_id.is_in(
1925 self.distribution.all_distro_archive_ids
1926 ),
1927 *clauses,
1928@@ -165,7 +165,7 @@ class DistributionSourcePackageRelease:
1929 Join(
1930 DistroArchSeries,
1931 DistroArchSeries.id
1932- == BinaryPackagePublishingHistory.distroarchseriesID,
1933+ == BinaryPackagePublishingHistory.distroarchseries_id,
1934 ),
1935 Join(
1936 DistroSeries,
1937@@ -174,7 +174,7 @@ class DistributionSourcePackageRelease:
1938 Join(
1939 BinaryPackageRelease,
1940 BinaryPackageRelease.id
1941- == BinaryPackagePublishingHistory.binarypackagereleaseID,
1942+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
1943 ),
1944 Join(
1945 BinaryPackageName,
1946@@ -202,7 +202,7 @@ class DistributionSourcePackageRelease:
1947 .find(
1948 result_row,
1949 DistroSeries.distribution == self.distribution,
1950- BinaryPackagePublishingHistory.archiveID.is_in(archive_ids),
1951+ BinaryPackagePublishingHistory.archive_id.is_in(archive_ids),
1952 BinaryPackageBuild.source_package_release
1953 == self.sourcepackagerelease,
1954 )
1955@@ -236,12 +236,12 @@ class DistributionSourcePackageRelease:
1956 Join(
1957 BinaryPackagePublishingHistory,
1958 BinaryPackageRelease.id
1959- == BinaryPackagePublishingHistory.binarypackagereleaseID,
1960+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
1961 ),
1962 Join(
1963 DistroArchSeries,
1964 DistroArchSeries.id
1965- == BinaryPackagePublishingHistory.distroarchseriesID,
1966+ == BinaryPackagePublishingHistory.distroarchseries_id,
1967 ),
1968 Join(
1969 BinaryPackageName,
1970@@ -254,7 +254,7 @@ class DistributionSourcePackageRelease:
1971 result_row,
1972 And(
1973 DistroArchSeries.distroseriesID == distroseries.id,
1974- BinaryPackagePublishingHistory.archiveID.is_in(archive_ids),
1975+ BinaryPackagePublishingHistory.archive_id.is_in(archive_ids),
1976 BinaryPackageBuild.source_package_release
1977 == self.sourcepackagerelease,
1978 ),
1979diff --git a/lib/lp/soyuz/model/distroarchseries.py b/lib/lp/soyuz/model/distroarchseries.py
1980index 66cd8b1..db9c6d8 100644
1981--- a/lib/lp/soyuz/model/distroarchseries.py
1982+++ b/lib/lp/soyuz/model/distroarchseries.py
1983@@ -115,7 +115,7 @@ class DistroArchSeries(SQLBase):
1984 .find(
1985 BinaryPackagePublishingHistory,
1986 BinaryPackagePublishingHistory.distroarchseries == self,
1987- BinaryPackagePublishingHistory.archiveID.is_in(
1988+ BinaryPackagePublishingHistory.archive_id.is_in(
1989 self.distroseries.distribution.all_distro_archive_ids
1990 ),
1991 BinaryPackagePublishingHistory.status
1992@@ -302,7 +302,7 @@ class DistroArchSeries(SQLBase):
1993
1994 clauses = [
1995 BinaryPackagePublishingHistory.distroarchseries == self,
1996- BinaryPackagePublishingHistory.archiveID.is_in(archives),
1997+ BinaryPackagePublishingHistory.archive_id.is_in(archives),
1998 BinaryPackagePublishingHistory.status.is_in(
1999 active_publishing_status
2000 ),
2001diff --git a/lib/lp/soyuz/model/distroarchseriesbinarypackage.py b/lib/lp/soyuz/model/distroarchseriesbinarypackage.py
2002index d85b423..2e710e3 100644
2003--- a/lib/lp/soyuz/model/distroarchseriesbinarypackage.py
2004+++ b/lib/lp/soyuz/model/distroarchseriesbinarypackage.py
2005@@ -115,12 +115,12 @@ class DistroArchSeriesBinaryPackage:
2006 return [
2007 BinaryPackagePublishingHistory.distroarchseries
2008 == self.distroarchseries,
2009- BinaryPackagePublishingHistory.archiveID.is_in(
2010+ BinaryPackagePublishingHistory.archive_id.is_in(
2011 self.distribution.all_distro_archive_ids
2012 ),
2013 BinaryPackagePublishingHistory.binarypackagename
2014 == self.binarypackagename,
2015- BinaryPackagePublishingHistory.binarypackagereleaseID
2016+ BinaryPackagePublishingHistory.binarypackagerelease_id
2017 == BinaryPackageRelease.id,
2018 ]
2019
2020diff --git a/lib/lp/soyuz/model/distroarchseriesbinarypackagerelease.py b/lib/lp/soyuz/model/distroarchseriesbinarypackagerelease.py
2021index 8d6a5b2..cdf4c61 100644
2022--- a/lib/lp/soyuz/model/distroarchseriesbinarypackagerelease.py
2023+++ b/lib/lp/soyuz/model/distroarchseriesbinarypackagerelease.py
2024@@ -93,7 +93,7 @@ class DistroArchSeriesBinaryPackageRelease:
2025 == self.binarypackagerelease,
2026 BinaryPackagePublishingHistory.distroarchseries
2027 == self.distroarchseries,
2028- BinaryPackagePublishingHistory.archiveID.is_in(
2029+ BinaryPackagePublishingHistory.archive_id.is_in(
2030 self.distribution.all_distro_archive_ids
2031 ),
2032 ]
2033@@ -122,7 +122,7 @@ class DistroArchSeriesBinaryPackageRelease:
2034 BinaryPackagePublishingHistory,
2035 BinaryPackagePublishingHistory.distroarchseries
2036 == self.distroarchseries,
2037- BinaryPackagePublishingHistory.archiveID.is_in(
2038+ BinaryPackagePublishingHistory.archive_id.is_in(
2039 self.distribution.all_distro_archive_ids
2040 ),
2041 BinaryPackagePublishingHistory.binarypackagerelease
2042diff --git a/lib/lp/soyuz/model/distroseriesbinarypackage.py b/lib/lp/soyuz/model/distroseriesbinarypackage.py
2043index 3e3f4c5..6a5f6c7 100644
2044--- a/lib/lp/soyuz/model/distroseriesbinarypackage.py
2045+++ b/lib/lp/soyuz/model/distroseriesbinarypackage.py
2046@@ -114,7 +114,7 @@ class DistroSeriesBinaryPackage:
2047 == BinaryPackageRelease.id,
2048 BinaryPackagePublishingHistory.binarypackagename
2049 == self.binarypackagename,
2050- BinaryPackagePublishingHistory.archiveID.is_in(
2051+ BinaryPackagePublishingHistory.archive_id.is_in(
2052 self.distribution.all_distro_archive_ids
2053 ),
2054 BinaryPackagePublishingHistory.dateremoved == None,
2055diff --git a/lib/lp/soyuz/model/distroseriesdifferencejob.py b/lib/lp/soyuz/model/distroseriesdifferencejob.py
2056index 9420cb6..d1e73f5 100644
2057--- a/lib/lp/soyuz/model/distroseriesdifferencejob.py
2058+++ b/lib/lp/soyuz/model/distroseriesdifferencejob.py
2059@@ -77,7 +77,7 @@ def create_multiple_jobs(derived_series, parent_series):
2060 """
2061 store = IStore(SourcePackagePublishingHistory)
2062 spn_ids = store.find(
2063- SourcePackagePublishingHistory.sourcepackagenameID,
2064+ SourcePackagePublishingHistory.sourcepackagename_id,
2065 SourcePackagePublishingHistory.distroseries == derived_series.id,
2066 SourcePackagePublishingHistory.status.is_in(active_publishing_status),
2067 )
2068diff --git a/lib/lp/soyuz/model/distroseriespackagecache.py b/lib/lp/soyuz/model/distroseriespackagecache.py
2069index 769e654..6c09b45 100644
2070--- a/lib/lp/soyuz/model/distroseriespackagecache.py
2071+++ b/lib/lp/soyuz/model/distroseriespackagecache.py
2072@@ -63,8 +63,8 @@ class DistroSeriesPackageCache(StormBase):
2073 bpn_ids = (
2074 IStore(BinaryPackagePublishingHistory)
2075 .find(
2076- BinaryPackagePublishingHistory.binarypackagenameID,
2077- BinaryPackagePublishingHistory.distroarchseriesID.is_in(
2078+ BinaryPackagePublishingHistory.binarypackagename_id,
2079+ BinaryPackagePublishingHistory.distroarchseries_id.is_in(
2080 Select(
2081 DistroArchSeries.id,
2082 tables=[DistroArchSeries],
2083@@ -80,7 +80,7 @@ class DistroSeriesPackageCache(StormBase):
2084 # Not necessary for correctness, but useful for testability; and
2085 # at the time of writing the sort only adds perhaps 10-20 ms to
2086 # the query time on staging.
2087- .order_by(BinaryPackagePublishingHistory.binarypackagenameID)
2088+ .order_by(BinaryPackagePublishingHistory.binarypackagename_id)
2089 )
2090 return bulk.load(BinaryPackageName, bpn_ids)
2091
2092@@ -155,11 +155,11 @@ class DistroSeriesPackageCache(StormBase):
2093 Max(BinaryPackageRelease.datecreated),
2094 ),
2095 BinaryPackageRelease.id
2096- == BinaryPackagePublishingHistory.binarypackagereleaseID,
2097- BinaryPackagePublishingHistory.binarypackagenameID.is_in(
2098+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
2099+ BinaryPackagePublishingHistory.binarypackagename_id.is_in(
2100 [bpn.id for bpn in binarypackagenames]
2101 ),
2102- BinaryPackagePublishingHistory.distroarchseriesID.is_in(
2103+ BinaryPackagePublishingHistory.distroarchseries_id.is_in(
2104 Select(
2105 DistroArchSeries.id,
2106 tables=[DistroArchSeries],
2107diff --git a/lib/lp/soyuz/model/publishing.py b/lib/lp/soyuz/model/publishing.py
2108index ba47074..a6161c9 100644
2109--- a/lib/lp/soyuz/model/publishing.py
2110+++ b/lib/lp/soyuz/model/publishing.py
2111@@ -20,7 +20,7 @@ from pathlib import Path
2112 from storm.databases.postgres import JSON
2113 from storm.expr import And, Cast, Desc, Join, LeftJoin, Not, Or, Sum
2114 from storm.info import ClassAlias
2115-from storm.properties import Int
2116+from storm.properties import DateTime, Int, Unicode
2117 from storm.references import Reference
2118 from storm.store import Store
2119 from storm.zope import IResultSet
2120@@ -39,12 +39,10 @@ from lp.registry.model.sourcepackagename import SourcePackageName
2121 from lp.services.channels import channel_list_to_string, channel_string_to_list
2122 from lp.services.database import bulk
2123 from lp.services.database.constants import UTC_NOW
2124-from lp.services.database.datetimecol import UtcDateTimeCol
2125 from lp.services.database.decoratedresultset import DecoratedResultSet
2126 from lp.services.database.enumcol import DBEnum
2127 from lp.services.database.interfaces import IPrimaryStore, IStore
2128-from lp.services.database.sqlbase import SQLBase
2129-from lp.services.database.sqlobject import ForeignKey, IntCol, StringCol
2130+from lp.services.database.stormbase import StormBase
2131 from lp.services.database.stormexpr import IsDistinctFrom
2132 from lp.services.librarian.browser import ProxiedLibraryFileAlias
2133 from lp.services.librarian.model import LibraryFileAlias, LibraryFileContent
2134@@ -236,14 +234,17 @@ class ArchivePublisherBase:
2135
2136
2137 @implementer(ISourcePackagePublishingHistory)
2138-class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
2139+class SourcePackagePublishingHistory(StormBase, ArchivePublisherBase):
2140 """A source package release publishing record."""
2141
2142- sourcepackagename = ForeignKey(
2143- foreignKey="SourcePackageName", dbName="sourcepackagename"
2144- )
2145- sourcepackagerelease = ForeignKey(
2146- foreignKey="SourcePackageRelease", dbName="sourcepackagerelease"
2147+ __storm_table__ = "SourcePackagePublishingHistory"
2148+
2149+ id = Int(primary=True)
2150+ sourcepackagename_id = Int(name="sourcepackagename")
2151+ sourcepackagename = Reference(sourcepackagename_id, "SourcePackageName.id")
2152+ sourcepackagerelease_id = Int(name="sourcepackagerelease")
2153+ sourcepackagerelease = Reference(
2154+ sourcepackagerelease_id, "SourcePackageRelease.id"
2155 )
2156 _format = DBEnum(
2157 name="format",
2158@@ -251,7 +252,8 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
2159 default=SourcePackageType.DPKG,
2160 allow_none=True,
2161 )
2162- distroseries = ForeignKey(foreignKey="DistroSeries", dbName="distroseries")
2163+ distroseries_id = Int(name="distroseries")
2164+ distroseries = Reference(distroseries_id, "DistroSeries.id")
2165 # DB constraint: non-nullable for SourcePackageType.DPKG.
2166 component_id = Int(name="component", allow_none=True)
2167 component = Reference(component_id, "Component.id")
2168@@ -259,15 +261,14 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
2169 section_id = Int(name="section", allow_none=True)
2170 section = Reference(section_id, "Section.id")
2171 status = DBEnum(enum=PackagePublishingStatus)
2172- scheduleddeletiondate = UtcDateTimeCol(default=None)
2173- datepublished = UtcDateTimeCol(default=None)
2174- datecreated = UtcDateTimeCol(default=UTC_NOW)
2175- datesuperseded = UtcDateTimeCol(default=None)
2176- supersededby = ForeignKey(
2177- foreignKey="SourcePackageRelease", dbName="supersededby", default=None
2178- )
2179- datemadepending = UtcDateTimeCol(default=None)
2180- dateremoved = UtcDateTimeCol(default=None)
2181+ scheduleddeletiondate = DateTime(default=None, tzinfo=timezone.utc)
2182+ datepublished = DateTime(default=None, tzinfo=timezone.utc)
2183+ datecreated = DateTime(default=UTC_NOW, tzinfo=timezone.utc)
2184+ datesuperseded = DateTime(default=None, tzinfo=timezone.utc)
2185+ supersededby_id = Int(name="supersededby", default=None)
2186+ supersededby = Reference(supersededby_id, "SourcePackageRelease.id")
2187+ datemadepending = DateTime(default=None, tzinfo=timezone.utc)
2188+ dateremoved = DateTime(default=None, tzinfo=timezone.utc)
2189 pocket = DBEnum(
2190 name="pocket",
2191 enum=PackagePublishingPocket,
2192@@ -275,39 +276,77 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
2193 allow_none=False,
2194 )
2195 _channel = JSON(name="channel", allow_none=True)
2196- archive = ForeignKey(dbName="archive", foreignKey="Archive", notNull=True)
2197- copied_from_archive = ForeignKey(
2198- dbName="copied_from_archive", foreignKey="Archive", notNull=False
2199+ archive_id = Int(name="archive", allow_none=False)
2200+ archive = Reference(archive_id, "Archive.id")
2201+ copied_from_archive_id = Int(name="copied_from_archive", allow_none=True)
2202+ copied_from_archive = Reference(copied_from_archive_id, "Archive.id")
2203+ removed_by_id = Int(
2204+ name="removed_by", validator=validate_public_person, default=None
2205 )
2206- removed_by = ForeignKey(
2207- dbName="removed_by",
2208- foreignKey="Person",
2209- storm_validator=validate_public_person,
2210- default=None,
2211- )
2212- removal_comment = StringCol(dbName="removal_comment", default=None)
2213- ancestor = ForeignKey(
2214- dbName="ancestor",
2215- foreignKey="SourcePackagePublishingHistory",
2216- default=None,
2217- )
2218- creator = ForeignKey(
2219- dbName="creator",
2220- foreignKey="Person",
2221- storm_validator=validate_public_person,
2222- notNull=False,
2223+ removed_by = Reference(removed_by_id, "Person.id")
2224+ removal_comment = Unicode(name="removal_comment", default=None)
2225+ ancestor_id = Int(name="ancestor", default=None)
2226+ ancestor = Reference(ancestor_id, "SourcePackagePublishingHistory.id")
2227+ creator_id = Int(
2228+ name="creator",
2229+ validator=validate_public_person,
2230+ allow_none=True,
2231 default=None,
2232 )
2233- sponsor = ForeignKey(
2234- dbName="sponsor",
2235- foreignKey="Person",
2236- storm_validator=validate_public_person,
2237- notNull=False,
2238+ creator = Reference(creator_id, "Person.id")
2239+ sponsor_id = Int(
2240+ name="sponsor",
2241+ validator=validate_public_person,
2242+ allow_none=True,
2243 default=None,
2244 )
2245+ sponsor = Reference(sponsor_id, "Person.id")
2246 packageupload_id = Int(name="packageupload", allow_none=True, default=None)
2247 packageupload = Reference(packageupload_id, "PackageUpload.id")
2248
2249+ def __init__(
2250+ self,
2251+ sourcepackagename,
2252+ sourcepackagerelease,
2253+ format,
2254+ distroseries,
2255+ pocket,
2256+ status,
2257+ archive,
2258+ component=None,
2259+ section=None,
2260+ scheduleddeletiondate=None,
2261+ datepublished=None,
2262+ datecreated=None,
2263+ dateremoved=None,
2264+ channel=None,
2265+ copied_from_archive=None,
2266+ ancestor=None,
2267+ creator=None,
2268+ sponsor=None,
2269+ packageupload=None,
2270+ ):
2271+ super().__init__()
2272+ self.sourcepackagename = sourcepackagename
2273+ self.sourcepackagerelease = sourcepackagerelease
2274+ self._format = format
2275+ self.distroseries = distroseries
2276+ self.pocket = pocket
2277+ self.status = status
2278+ self.archive = archive
2279+ self.component = component
2280+ self.section = section
2281+ self.scheduleddeletiondate = scheduleddeletiondate
2282+ self.datepublished = datepublished
2283+ self.datecreated = datecreated
2284+ self.dateremoved = dateremoved
2285+ self._channel = channel
2286+ self.copied_from_archive = copied_from_archive
2287+ self.ancestor = ancestor
2288+ self.creator = creator
2289+ self.sponsor = sponsor
2290+ self.packageupload = packageupload
2291+
2292 @property
2293 def format(self):
2294 # XXX cjwatson 2022-04-04: Remove once this column has been backfilled.
2295@@ -359,22 +398,22 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
2296 Store.of(self)
2297 .find(
2298 BinaryPackagePublishingHistory,
2299- BinaryPackagePublishingHistory.binarypackagereleaseID
2300+ BinaryPackagePublishingHistory.binarypackagerelease_id
2301 == BinaryPackageRelease.id,
2302- BinaryPackagePublishingHistory.distroarchseriesID
2303+ BinaryPackagePublishingHistory.distroarchseries_id
2304 == DistroArchSeries.id,
2305- BinaryPackagePublishingHistory.archiveID == self.archiveID,
2306+ BinaryPackagePublishingHistory.archive == self.archive_id,
2307 BinaryPackagePublishingHistory.pocket == self.pocket,
2308 BinaryPackageBuild.id == BinaryPackageRelease.buildID,
2309 BinaryPackageBuild.source_package_release_id
2310- == self.sourcepackagereleaseID,
2311- DistroArchSeries.distroseriesID == self.distroseriesID,
2312+ == self.sourcepackagerelease_id,
2313+ DistroArchSeries.distroseriesID == self.distroseries_id,
2314 )
2315 .order_by(Desc(BinaryPackagePublishingHistory.id))
2316 )
2317
2318 # Preload attached BinaryPackageReleases.
2319- bpr_ids = {pub.binarypackagereleaseID for pub in binary_publications}
2320+ bpr_ids = {pub.binarypackagerelease_id for pub in binary_publications}
2321 list(
2322 Store.of(self).find(
2323 BinaryPackageRelease, BinaryPackageRelease.id.is_in(bpr_ids)
2324@@ -662,7 +701,7 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
2325 LibraryFileContent.id == LibraryFileAlias.contentID,
2326 LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
2327 SourcePackageReleaseFile.sourcepackagerelease
2328- == self.sourcepackagereleaseID,
2329+ == self.sourcepackagerelease_id,
2330 )
2331 source_urls = proxied_source_urls(
2332 [source for source, _ in sources], self
2333@@ -746,21 +785,23 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
2334
2335
2336 @implementer(IBinaryPackagePublishingHistory)
2337-class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
2338+class BinaryPackagePublishingHistory(StormBase, ArchivePublisherBase):
2339 """A binary package publishing record."""
2340
2341- binarypackagename = ForeignKey(
2342- foreignKey="BinaryPackageName", dbName="binarypackagename"
2343- )
2344- binarypackagerelease = ForeignKey(
2345- foreignKey="BinaryPackageRelease", dbName="binarypackagerelease"
2346+ __storm_table__ = "BinaryPackagePublishingHistory"
2347+
2348+ id = Int(primary=True)
2349+ binarypackagename_id = Int(name="binarypackagename")
2350+ binarypackagename = Reference(binarypackagename_id, "BinaryPackageName.id")
2351+ binarypackagerelease_id = Int(name="binarypackagerelease")
2352+ binarypackagerelease = Reference(
2353+ binarypackagerelease_id, "BinaryPackageRelease.id"
2354 )
2355 _binarypackageformat = DBEnum(
2356 name="binarypackageformat", enum=BinaryPackageFormat, allow_none=True
2357 )
2358- distroarchseries = ForeignKey(
2359- foreignKey="DistroArchSeries", dbName="distroarchseries"
2360- )
2361+ distroarchseries_id = Int(name="distroarchseries")
2362+ distroarchseries = Reference(distroarchseries_id, "DistroArchSeries.id")
2363 # DB constraint: non-nullable for BinaryPackageFormat.{DEB,UDEB,DDEB}.
2364 component_id = Int(name="component", allow_none=True)
2365 component = Reference(component_id, "Component.id")
2366@@ -772,43 +813,80 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
2367 name="priority", enum=PackagePublishingPriority, allow_none=True
2368 )
2369 status = DBEnum(name="status", enum=PackagePublishingStatus)
2370- phased_update_percentage = IntCol(
2371- dbName="phased_update_percentage", notNull=False, default=None
2372+ phased_update_percentage = Int(
2373+ name="phased_update_percentage", allow_none=True, default=None
2374 )
2375- scheduleddeletiondate = UtcDateTimeCol(default=None)
2376- creator = ForeignKey(
2377- dbName="creator",
2378- foreignKey="Person",
2379- storm_validator=validate_public_person,
2380- notNull=False,
2381+ scheduleddeletiondate = DateTime(default=None, tzinfo=timezone.utc)
2382+ creator_id = Int(
2383+ name="creator",
2384+ validator=validate_public_person,
2385+ allow_none=True,
2386 default=None,
2387 )
2388- datepublished = UtcDateTimeCol(default=None)
2389- datecreated = UtcDateTimeCol(default=UTC_NOW)
2390- datesuperseded = UtcDateTimeCol(default=None)
2391- supersededby = ForeignKey(
2392- foreignKey="BinaryPackageBuild", dbName="supersededby", default=None
2393- )
2394- datemadepending = UtcDateTimeCol(default=None)
2395- dateremoved = UtcDateTimeCol(default=None)
2396+ creator = Reference(creator_id, "Person.id")
2397+ datepublished = DateTime(default=None, tzinfo=timezone.utc)
2398+ datecreated = DateTime(default=UTC_NOW, tzinfo=timezone.utc)
2399+ datesuperseded = DateTime(default=None, tzinfo=timezone.utc)
2400+ supersededby_id = Int(name="supersededby", default=None)
2401+ supersededby = Reference(supersededby_id, "BinaryPackageBuild.id")
2402+ datemadepending = DateTime(default=None, tzinfo=timezone.utc)
2403+ dateremoved = DateTime(default=None, tzinfo=timezone.utc)
2404 pocket = DBEnum(name="pocket", enum=PackagePublishingPocket)
2405 _channel = JSON(name="channel", allow_none=True)
2406- archive = ForeignKey(dbName="archive", foreignKey="Archive", notNull=True)
2407- copied_from_archive = ForeignKey(
2408- dbName="copied_from_archive", foreignKey="Archive", notNull=False
2409- )
2410- removed_by = ForeignKey(
2411- dbName="removed_by",
2412- foreignKey="Person",
2413- storm_validator=validate_public_person,
2414- default=None,
2415- )
2416- removal_comment = StringCol(dbName="removal_comment", default=None)
2417- sourcepackagename = ForeignKey(
2418- foreignKey="SourcePackageName",
2419- dbName="sourcepackagename",
2420- notNull=False,
2421+ archive_id = Int(name="archive", allow_none=False)
2422+ archive = Reference(archive_id, "Archive.id")
2423+ copied_from_archive_id = Int(name="copied_from_archive", allow_none=True)
2424+ copied_from_archive = Reference(copied_from_archive_id, "Archive.id")
2425+ removed_by_id = Int(
2426+ name="removed_by", validator=validate_public_person, default=None
2427 )
2428+ removed_by = Reference(removed_by_id, "Person.id")
2429+ removal_comment = Unicode(name="removal_comment", default=None)
2430+ sourcepackagename_id = Int(name="sourcepackagename", allow_none=True)
2431+ sourcepackagename = Reference(sourcepackagename_id, "SourcePackageName.id")
2432+
2433+ def __init__(
2434+ self,
2435+ binarypackagename,
2436+ binarypackagerelease,
2437+ binarypackageformat,
2438+ distroarchseries,
2439+ pocket,
2440+ status,
2441+ archive,
2442+ sourcepackagename,
2443+ component=None,
2444+ section=None,
2445+ priority=None,
2446+ phased_update_percentage=None,
2447+ scheduleddeletiondate=None,
2448+ creator=None,
2449+ datepublished=None,
2450+ datecreated=None,
2451+ dateremoved=None,
2452+ channel=None,
2453+ copied_from_archive=None,
2454+ ):
2455+ super().__init__()
2456+ self.binarypackagename = binarypackagename
2457+ self.binarypackagerelease = binarypackagerelease
2458+ self._binarypackageformat = binarypackageformat
2459+ self.distroarchseries = distroarchseries
2460+ self.pocket = pocket
2461+ self.status = status
2462+ self.archive = archive
2463+ self.sourcepackagename = sourcepackagename
2464+ self.component = component
2465+ self.section = section
2466+ self.priority = priority
2467+ self.phased_update_percentage = phased_update_percentage
2468+ self.scheduleddeletiondate = scheduleddeletiondate
2469+ self.creator = creator
2470+ self.datepublished = datepublished
2471+ self.datecreated = datecreated
2472+ self.dateremoved = dateremoved
2473+ self._channel = channel
2474+ self.copied_from_archive = copied_from_archive
2475
2476 @property
2477 def binarypackageformat(self):
2478@@ -961,7 +1039,7 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
2479 BinaryPackagePublishingHistory.status.is_in(
2480 active_publishing_status
2481 ),
2482- BinaryPackagePublishingHistory.distroarchseriesID.is_in(
2483+ BinaryPackagePublishingHistory.distroarchseries_id.is_in(
2484 available_architectures
2485 ),
2486 binarypackagerelease=self.binarypackagerelease,
2487@@ -1130,7 +1208,7 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
2488 BinaryPackagePublishingHistory(
2489 binarypackagename=debug.binarypackagename,
2490 binarypackagerelease=debug.binarypackagerelease,
2491- _binarypackageformat=debug.binarypackageformat,
2492+ binarypackageformat=debug.binarypackageformat,
2493 distroarchseries=debug.distroarchseries,
2494 status=PackagePublishingStatus.PENDING,
2495 datecreated=UTC_NOW,
2496@@ -1141,15 +1219,15 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
2497 creator=creator,
2498 archive=debug.archive,
2499 phased_update_percentage=new_phased_update_percentage,
2500- _channel=removeSecurityProxy(debug)._channel,
2501+ channel=removeSecurityProxy(debug)._channel,
2502 sourcepackagename=debug.sourcepackagename,
2503 )
2504
2505 # Append the modified package publishing entry
2506- return BinaryPackagePublishingHistory(
2507+ bpph = BinaryPackagePublishingHistory(
2508 binarypackagename=bpr.binarypackagename,
2509 binarypackagerelease=bpr,
2510- _binarypackageformat=bpr.binpackageformat,
2511+ binarypackageformat=bpr.binpackageformat,
2512 distroarchseries=self.distroarchseries,
2513 status=PackagePublishingStatus.PENDING,
2514 datecreated=UTC_NOW,
2515@@ -1160,13 +1238,15 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
2516 archive=self.archive,
2517 creator=creator,
2518 phased_update_percentage=new_phased_update_percentage,
2519- _channel=self._channel,
2520+ channel=self._channel,
2521 sourcepackagename=(
2522 bpr.build.source_package_name
2523 if bpr.build is not None
2524 else None
2525 ),
2526 )
2527+ IStore(bpph).flush()
2528+ return bpph
2529
2530 def copyTo(self, distroseries, pocket, archive):
2531 """See `BinaryPackagePublishingHistory`."""
2532@@ -1257,7 +1337,7 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
2533 LibraryFileContent.id == LibraryFileAlias.contentID,
2534 LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
2535 BinaryPackageFile.binarypackagerelease
2536- == self.binarypackagereleaseID,
2537+ == self.binarypackagerelease_id,
2538 )
2539 binary_urls = proxied_urls(
2540 [binary for binary, _ in binaries], self.archive
2541@@ -1351,10 +1431,10 @@ class PublishingSet:
2542 # conflicting binaries from other sources.
2543 def make_package_condition(archive, das, bpr):
2544 return And(
2545- BinaryPackagePublishingHistory.archiveID == archive.id,
2546- BinaryPackagePublishingHistory.distroarchseriesID == das.id,
2547- BinaryPackagePublishingHistory.binarypackagenameID
2548- == bpr.binarypackagenameID,
2549+ BinaryPackagePublishingHistory.archive == archive,
2550+ BinaryPackagePublishingHistory.distroarchseries == das,
2551+ BinaryPackagePublishingHistory.binarypackagename
2552+ == bpr.binarypackagename,
2553 Cast(BinaryPackageRelease.version, "text") == bpr.version,
2554 )
2555
2556@@ -1366,7 +1446,7 @@ class PublishingSet:
2557 IPrimaryStore(BinaryPackagePublishingHistory)
2558 .find(
2559 (
2560- BinaryPackagePublishingHistory.distroarchseriesID,
2561+ BinaryPackagePublishingHistory.distroarchseries_id,
2562 BinaryPackageRelease.binarypackagenameID,
2563 BinaryPackageRelease.version,
2564 ),
2565@@ -1381,7 +1461,7 @@ class PublishingSet:
2566 active_publishing_status
2567 ),
2568 BinaryPackageRelease.id
2569- == BinaryPackagePublishingHistory.binarypackagereleaseID,
2570+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
2571 Or(*candidates),
2572 )
2573 .config(distinct=True)
2574@@ -1610,7 +1690,7 @@ class PublishingSet:
2575 archive=archive,
2576 sourcepackagename=sourcepackagerelease.sourcepackagename,
2577 sourcepackagerelease=sourcepackagerelease,
2578- _format=sourcepackagerelease.format,
2579+ format=sourcepackagerelease.format,
2580 component=get_component(archive, distroseries, component),
2581 section=section,
2582 status=PackagePublishingStatus.PENDING,
2583@@ -1619,7 +1699,7 @@ class PublishingSet:
2584 creator=creator,
2585 sponsor=sponsor,
2586 packageupload=packageupload,
2587- _channel=channel,
2588+ channel=channel,
2589 )
2590 DistributionSourcePackage.ensure(pub)
2591
2592@@ -1655,9 +1735,9 @@ class PublishingSet:
2593 # We'll be looking for builds in the same distroseries as the
2594 # SPPH for the same release.
2595 builds_for_distroseries_expr = (
2596- SourcePackagePublishingHistory.distroseriesID
2597+ SourcePackagePublishingHistory.distroseries_id
2598 == BinaryPackageBuild.distro_series_id,
2599- SourcePackagePublishingHistory.sourcepackagereleaseID
2600+ SourcePackagePublishingHistory.sourcepackagerelease_id
2601 == BinaryPackageBuild.source_package_release_id,
2602 SourcePackagePublishingHistory.id.is_in(source_publication_ids),
2603 DistroArchSeries.id == BinaryPackageBuild.distro_arch_series_id,
2604@@ -1669,7 +1749,7 @@ class PublishingSet:
2605 BinaryPackageBuild,
2606 builds_for_distroseries_expr,
2607 (
2608- SourcePackagePublishingHistory.archiveID
2609+ SourcePackagePublishingHistory.archive_id
2610 == BinaryPackageBuild.archive_id
2611 ),
2612 *extra_exprs,
2613@@ -1682,11 +1762,11 @@ class PublishingSet:
2614 BinaryPackageBuild,
2615 builds_for_distroseries_expr,
2616 (
2617- SourcePackagePublishingHistory.archiveID
2618+ SourcePackagePublishingHistory.archive_id
2619 != BinaryPackageBuild.archive_id
2620 ),
2621 BinaryPackagePublishingHistory.archive
2622- == SourcePackagePublishingHistory.archiveID,
2623+ == SourcePackagePublishingHistory.archive_id,
2624 BinaryPackagePublishingHistory.binarypackagerelease
2625 == BinaryPackageRelease.id,
2626 BinaryPackageRelease.build == BinaryPackageBuild.id,
2627@@ -1768,20 +1848,20 @@ class PublishingSet:
2628 ):
2629 """Return the join linking sources with binaries."""
2630 join = [
2631- SourcePackagePublishingHistory.sourcepackagereleaseID
2632+ SourcePackagePublishingHistory.sourcepackagerelease_id
2633 == BinaryPackageBuild.source_package_release_id,
2634 BinaryPackageRelease.build == BinaryPackageBuild.id,
2635 BinaryPackageRelease.binarypackagenameID == BinaryPackageName.id,
2636- SourcePackagePublishingHistory.distroseriesID
2637+ SourcePackagePublishingHistory.distroseries_id
2638 == DistroArchSeries.distroseriesID,
2639- BinaryPackagePublishingHistory.distroarchseriesID
2640+ BinaryPackagePublishingHistory.distroarchseries_id
2641 == DistroArchSeries.id,
2642 BinaryPackagePublishingHistory.binarypackagerelease
2643 == BinaryPackageRelease.id,
2644 BinaryPackagePublishingHistory.pocket
2645 == SourcePackagePublishingHistory.pocket,
2646- BinaryPackagePublishingHistory.archiveID
2647- == SourcePackagePublishingHistory.archiveID,
2648+ BinaryPackagePublishingHistory.archive_id
2649+ == SourcePackagePublishingHistory.archive_id,
2650 SourcePackagePublishingHistory.id.is_in(source_publication_ids),
2651 ]
2652
2653@@ -1852,12 +1932,12 @@ class PublishingSet:
2654 LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
2655 BinaryPackageFile.binarypackagerelease == BinaryPackageRelease.id,
2656 BinaryPackageRelease.buildID == BinaryPackageBuild.id,
2657- SourcePackagePublishingHistory.sourcepackagereleaseID
2658+ SourcePackagePublishingHistory.sourcepackagerelease_id
2659 == BinaryPackageBuild.source_package_release_id,
2660- BinaryPackagePublishingHistory.binarypackagereleaseID
2661+ BinaryPackagePublishingHistory.binarypackagerelease_id
2662 == BinaryPackageRelease.id,
2663- BinaryPackagePublishingHistory.archiveID
2664- == SourcePackagePublishingHistory.archiveID,
2665+ BinaryPackagePublishingHistory.archive_id
2666+ == SourcePackagePublishingHistory.archive_id,
2667 SourcePackagePublishingHistory.id.is_in(source_publication_ids),
2668 )
2669
2670@@ -1879,7 +1959,7 @@ class PublishingSet:
2671 LibraryFileContent.id == LibraryFileAlias.contentID,
2672 LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
2673 SourcePackageReleaseFile.sourcepackagerelease
2674- == SourcePackagePublishingHistory.sourcepackagereleaseID,
2675+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
2676 SourcePackagePublishingHistory.id.is_in(source_publication_ids),
2677 )
2678
2679@@ -1953,10 +2033,10 @@ class PublishingSet:
2680 BinaryPackageBuild.source_package_release_id
2681 == sourcepackagerelease.id,
2682 BinaryPackageRelease.build == BinaryPackageBuild.id,
2683- BinaryPackagePublishingHistory.binarypackagereleaseID
2684+ BinaryPackagePublishingHistory.binarypackagerelease_id
2685 == BinaryPackageRelease.id,
2686- BinaryPackagePublishingHistory.archiveID == archive.id,
2687- BinaryPackagePublishingHistory.distroarchseriesID
2688+ BinaryPackagePublishingHistory.archive == archive,
2689+ BinaryPackagePublishingHistory.distroarchseries_id
2690 == DistroArchSeries.id,
2691 DistroArchSeries.distroseriesID == distroseries.id,
2692 BinaryPackagePublishingHistory.pocket == pocket,
2693@@ -1998,7 +2078,7 @@ class PublishingSet:
2694 # build_source_stanza_fields.
2695 bulk.load_related(Section, spphs, ["section_id"])
2696 sprs = bulk.load_related(
2697- SourcePackageRelease, spphs, ["sourcepackagereleaseID"]
2698+ SourcePackageRelease, spphs, ["sourcepackagerelease_id"]
2699 )
2700 bulk.load_related(SourcePackageName, sprs, ["sourcepackagenameID"])
2701 spr_ids = set(map(attrgetter("id"), sprs))
2702@@ -2057,7 +2137,7 @@ class PublishingSet:
2703 # build_binary_stanza_fields.
2704 bulk.load_related(Section, bpphs, ["section_id"])
2705 bprs = bulk.load_related(
2706- BinaryPackageRelease, bpphs, ["binarypackagereleaseID"]
2707+ BinaryPackageRelease, bpphs, ["binarypackagerelease_id"]
2708 )
2709 bpbs = bulk.load_related(BinaryPackageBuild, bprs, ["buildID"])
2710 sprs = bulk.load_related(
2711@@ -2107,7 +2187,7 @@ class PublishingSet:
2712 PackageUploadSource.sourcepackagerelease
2713 == SourcePackageRelease.id,
2714 SourcePackageRelease.id
2715- == SourcePackagePublishingHistory.sourcepackagereleaseID,
2716+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
2717 SourcePackagePublishingHistory.id.is_in(source_publication_ids),
2718 )
2719
2720@@ -2259,7 +2339,7 @@ class PublishingSet:
2721 affected_pubs.set(
2722 status=PackagePublishingStatus.DELETED,
2723 datesuperseded=UTC_NOW,
2724- removed_byID=removed_by_id,
2725+ removed_by_id=removed_by_id,
2726 removal_comment=removal_comment,
2727 )
2728
2729@@ -2277,7 +2357,7 @@ class PublishingSet:
2730 ).set(
2731 status=PackagePublishingStatus.DELETED,
2732 datesuperseded=UTC_NOW,
2733- removed_byID=removed_by_id,
2734+ removed_by_id=removed_by_id,
2735 removal_comment=removal_comment,
2736 )
2737
2738@@ -2290,11 +2370,11 @@ class PublishingSet:
2739 deb_bpph,
2740 Join(
2741 BinaryPackageRelease,
2742- deb_bpph.binarypackagereleaseID == BinaryPackageRelease.id,
2743+ deb_bpph.binarypackagerelease_id == BinaryPackageRelease.id,
2744 ),
2745 Join(
2746 debug_bpph,
2747- debug_bpph.binarypackagereleaseID
2748+ debug_bpph.binarypackagerelease_id
2749 == BinaryPackageRelease.debug_packageID,
2750 ),
2751 ]
2752@@ -2305,8 +2385,8 @@ class PublishingSet:
2753 debug_bpph,
2754 deb_bpph.id.is_in(ids),
2755 debug_bpph.status.is_in(active_publishing_status),
2756- deb_bpph.archiveID == debug_bpph.archiveID,
2757- deb_bpph.distroarchseriesID == debug_bpph.distroarchseriesID,
2758+ deb_bpph.archive_id == debug_bpph.archive_id,
2759+ deb_bpph.distroarchseries_id == debug_bpph.distroarchseries_id,
2760 deb_bpph.pocket == debug_bpph.pocket,
2761 deb_bpph.component_id == debug_bpph.component_id,
2762 deb_bpph.section_id == debug_bpph.section_id,
2763@@ -2393,10 +2473,10 @@ def get_current_source_releases(
2764 series_clauses = []
2765 for context, package_names in context_sourcepackagenames.items():
2766 clause = And(
2767- SourcePackagePublishingHistory.sourcepackagenameID.is_in(
2768+ SourcePackagePublishingHistory.sourcepackagename_id.is_in(
2769 map(attrgetter("id"), package_names)
2770 ),
2771- SourcePackagePublishingHistory.archiveID.is_in(
2772+ SourcePackagePublishingHistory.archive_id.is_in(
2773 archive_ids_func(context)
2774 ),
2775 package_clause_func(context),
2776@@ -2409,7 +2489,7 @@ def get_current_source_releases(
2777 IStore(SourcePackageRelease)
2778 .find(
2779 (SourcePackageRelease, key_col),
2780- SourcePackagePublishingHistory.sourcepackagereleaseID
2781+ SourcePackagePublishingHistory.sourcepackagerelease_id
2782 == SourcePackageRelease.id,
2783 SourcePackagePublishingHistory.status.is_in(
2784 active_publishing_status
2785diff --git a/lib/lp/soyuz/model/queue.py b/lib/lp/soyuz/model/queue.py
2786index 7b55896..fd7b594 100644
2787--- a/lib/lp/soyuz/model/queue.py
2788+++ b/lib/lp/soyuz/model/queue.py
2789@@ -1891,9 +1891,9 @@ def prefill_packageupload_caches(uploads, puses, pubs, pucs, logs):
2790 load_related(Component, sprs, ["component_id"])
2791 load_related(LibraryFileAlias, uploads, ["changes_file_id"])
2792 publications = load_referencing(
2793- SourcePackagePublishingHistory, sprs, ["sourcepackagereleaseID"]
2794+ SourcePackagePublishingHistory, sprs, ["sourcepackagerelease_id"]
2795 )
2796- load_related(Archive, publications, ["archiveID"])
2797+ load_related(Archive, publications, ["archive_id"])
2798 diffs = getUtility(IPackageDiffSet).getDiffsToReleases(
2799 sprs, preload_for_display=True
2800 )
2801diff --git a/lib/lp/soyuz/model/sourcepackagerelease.py b/lib/lp/soyuz/model/sourcepackagerelease.py
2802index c3b7ed3..8c27732 100644
2803--- a/lib/lp/soyuz/model/sourcepackagerelease.py
2804+++ b/lib/lp/soyuz/model/sourcepackagerelease.py
2805@@ -39,11 +39,7 @@ from lp.services.database.decoratedresultset import DecoratedResultSet
2806 from lp.services.database.enumcol import DBEnum
2807 from lp.services.database.interfaces import IStore
2808 from lp.services.database.sqlbase import SQLBase, cursor, sqlvalues
2809-from lp.services.database.sqlobject import (
2810- ForeignKey,
2811- SQLMultipleJoin,
2812- StringCol,
2813-)
2814+from lp.services.database.sqlobject import ForeignKey, StringCol
2815 from lp.services.librarian.model import LibraryFileAlias, LibraryFileContent
2816 from lp.services.propertycache import cachedproperty, get_property_cache
2817 from lp.soyuz.interfaces.archive import MAIN_ARCHIVE_PURPOSES
2818@@ -143,13 +139,6 @@ class SourcePackageRelease(SQLBase):
2819 dsc_format = StringCol(dbName="dsc_format")
2820 dsc_binaries = StringCol(dbName="dsc_binaries")
2821
2822- # MultipleJoins
2823- publishings = SQLMultipleJoin(
2824- "SourcePackagePublishingHistory",
2825- joinColumn="sourcepackagerelease",
2826- orderBy="-datecreated",
2827- )
2828-
2829 _user_defined_fields = StringCol(dbName="user_defined_fields")
2830
2831 def __init__(self, *args, **kwargs):
2832@@ -281,12 +270,36 @@ class SourcePackageRelease(SQLBase):
2833 def title(self):
2834 return "%s - %s" % (self.sourcepackagename.name, self.version)
2835
2836+ @property
2837+ def publishings(self):
2838+ # Circular import.
2839+ from lp.soyuz.model.publishing import SourcePackagePublishingHistory
2840+
2841+ return (
2842+ IStore(self)
2843+ .find(
2844+ SourcePackagePublishingHistory,
2845+ SourcePackagePublishingHistory.sourcepackagerelease == self,
2846+ )
2847+ .order_by(Desc(SourcePackagePublishingHistory.datecreated))
2848+ )
2849+
2850 @cachedproperty
2851 def published_archives(self):
2852- archives = {
2853- pub.archive for pub in self.publishings.prejoin(["archive"])
2854- }
2855- return sorted(archives, key=operator.attrgetter("id"))
2856+ # Circular imports.
2857+ from lp.soyuz.model.archive import Archive
2858+ from lp.soyuz.model.publishing import SourcePackagePublishingHistory
2859+
2860+ return list(
2861+ IStore(self)
2862+ .find(
2863+ Archive,
2864+ SourcePackagePublishingHistory.sourcepackagerelease == self,
2865+ SourcePackagePublishingHistory.archive == Archive.id,
2866+ )
2867+ .config(distinct=True)
2868+ .order_by(Archive.id)
2869+ )
2870
2871 def addFile(self, file, filetype=None):
2872 """See ISourcePackageRelease."""
2873diff --git a/lib/lp/soyuz/scripts/expire_archive_files.py b/lib/lp/soyuz/scripts/expire_archive_files.py
2874index 13af377..2a2e2bc 100755
2875--- a/lib/lp/soyuz/scripts/expire_archive_files.py
2876+++ b/lib/lp/soyuz/scripts/expire_archive_files.py
2877@@ -115,13 +115,13 @@ class ArchiveExpirer(LaunchpadCronScript):
2878 eligible_clauses.extend(
2879 [
2880 BPF.libraryfile == LFA.id,
2881- BPF.binarypackagerelease == BPPH.binarypackagereleaseID,
2882+ BPF.binarypackagerelease == BPPH.binarypackagerelease_id,
2883 BPPH.archive == Archive.id,
2884 ]
2885 )
2886 denied_clauses.extend(
2887 [
2888- BPF.binarypackagerelease == BPPH.binarypackagereleaseID,
2889+ BPF.binarypackagerelease == BPPH.binarypackagerelease_id,
2890 BPPH.archive == Archive.id,
2891 ]
2892 )
2893@@ -133,13 +133,13 @@ class ArchiveExpirer(LaunchpadCronScript):
2894 eligible_clauses.extend(
2895 [
2896 SPRF.libraryfile == LFA.id,
2897- SPRF.sourcepackagerelease == SPPH.sourcepackagereleaseID,
2898+ SPRF.sourcepackagerelease == SPPH.sourcepackagerelease_id,
2899 SPPH.archive == Archive.id,
2900 ]
2901 )
2902 denied_clauses.extend(
2903 [
2904- SPRF.sourcepackagerelease == SPPH.sourcepackagereleaseID,
2905+ SPRF.sourcepackagerelease == SPPH.sourcepackagerelease_id,
2906 SPPH.archive == Archive.id,
2907 ]
2908 )
2909diff --git a/lib/lp/soyuz/scripts/gina/handlers.py b/lib/lp/soyuz/scripts/gina/handlers.py
2910index a595340..fd62506 100644
2911--- a/lib/lp/soyuz/scripts/gina/handlers.py
2912+++ b/lib/lp/soyuz/scripts/gina/handlers.py
2913@@ -1038,7 +1038,7 @@ class BinaryPackagePublisher:
2914 BinaryPackagePublishingHistory(
2915 binarypackagerelease=binarypackage.id,
2916 binarypackagename=binarypackage.binarypackagename,
2917- _binarypackageformat=binarypackage.binpackageformat,
2918+ binarypackageformat=binarypackage.binpackageformat,
2919 component=component.id,
2920 section=section.id,
2921 priority=priority,
2922@@ -1047,10 +1047,6 @@ class BinaryPackagePublisher:
2923 datecreated=UTC_NOW,
2924 datepublished=UTC_NOW,
2925 pocket=self.pocket,
2926- datesuperseded=None,
2927- supersededby=None,
2928- datemadepending=None,
2929- dateremoved=None,
2930 archive=archive,
2931 sourcepackagename=binarypackage.build.source_package_name,
2932 )
2933diff --git a/lib/lp/soyuz/scripts/packagecopier.py b/lib/lp/soyuz/scripts/packagecopier.py
2934index 2e1557d..a09270a 100644
2935--- a/lib/lp/soyuz/scripts/packagecopier.py
2936+++ b/lib/lp/soyuz/scripts/packagecopier.py
2937@@ -163,12 +163,14 @@ def check_copy_permissions(
2938
2939 if len(sources) > 1:
2940 # Bulk-load the data we'll need from each source publication.
2941- load_related(SourcePackageRelease, sources, ["sourcepackagereleaseID"])
2942+ load_related(
2943+ SourcePackageRelease, sources, ["sourcepackagerelease_id"]
2944+ )
2945 if move:
2946 # Bulk-load at least some of the data we'll need for permission
2947 # checks on each source archive. Not all of this is currently
2948 # preloadable.
2949- archives = load_related(Archive, sources, ["archiveID"])
2950+ archives = load_related(Archive, sources, ["archive_id"])
2951 load_related(Person, archives, ["ownerID"])
2952
2953 # If there is a requester, check that they have upload permission into
2954diff --git a/lib/lp/soyuz/scripts/tests/test_copypackage.py b/lib/lp/soyuz/scripts/tests/test_copypackage.py
2955index b2bb41c..5e867fa 100644
2956--- a/lib/lp/soyuz/scripts/tests/test_copypackage.py
2957+++ b/lib/lp/soyuz/scripts/tests/test_copypackage.py
2958@@ -1434,7 +1434,7 @@ class TestDoDirectCopy(BaseDoCopyTests, TestCaseWithFactory):
2959 archive=target_archive,
2960 binarypackagename=bin_i386.binarypackagename,
2961 binarypackagerelease=bin_i386.binarypackagerelease,
2962- _binarypackageformat=bin_i386.binarypackageformat,
2963+ binarypackageformat=bin_i386.binarypackageformat,
2964 distroarchseries=nobby["i386"],
2965 pocket=bin_i386.pocket,
2966 component=bin_i386.component,
2967diff --git a/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py b/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py
2968index 7151a9d..54e193c 100644
2969--- a/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py
2970+++ b/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py
2971@@ -119,7 +119,7 @@ class TestObsoleteDistroseries(TestCaseWithFactory):
2972 SourcePackagePublishingHistory.distroseries == distroseries,
2973 SourcePackagePublishingHistory.status
2974 == PackagePublishingStatus.PUBLISHED,
2975- SourcePackagePublishingHistory.archiveID.is_in(
2976+ SourcePackagePublishingHistory.archive_id.is_in(
2977 self.main_archive_ids
2978 ),
2979 )
2980@@ -130,7 +130,7 @@ class TestObsoleteDistroseries(TestCaseWithFactory):
2981 DistroArchSeries.distroseries == distroseries,
2982 BinaryPackagePublishingHistory.status
2983 == PackagePublishingStatus.PUBLISHED,
2984- BinaryPackagePublishingHistory.archiveID.is_in(
2985+ BinaryPackagePublishingHistory.archive_id.is_in(
2986 self.main_archive_ids
2987 ),
2988 )
2989diff --git a/lib/lp/soyuz/tests/test_hasbuildrecords.py b/lib/lp/soyuz/tests/test_hasbuildrecords.py
2990index b0b8e8c..948089d 100644
2991--- a/lib/lp/soyuz/tests/test_hasbuildrecords.py
2992+++ b/lib/lp/soyuz/tests/test_hasbuildrecords.py
2993@@ -274,7 +274,7 @@ class TestSourcePackageHasBuildRecords(TestHasBuildRecordsInterface):
2994 removeSecurityProxy(spr).sourcepackagename = gedit_name
2995 IStore(SourcePackagePublishingHistory).find(
2996 SourcePackagePublishingHistory, sourcepackagerelease=spr
2997- ).set(sourcepackagenameID=gedit_name.id)
2998+ ).set(sourcepackagename_id=gedit_name.id)
2999
3000 # Set them as successfully built
3001 for build in self.builds:
3002diff --git a/lib/lp/soyuz/tests/test_publishing.py b/lib/lp/soyuz/tests/test_publishing.py
3003index e9cede9..c3c5d9e 100644
3004--- a/lib/lp/soyuz/tests/test_publishing.py
3005+++ b/lib/lp/soyuz/tests/test_publishing.py
3006@@ -43,6 +43,7 @@ from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
3007 from lp.services.channels import channel_string_to_list
3008 from lp.services.config import config
3009 from lp.services.database.constants import UTC_NOW
3010+from lp.services.database.interfaces import IStore
3011 from lp.services.librarian.interfaces import ILibraryFileAliasSet
3012 from lp.services.log.logger import BufferLogger, DevNullLogger
3013 from lp.soyuz.enums import (
3014@@ -340,7 +341,7 @@ class SoyuzTestPublisher:
3015 distroseries=distroseries,
3016 sourcepackagerelease=spr,
3017 sourcepackagename=spr.sourcepackagename,
3018- _format=spr.format,
3019+ format=spr.format,
3020 component=spr.component,
3021 section=spr.section,
3022 status=status,
3023@@ -351,7 +352,7 @@ class SoyuzTestPublisher:
3024 pocket=pocket,
3025 archive=archive,
3026 creator=creator,
3027- _channel=channel,
3028+ channel=channel,
3029 )
3030
3031 return spph
3032@@ -642,7 +643,7 @@ class SoyuzTestPublisher:
3033 distroarchseries=arch,
3034 binarypackagerelease=binarypackagerelease,
3035 binarypackagename=binarypackagerelease.binarypackagename,
3036- _binarypackageformat=binarypackagerelease.binpackageformat,
3037+ binarypackageformat=binarypackagerelease.binpackageformat,
3038 component=binarypackagerelease.component,
3039 section=binarypackagerelease.section,
3040 priority=binarypackagerelease.priority,
3041@@ -653,7 +654,7 @@ class SoyuzTestPublisher:
3042 pocket=pocket,
3043 archive=archive,
3044 phased_update_percentage=phased_update_percentage,
3045- _channel=channel,
3046+ channel=channel,
3047 sourcepackagename=(
3048 binarypackagerelease.build.source_package_name
3049 ),
3050@@ -1010,7 +1011,7 @@ class TestNativePublishing(TestNativePublishingBase):
3051 self.layer.commit()
3052
3053 foo_name = "%s/main/f/foo/foo_666.dsc" % self.pool_dir
3054- pub_source.sync()
3055+ IStore(pub_source).flush()
3056 self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
3057 with open(foo_name) as foo:
3058 self.assertEqual(foo.read().strip(), "foo is happy")
3059@@ -1022,7 +1023,7 @@ class TestNativePublishing(TestNativePublishingBase):
3060 pub_source2.publish(self.disk_pool, self.logger)
3061 self.layer.commit()
3062
3063- pub_source2.sync()
3064+ IStore(pub_source2).flush()
3065 self.assertEqual(pub_source2.status, PackagePublishingStatus.PENDING)
3066 with open(foo_name) as foo:
3067 self.assertEqual(foo.read().strip(), "foo is happy")
3068@@ -1041,7 +1042,7 @@ class TestNativePublishing(TestNativePublishingBase):
3069 bar_name = "%s/main/b/bar/bar_666.dsc" % self.pool_dir
3070 with open(bar_name) as bar:
3071 self.assertEqual(bar.read().strip(), "bar is good")
3072- pub_source.sync()
3073+ IStore(pub_source).flush()
3074 self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
3075
3076 pub_source2 = self.getPubSource(
3077@@ -1049,7 +1050,7 @@ class TestNativePublishing(TestNativePublishingBase):
3078 )
3079 pub_source2.publish(self.disk_pool, self.logger)
3080 self.layer.commit()
3081- pub_source2.sync()
3082+ IStore(pub_source2).flush()
3083 self.assertEqual(pub_source2.status, PackagePublishingStatus.PUBLISHED)
3084
3085 def testPublishingSymlink(self):
3086@@ -1068,8 +1069,8 @@ class TestNativePublishing(TestNativePublishingBase):
3087 pub_source2.publish(self.disk_pool, self.logger)
3088 self.layer.commit()
3089
3090- pub_source.sync()
3091- pub_source2.sync()
3092+ IStore(pub_source).flush()
3093+ IStore(pub_source2).flush()
3094 self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
3095 self.assertEqual(pub_source2.status, PackagePublishingStatus.PUBLISHED)
3096
3097@@ -1089,7 +1090,7 @@ class TestNativePublishing(TestNativePublishingBase):
3098 pub_source3.publish(self.disk_pool, self.logger)
3099 self.layer.commit()
3100
3101- pub_source3.sync()
3102+ IStore(pub_source3).flush()
3103 self.assertEqual(pub_source3.status, PackagePublishingStatus.PENDING)
3104
3105 def testPublishInAnotherArchive(self):
3106@@ -1113,7 +1114,7 @@ class TestNativePublishing(TestNativePublishingBase):
3107 pub_source.publish(test_disk_pool, self.logger)
3108 self.layer.commit()
3109
3110- pub_source.sync()
3111+ IStore(pub_source).flush()
3112 self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
3113 self.assertEqual(
3114 pub_source.sourcepackagerelease.upload_archive, cprov.archive
3115diff --git a/lib/lp/translations/model/vpoexport.py b/lib/lp/translations/model/vpoexport.py
3116index 33111ff..bca71df 100644
3117--- a/lib/lp/translations/model/vpoexport.py
3118+++ b/lib/lp/translations/model/vpoexport.py
3119@@ -59,7 +59,7 @@ class VPOExportSet:
3120 SourcePackagePublishingHistory.distroseries == series,
3121 SourcePackagePublishingHistory.component == Component.id,
3122 POTemplate.sourcepackagename
3123- == SourcePackagePublishingHistory.sourcepackagenameID,
3124+ == SourcePackagePublishingHistory.sourcepackagename_id,
3125 Component.name == component,
3126 SourcePackagePublishingHistory.dateremoved == None,
3127 SourcePackagePublishingHistory.archive
3128diff --git a/lib/lp/translations/scripts/copy_distroseries_translations.py b/lib/lp/translations/scripts/copy_distroseries_translations.py
3129index 81a66eb..78e6526 100644
3130--- a/lib/lp/translations/scripts/copy_distroseries_translations.py
3131+++ b/lib/lp/translations/scripts/copy_distroseries_translations.py
3132@@ -131,8 +131,8 @@ def copy_distroseries_translations(
3133 status=active_publishing_status,
3134 )
3135 .config(distinct=True)
3136- .order_by(SourcePackagePublishingHistory.sourcepackagenameID)
3137- .values(SourcePackagePublishingHistory.sourcepackagenameID),
3138+ .order_by(SourcePackagePublishingHistory.sourcepackagename_id)
3139+ .values(SourcePackagePublishingHistory.sourcepackagename_id),
3140 )
3141 else:
3142 spns = None

Subscribers

People subscribed via source and target branches

to status/vote changes: