launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #30196
[Merge] ~cjwatson/launchpad:stormify-publishinghistory into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:stormify-publishinghistory into launchpad:master.
Commit message:
Convert {Source,Binary}PackagePublishingHistory to Storm
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/446200
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:stormify-publishinghistory into launchpad:master.
diff --git a/lib/lp/archivepublisher/deathrow.py b/lib/lp/archivepublisher/deathrow.py
index cca0368..38a0ca4 100644
--- a/lib/lp/archivepublisher/deathrow.py
+++ b/lib/lp/archivepublisher/deathrow.py
@@ -115,9 +115,9 @@ class DeathRow:
1,
tables=[OtherSPPH],
where=And(
- SourcePackagePublishingHistory.sourcepackagereleaseID
- == OtherSPPH.sourcepackagereleaseID,
- OtherSPPH.archiveID == self.archive.id,
+ SourcePackagePublishingHistory.sourcepackagerelease_id
+ == OtherSPPH.sourcepackagerelease_id,
+ OtherSPPH.archive_id == self.archive.id,
Not(OtherSPPH.status.is_in(inactive_publishing_status)),
),
)
@@ -139,9 +139,9 @@ class DeathRow:
1,
tables=[OtherBPPH],
where=And(
- BinaryPackagePublishingHistory.binarypackagereleaseID
- == OtherBPPH.binarypackagereleaseID,
- OtherBPPH.archiveID == self.archive.id,
+ BinaryPackagePublishingHistory.binarypackagerelease_id
+ == OtherBPPH.binarypackagerelease_id,
+ OtherBPPH.archive_id == self.archive.id,
Not(OtherBPPH.status.is_in(inactive_publishing_status)),
),
)
diff --git a/lib/lp/archivepublisher/domination.py b/lib/lp/archivepublisher/domination.py
index 466d1ba..a8df607 100644
--- a/lib/lp/archivepublisher/domination.py
+++ b/lib/lp/archivepublisher/domination.py
@@ -101,7 +101,7 @@ def join_spph_spn():
SPPH = SourcePackagePublishingHistory
SPN = SourcePackageName
- return SPN.id == SPPH.sourcepackagenameID
+ return SPN.id == SPPH.sourcepackagename_id
def join_spph_spr():
@@ -109,7 +109,7 @@ def join_spph_spr():
SPPH = SourcePackagePublishingHistory
SPR = SourcePackageRelease
- return SPR.id == SPPH.sourcepackagereleaseID
+ return SPR.id == SPPH.sourcepackagerelease_id
class SourcePublicationTraits:
@@ -119,9 +119,6 @@ class SourcePublicationTraits:
`BinaryPackagePublishingHistory`.
"""
- release_class = SourcePackageRelease
- release_reference_name = "sourcepackagereleaseID"
-
@staticmethod
def getPackageName(spph):
"""Return the name of this publication's source package."""
@@ -140,9 +137,6 @@ class BinaryPublicationTraits:
`SourcePackagePublishingHistory`.
"""
- release_class = BinaryPackageRelease
- release_reference_name = "binarypackagereleaseID"
-
@staticmethod
def getPackageName(bpph):
"""Return the name of this publication's binary package."""
@@ -654,13 +648,13 @@ class Dominator:
BPPH.pocket == pocket,
]
candidate_binary_names = Select(
- BPPH.binarypackagenameID,
+ BPPH.binarypackagename_id,
And(*bpph_location_clauses),
- group_by=(BPPH.binarypackagenameID, BPPH._channel),
+ group_by=(BPPH.binarypackagename_id, BPPH._channel),
having=(Count() > 1),
)
main_clauses = bpph_location_clauses + [
- BPR.id == BPPH.binarypackagereleaseID,
+ BPR.id == BPPH.binarypackagerelease_id,
BPR.binarypackagenameID.is_in(candidate_binary_names),
BPR.binpackageformat != BinaryPackageFormat.DDEB,
]
@@ -672,7 +666,7 @@ class Dominator:
# the join would complicate the query.
query = IStore(BPPH).find((BPPH, BPR), *main_clauses)
bpphs = list(DecoratedResultSet(query, itemgetter(0)))
- load_related(BinaryPackageName, bpphs, ["binarypackagenameID"])
+ load_related(BinaryPackageName, bpphs, ["binarypackagename_id"])
return bpphs
def dominateBinaries(self, distroseries, pocket):
@@ -814,9 +808,9 @@ class Dominator:
distroseries, pocket
)
candidate_source_names = Select(
- SPPH.sourcepackagenameID,
+ SPPH.sourcepackagename_id,
And(join_spph_spr(), spph_location_clauses),
- group_by=(SPPH.sourcepackagenameID, SPPH._channel),
+ group_by=(SPPH.sourcepackagename_id, SPPH._channel),
having=(Count() > 1),
)
@@ -829,11 +823,11 @@ class Dominator:
query = IStore(SPPH).find(
(SPPH, SPR),
join_spph_spr(),
- SPPH.sourcepackagenameID.is_in(candidate_source_names),
+ SPPH.sourcepackagename_id.is_in(candidate_source_names),
spph_location_clauses,
)
spphs = DecoratedResultSet(query, itemgetter(0))
- load_related(SourcePackageName, spphs, ["sourcepackagenameID"])
+ load_related(SourcePackageName, spphs, ["sourcepackagename_id"])
return spphs
def dominateSources(self, distroseries, pocket):
diff --git a/lib/lp/archivepublisher/model/ftparchive.py b/lib/lp/archivepublisher/model/ftparchive.py
index ba801ae..3492a7a 100644
--- a/lib/lp/archivepublisher/model/ftparchive.py
+++ b/lib/lp/archivepublisher/model/ftparchive.py
@@ -306,7 +306,7 @@ class FTPArchiveHandler:
Join(
SourcePackageRelease,
SourcePackageRelease.id
- == SourcePackagePublishingHistory.sourcepackagereleaseID,
+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
),
Join(
SourcePackageName,
@@ -356,7 +356,7 @@ class FTPArchiveHandler:
Join(
BinaryPackageRelease,
BinaryPackageRelease.id
- == BinaryPackagePublishingHistory.binarypackagereleaseID,
+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
),
Join(
BinaryPackageName,
@@ -366,7 +366,7 @@ class FTPArchiveHandler:
Join(
DistroArchSeries,
DistroArchSeries.id
- == BinaryPackagePublishingHistory.distroarchseriesID,
+ == BinaryPackagePublishingHistory.distroarchseries_id,
),
)
@@ -376,7 +376,7 @@ class FTPArchiveHandler:
conditions = [
BinaryPackagePublishingHistory.archive == self.publisher.archive,
- BinaryPackagePublishingHistory.distroarchseriesID.is_in(
+ BinaryPackagePublishingHistory.distroarchseries_id.is_in(
architectures_ids
),
BinaryPackagePublishingHistory.pocket == pocket,
@@ -672,15 +672,15 @@ class FTPArchiveHandler:
)
join_conditions = [
SourcePackageReleaseFile.sourcepackagerelease_id
- == SourcePackagePublishingHistory.sourcepackagereleaseID,
+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
SourcePackageName.id
- == SourcePackagePublishingHistory.sourcepackagenameID,
+ == SourcePackagePublishingHistory.sourcepackagename_id,
LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
Component.id == SourcePackagePublishingHistory.component_id,
]
select_conditions = [
SourcePackagePublishingHistory.archive == self.publisher.archive,
- SourcePackagePublishingHistory.distroseriesID == distroseries.id,
+ SourcePackagePublishingHistory.distroseries_id == distroseries.id,
SourcePackagePublishingHistory.pocket == pocket,
SourcePackagePublishingHistory.status
== PackagePublishingStatus.PUBLISHED,
@@ -712,14 +712,14 @@ class FTPArchiveHandler:
)
join_conditions = [
BinaryPackageRelease.id
- == BinaryPackagePublishingHistory.binarypackagereleaseID,
+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
BinaryPackageFile.binarypackagerelease_id
- == BinaryPackagePublishingHistory.binarypackagereleaseID,
+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
BinaryPackageBuild.id == BinaryPackageRelease.buildID,
SourcePackageName.id == BinaryPackageBuild.source_package_name_id,
LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
DistroArchSeries.id
- == BinaryPackagePublishingHistory.distroarchseriesID,
+ == BinaryPackagePublishingHistory.distroarchseries_id,
Component.id == BinaryPackagePublishingHistory.component_id,
]
select_conditions = [
diff --git a/lib/lp/archivepublisher/publishing.py b/lib/lp/archivepublisher/publishing.py
index 8eee4ed..30fee6a 100644
--- a/lib/lp/archivepublisher/publishing.py
+++ b/lib/lp/archivepublisher/publishing.py
@@ -522,7 +522,7 @@ class Publisher:
SourcePackagePublishingHistory, *clauses
)
return publications.order_by(
- SourcePackagePublishingHistory.distroseriesID,
+ SourcePackagePublishingHistory.distroseries_id,
SourcePackagePublishingHistory.pocket,
Desc(SourcePackagePublishingHistory.id),
)
@@ -571,7 +571,7 @@ class Publisher:
"""Return the specific group of binary records to be published."""
clauses = [
BinaryPackagePublishingHistory.archive == self.archive,
- BinaryPackagePublishingHistory.distroarchseriesID
+ BinaryPackagePublishingHistory.distroarchseries_id
== DistroArchSeries.id,
BinaryPackagePublishingHistory.status.is_in(
active_publishing_status
@@ -678,7 +678,7 @@ class Publisher:
# Make the source publications query.
conditions = base_conditions(SourcePackagePublishingHistory)
conditions.append(
- SourcePackagePublishingHistory.distroseriesID == DistroSeries.id
+ SourcePackagePublishingHistory.distroseries_id == DistroSeries.id
)
source_suites = (
IStore(SourcePackagePublishingHistory)
@@ -694,7 +694,7 @@ class Publisher:
conditions = base_conditions(BinaryPackagePublishingHistory)
conditions.extend(
[
- BinaryPackagePublishingHistory.distroarchseriesID
+ BinaryPackagePublishingHistory.distroarchseries_id
== DistroArchSeries.id,
DistroArchSeries.distroseriesID == DistroSeries.id,
]
@@ -794,15 +794,15 @@ class Publisher:
for spph in publishing_set.getSourcesForPublishing(
archive=self.archive
):
- spphs_by_spr[spph.sourcepackagereleaseID].append(spph)
- release_id = "source:%d" % spph.sourcepackagereleaseID
+ spphs_by_spr[spph.sourcepackagerelease_id].append(spph)
+ release_id = "source:%d" % spph.sourcepackagerelease_id
releases_by_id.setdefault(release_id, spph.sourcepackagerelease)
pubs_by_id[release_id].append(spph)
for bpph in publishing_set.getBinariesForPublishing(
archive=self.archive
):
- bpphs_by_bpr[bpph.binarypackagereleaseID].append(bpph)
- release_id = "binary:%d" % bpph.binarypackagereleaseID
+ bpphs_by_bpr[bpph.binarypackagerelease_id].append(bpph)
+ release_id = "binary:%d" % bpph.binarypackagerelease_id
releases_by_id.setdefault(release_id, bpph.binarypackagerelease)
pubs_by_id[release_id].append(bpph)
artifacts = self._diskpool.getAllArtifacts(
diff --git a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
index 2054e6e..b62e3b1 100644
--- a/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
+++ b/lib/lp/archivepublisher/scripts/publish_ftpmaster.py
@@ -290,7 +290,7 @@ class PublishFTPMaster(LaunchpadCronScript):
archive.getAllPublishedBinaries(only_unpublished=True)
)
load_related(
- DistroArchSeries, pending_binaries, ["distroarchseriesID"]
+ DistroArchSeries, pending_binaries, ["distroarchseries_id"]
)
return {
pub.distroseries.name + pocketsuffix[pub.pocket]
diff --git a/lib/lp/archivepublisher/tests/test_publisher.py b/lib/lp/archivepublisher/tests/test_publisher.py
index ab3fd82..be57298 100644
--- a/lib/lp/archivepublisher/tests/test_publisher.py
+++ b/lib/lp/archivepublisher/tests/test_publisher.py
@@ -71,6 +71,7 @@ from lp.registry.interfaces.pocket import PackagePublishingPocket, pocketsuffix
from lp.registry.interfaces.series import SeriesStatus
from lp.services.config import config
from lp.services.database.constants import UTC_NOW
+from lp.services.database.interfaces import IStore
from lp.services.database.sqlbase import flush_database_caches
from lp.services.gpg.interfaces import IGPGHandler
from lp.services.log.logger import BufferLogger, DevNullLogger
@@ -302,8 +303,8 @@ class TestPublisherSeries(TestNativePublishingBase):
self._publish(pocket=pocket)
# source and binary PUBLISHED in database.
- pub_source.sync()
- pub_bin.sync()
+ IStore(pub_source).flush()
+ IStore(pub_bin).flush()
self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
self.assertEqual(pub_bin.status, PackagePublishingStatus.PUBLISHED)
@@ -847,7 +848,7 @@ class TestPublisher(TestPublisherBase):
publisher.A_publish(False)
self.layer.txn.commit()
- pub_source.sync()
+ IStore(pub_source).flush()
self.assertEqual({"breezy-autotest"}, publisher.dirty_suites)
self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status)
@@ -1122,8 +1123,8 @@ class TestPublisher(TestPublisherBase):
publisher.A_publish(force_publishing=False)
self.layer.txn.commit()
- pub_source.sync()
- pub_source2.sync()
+ IStore(pub_source).flush()
+ IStore(pub_source2).flush()
self.assertEqual({"hoary-test"}, publisher.dirty_suites)
self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source2.status)
self.assertEqual(PackagePublishingStatus.PENDING, pub_source.status)
@@ -1156,8 +1157,8 @@ class TestPublisher(TestPublisherBase):
publisher.A_publish(force_publishing=False)
self.layer.txn.commit()
- pub_source.sync()
- pub_source2.sync()
+ IStore(pub_source).flush()
+ IStore(pub_source2).flush()
self.assertEqual({"breezy-autotest-updates"}, publisher.dirty_suites)
self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status)
self.assertEqual(PackagePublishingStatus.PENDING, pub_source2.status)
@@ -1284,7 +1285,7 @@ class TestPublisher(TestPublisherBase):
publisher.A_publish(False)
self.layer.txn.commit()
- pub_source.sync()
+ IStore(pub_source).flush()
self.assertEqual({"breezy-autotest"}, publisher.dirty_suites)
self.assertEqual(PackagePublishingStatus.PUBLISHED, pub_source.status)
@@ -4326,7 +4327,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
"deb.name": ["hello"],
"deb.version": ["1.0"],
"launchpad.release-id": [
- "source:%d" % source.sourcepackagereleaseID
+ "source:%d" % source.sourcepackagerelease_id
],
"launchpad.source-name": ["hello"],
"launchpad.source-version": ["1.0"],
@@ -4347,7 +4348,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
"deb.component": ["main"],
"deb.distribution": ["breezy-autotest"],
"launchpad.release-id": [
- "binary:%d" % binary.binarypackagereleaseID
+ "binary:%d" % binary.binarypackagerelease_id
],
"launchpad.source-name": ["hello"],
"launchpad.source-version": ["1.0"],
@@ -4429,7 +4430,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
"deb.name": ["hello"],
"deb.version": ["1.0"],
"launchpad.release-id": [
- "source:%d" % source.sourcepackagereleaseID
+ "source:%d" % source.sourcepackagerelease_id
],
"launchpad.source-name": ["hello"],
"launchpad.source-version": ["1.0"],
@@ -4445,7 +4446,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
"deb.name": ["hello"],
"deb.version": ["1.0"],
"launchpad.release-id": [
- "source:%d" % source.sourcepackagereleaseID
+ "source:%d" % source.sourcepackagerelease_id
],
"launchpad.source-name": ["hello"],
"launchpad.source-version": ["1.0"],
@@ -4460,7 +4461,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
"deb.component": ["main"],
"deb.distribution": ["breezy-autotest", "hoary-test"],
"launchpad.release-id": [
- "binary:%d" % binary.binarypackagereleaseID
+ "binary:%d" % binary.binarypackagerelease_id
],
"launchpad.source-name": ["hello"],
"launchpad.source-version": ["1.0"],
@@ -4538,7 +4539,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
"deb.name": ["hello"],
"deb.version": ["1.0-2"],
"launchpad.release-id": [
- "source:%d" % spph.sourcepackagereleaseID
+ "source:%d" % spph.sourcepackagerelease_id
],
"launchpad.source-name": ["hello"],
"launchpad.source-version": ["1.0-2"],
@@ -4600,7 +4601,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
"deb.name": ["hello"],
"deb.version": ["1.0"],
"launchpad.release-id": [
- "source:%d" % source.sourcepackagereleaseID
+ "source:%d" % source.sourcepackagerelease_id
],
"launchpad.source-name": ["hello"],
"launchpad.source-version": ["1.0"],
@@ -4612,7 +4613,7 @@ class TestArtifactoryPublishing(TestPublisherBase):
self.assertEqual(
{
"launchpad.release-id": [
- "binary:%d" % binary.binarypackagereleaseID
+ "binary:%d" % binary.binarypackagerelease_id
],
"launchpad.source-name": ["hello"],
"launchpad.source-version": ["1.0"],
diff --git a/lib/lp/bugs/model/bugtasksearch.py b/lib/lp/bugs/model/bugtasksearch.py
index 19598bc..9ec4c25 100644
--- a/lib/lp/bugs/model/bugtasksearch.py
+++ b/lib/lp/bugs/model/bugtasksearch.py
@@ -649,10 +649,10 @@ def _build_query(params):
extra_clauses.append(
BugTaskFlat.sourcepackagename_id.is_in(
Select(
- SourcePackagePublishingHistory.sourcepackagenameID,
+ SourcePackagePublishingHistory.sourcepackagename_id,
tables=[SourcePackagePublishingHistory],
where=And(
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
archive_ids
),
SourcePackagePublishingHistory.distroseries
diff --git a/lib/lp/registry/browser/distributionsourcepackage.py b/lib/lp/registry/browser/distributionsourcepackage.py
index 78c31de..5590db8 100644
--- a/lib/lp/registry/browser/distributionsourcepackage.py
+++ b/lib/lp/registry/browser/distributionsourcepackage.py
@@ -641,7 +641,7 @@ class PublishingHistoryViewMixin:
def _preload_people(self, pubs):
ids = set()
for spph in pubs:
- ids.update((spph.removed_byID, spph.creatorID, spph.sponsorID))
+ ids.update((spph.removed_by_id, spph.creator_id, spph.sponsor_id))
ids.discard(None)
if ids:
list(
diff --git a/lib/lp/registry/model/distribution.py b/lib/lp/registry/model/distribution.py
index 045fb98..cf764f9 100644
--- a/lib/lp/registry/model/distribution.py
+++ b/lib/lp/registry/model/distribution.py
@@ -1622,7 +1622,7 @@ class Distribution(
origin.append(
Join(
SourcePackagePublishingHistory,
- SourcePackagePublishingHistory.sourcepackagenameID
+ SourcePackagePublishingHistory.sourcepackagename_id
== DistributionSourcePackageCache.sourcepackagename_id,
)
)
@@ -1630,7 +1630,7 @@ class Distribution(
[
SourcePackagePublishingHistory.distroseries
== publishing_distroseries,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.all_distro_archive_ids
),
]
@@ -1764,7 +1764,7 @@ class Distribution(
# archive data. (There are many, many PPAs to consider
# and PostgreSQL picks a bad query plan resulting in
# timeouts).
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.all_distro_archive_ids
),
SourcePackagePublishingHistory.sourcepackagename
@@ -1804,7 +1804,7 @@ class Distribution(
# See comment above for rationale for using an extra query
# instead of an inner join. (Bottom line, it would time out
# otherwise.)
- BinaryPackagePublishingHistory.archiveID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(
self.all_distro_archive_ids
),
BinaryPackagePublishingHistory.binarypackagename
@@ -2163,7 +2163,7 @@ class Distribution(
Store.of(self)
.find(
SourcePackagePublishingHistory,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.all_distro_archive_ids
),
)
@@ -2456,7 +2456,10 @@ class DistributionSet:
distro_source_packagenames,
lambda distro: distro.all_distro_archive_ids,
lambda distro: DistroSeries.distribution == distro,
- [SourcePackagePublishingHistory.distroseriesID == DistroSeries.id],
+ [
+ SourcePackagePublishingHistory.distroseries_id
+ == DistroSeries.id
+ ],
DistroSeries.distributionID,
)
result = {}
diff --git a/lib/lp/registry/model/distributionmirror.py b/lib/lp/registry/model/distributionmirror.py
index 7e5ec72..a672691 100644
--- a/lib/lp/registry/model/distributionmirror.py
+++ b/lib/lp/registry/model/distributionmirror.py
@@ -981,7 +981,7 @@ class MirrorDistroArchSeries(StormBase, _MirrorSeriesMixIn):
if deb_only:
clauses.extend(
[
- BinaryPackagePublishingHistory.binarypackagereleaseID
+ BinaryPackagePublishingHistory.binarypackagerelease_id
== BinaryPackageFile.binarypackagerelease_id,
BinaryPackageFile.filetype == BinaryPackageFileType.DEB,
]
diff --git a/lib/lp/registry/model/distributionsourcepackage.py b/lib/lp/registry/model/distributionsourcepackage.py
index 5235ff7..42a452d 100644
--- a/lib/lp/registry/model/distributionsourcepackage.py
+++ b/lib/lp/registry/model/distributionsourcepackage.py
@@ -210,7 +210,7 @@ class DistributionSourcePackage(
DistroSeries.distribution == self.distribution,
SourcePackagePublishingHistory.sourcepackagename
== self.sourcepackagename,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
Not(
@@ -245,7 +245,7 @@ class DistributionSourcePackage(
SourcePackageRelease,
SourcePackagePublishingHistory.distroseries == DistroSeries.id,
DistroSeries.distribution == self.distribution,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
SourcePackagePublishingHistory.sourcepackagerelease
@@ -384,15 +384,15 @@ class DistributionSourcePackage(
def _getPublishingHistoryQuery(self, status=None):
conditions = [
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
- SourcePackagePublishingHistory.distroseriesID == DistroSeries.id,
+ SourcePackagePublishingHistory.distroseries_id == DistroSeries.id,
DistroSeries.distribution == self.distribution,
SourcePackagePublishingHistory.sourcepackagename
== self.sourcepackagename,
SourcePackageRelease.id
- == SourcePackagePublishingHistory.sourcepackagereleaseID,
+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
]
if status is not None:
@@ -412,7 +412,7 @@ class DistributionSourcePackage(
pub_constraints = (
DistroSeries.distribution == self.distribution,
SourcePackagePublishingHistory.distroseries == DistroSeries.id,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
SourcePackagePublishingHistory.sourcepackagename
@@ -423,11 +423,11 @@ class DistributionSourcePackage(
spr_ids = (
Store.of(self.distribution)
.find(
- SourcePackagePublishingHistory.sourcepackagereleaseID,
+ SourcePackagePublishingHistory.sourcepackagerelease_id,
*pub_constraints,
)
.order_by(
- Desc(SourcePackagePublishingHistory.sourcepackagereleaseID)
+ Desc(SourcePackagePublishingHistory.sourcepackagerelease_id)
)
.config(distinct=True)
)
@@ -442,7 +442,7 @@ class DistributionSourcePackage(
sprs_by_id = {
spr: list(pubs)
for (spr, pubs) in itertools.groupby(
- pubs, attrgetter("sourcepackagereleaseID")
+ pubs, attrgetter("sourcepackagerelease_id")
)
}
return [
diff --git a/lib/lp/registry/model/distroseries.py b/lib/lp/registry/model/distroseries.py
index 68b7275..a585613 100644
--- a/lib/lp/registry/model/distroseries.py
+++ b/lib/lp/registry/model/distroseries.py
@@ -784,9 +784,9 @@ class DistroSeries(
self.sourcecount = (
IStore(SourcePackagePublishingHistory)
.find(
- SourcePackagePublishingHistory.sourcepackagenameID,
+ SourcePackagePublishingHistory.sourcepackagename_id,
SourcePackagePublishingHistory.distroseries == self,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
SourcePackagePublishingHistory.status.is_in(
@@ -802,11 +802,11 @@ class DistroSeries(
self.binarycount = (
IStore(BinaryPackagePublishingHistory)
.find(
- BinaryPackagePublishingHistory.binarypackagenameID,
+ BinaryPackagePublishingHistory.binarypackagename_id,
DistroArchSeries.distroseries == self,
- BinaryPackagePublishingHistory.distroarchseriesID
+ BinaryPackagePublishingHistory.distroarchseries_id
== DistroArchSeries.id,
- BinaryPackagePublishingHistory.archiveID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
BinaryPackagePublishingHistory.status.is_in(
@@ -1121,8 +1121,8 @@ class DistroSeries(
IStore(SourcePackagePublishingHistory)
.find(
SourcePackagePublishingHistory,
- SourcePackagePublishingHistory.distroseriesID == self.id,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.distroseries_id == self.id,
+ SourcePackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
)
@@ -1136,9 +1136,9 @@ class DistroSeries(
.find(
BinaryPackagePublishingHistory,
DistroArchSeries.distroseriesID == self.id,
- BinaryPackagePublishingHistory.distroarchseriesID
+ BinaryPackagePublishingHistory.distroarchseries_id
== DistroArchSeries.id,
- BinaryPackagePublishingHistory.archiveID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
)
@@ -1812,7 +1812,7 @@ class DistroSeriesSet:
== series
),
[],
- SourcePackagePublishingHistory.distroseriesID,
+ SourcePackagePublishingHistory.distroseries_id,
)
result = {}
for spr, series_id in releases:
diff --git a/lib/lp/registry/model/distroseriesdifference.py b/lib/lp/registry/model/distroseriesdifference.py
index 64c3a0b..030e521 100644
--- a/lib/lp/registry/model/distroseriesdifference.py
+++ b/lib/lp/registry/model/distroseriesdifference.py
@@ -104,10 +104,10 @@ def most_recent_publications(dsds, in_parent, statuses, match_version=False):
)
conditions = And(
DistroSeriesDifference.id.is_in(dsd.id for dsd in dsds),
- SourcePackagePublishingHistory.archiveID == archive_subselect,
- SourcePackagePublishingHistory.distroseriesID == series_col,
+ SourcePackagePublishingHistory.archive_id == archive_subselect,
+ SourcePackagePublishingHistory.distroseries_id == series_col,
SourcePackagePublishingHistory.status.is_in(statuses),
- SourcePackagePublishingHistory.sourcepackagenameID
+ SourcePackagePublishingHistory.sourcepackagename_id
== (DistroSeriesDifference.source_package_name_id),
)
# Do we match on DistroSeriesDifference.(parent_)source_version?
@@ -115,7 +115,7 @@ def most_recent_publications(dsds, in_parent, statuses, match_version=False):
conditions = And(
conditions,
SourcePackageRelease.id
- == SourcePackagePublishingHistory.sourcepackagereleaseID,
+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
Cast(SourcePackageRelease.version, "text") == version_col,
)
# The sort order is critical so that the DISTINCT ON clause selects the
@@ -284,7 +284,7 @@ def eager_load_dsds(dsds):
source_pubs_for_release.values(),
parent_source_pubs_for_release.values(),
),
- ("sourcepackagereleaseID",),
+ ("sourcepackagerelease_id",),
)
# Get packagesets and parent_packagesets for each DSD.
@@ -501,9 +501,9 @@ class DistroSeriesDifference(StormBase):
# the already established differences.
differences_changed_by_conditions = And(
basic_conditions,
- SPPH.archiveID == distro_series.main_archive.id,
- SPPH.distroseriesID == distro_series.id,
- SPPH.sourcepackagereleaseID == SPR.id,
+ SPPH.archive == distro_series.main_archive,
+ SPPH.distroseries == distro_series,
+ SPPH.sourcepackagerelease_id == SPR.id,
SPPH.status.is_in(active_publishing_status),
SPR.creatorID == TP.personID,
SPR.sourcepackagenameID == DSD.source_package_name_id,
diff --git a/lib/lp/registry/model/person.py b/lib/lp/registry/model/person.py
index 53e2358..d7bbb75 100644
--- a/lib/lp/registry/model/person.py
+++ b/lib/lp/registry/model/person.py
@@ -3350,17 +3350,19 @@ class Person(
)
tables = (
SourcePackageRelease,
- Join(spph, spph.sourcepackagereleaseID == SourcePackageRelease.id),
- Join(Archive, Archive.id == spph.archiveID),
- Join(ancestor_spph, ancestor_spph.id == spph.ancestorID),
+ Join(
+ spph, spph.sourcepackagerelease_id == SourcePackageRelease.id
+ ),
+ Join(Archive, Archive.id == spph.archive_id),
+ Join(ancestor_spph, ancestor_spph.id == spph.ancestor_id),
)
rs = (
Store.of(self)
.using(*tables)
.find(
spph.id,
- spph.creatorID == self.id,
- ancestor_spph.archiveID != spph.archiveID,
+ spph.creator_id == self.id,
+ ancestor_spph.archive_id != spph.archive_id,
Archive.purpose == ArchivePurpose.PRIMARY,
)
)
@@ -3383,28 +3385,28 @@ class Person(
SourcePackageRelease,
Join(
spph,
- spph.sourcepackagereleaseID
+ spph.sourcepackagerelease_id
== SourcePackageRelease.id,
),
- Join(Archive, Archive.id == spph.archiveID),
+ Join(Archive, Archive.id == spph.archive_id),
Join(
ancestor_spph,
- ancestor_spph.id == spph.ancestorID,
+ ancestor_spph.id == spph.ancestor_id,
),
],
where=And(
- spph.creatorID == self.id,
- ancestor_spph.archiveID != spph.archiveID,
+ spph.creator_id == self.id,
+ ancestor_spph.archive_id != spph.archive_id,
Archive.purpose == ArchivePurpose.PRIMARY,
),
order_by=[
- spph.distroseriesID,
+ spph.distroseries_id,
SourcePackageRelease.sourcepackagenameID,
Desc(spph.datecreated),
Desc(spph.id),
],
distinct=(
- spph.distroseriesID,
+ spph.distroseries_id,
SourcePackageRelease.sourcepackagenameID,
),
)
@@ -3418,9 +3420,9 @@ class Person(
def load_related_objects(rows):
bulk.load_related(
- SourcePackageRelease, rows, ["sourcepackagereleaseID"]
+ SourcePackageRelease, rows, ["sourcepackagerelease_id"]
)
- bulk.load_related(Archive, rows, ["archiveID"])
+ bulk.load_related(Archive, rows, ["archive_id"])
return DecoratedResultSet(rs, pre_iter_hook=load_related_objects)
diff --git a/lib/lp/registry/model/sourcepackage.py b/lib/lp/registry/model/sourcepackage.py
index 119dc09..928996c 100644
--- a/lib/lp/registry/model/sourcepackage.py
+++ b/lib/lp/registry/model/sourcepackage.py
@@ -242,7 +242,7 @@ class SourcePackage(
== self.sourcepackagename,
SourcePackagePublishingHistory.distroseries
== self.distroseries,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
]
@@ -383,13 +383,13 @@ class SourcePackage(
SourcePackageRelease,
Join(
SourcePackagePublishingHistory,
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== SourcePackageRelease.id,
),
)
.find(
SourcePackageRelease,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
SourcePackagePublishingHistory.distroseries
diff --git a/lib/lp/scripts/garbo.py b/lib/lp/scripts/garbo.py
index 86adeaa..c4dfc20 100644
--- a/lib/lp/scripts/garbo.py
+++ b/lib/lp/scripts/garbo.py
@@ -494,10 +494,11 @@ class PopulateDistributionSourcePackageCache(TunableLoop):
Join(
SourcePackageName,
SourcePackageName.id
- == SourcePackagePublishingHistory.sourcepackagenameID,
+ == SourcePackagePublishingHistory.sourcepackagename_id,
),
Join(
- Archive, Archive.id == SourcePackagePublishingHistory.archiveID
+ Archive,
+ Archive.id == SourcePackagePublishingHistory.archive_id,
),
]
rows = self.store.using(*origin).find(
@@ -624,11 +625,11 @@ class PopulateLatestPersonSourcePackageReleaseCache(TunableLoop):
Join(
spph,
And(
- spph.sourcepackagereleaseID == SourcePackageRelease.id,
- spph.archiveID == SourcePackageRelease.upload_archiveID,
+ spph.sourcepackagerelease_id == SourcePackageRelease.id,
+ spph.archive_id == SourcePackageRelease.upload_archiveID,
),
),
- Join(Archive, Archive.id == spph.archiveID),
+ Join(Archive, Archive.id == spph.archive_id),
]
rs = (
self.store.using(*origin)
@@ -2197,7 +2198,7 @@ class BinaryPackagePublishingHistorySPNPopulator(BulkPruner):
update = Returning(
BulkUpdate(
{
- BPPH.sourcepackagenameID: (
+ BPPH.sourcepackagename_id: (
SourcePackageRelease.sourcepackagenameID
)
},
diff --git a/lib/lp/services/database/doc/decoratedresultset.rst b/lib/lp/services/database/doc/decoratedresultset.rst
index 8b4b624..ee7265b 100644
--- a/lib/lp/services/database/doc/decoratedresultset.rst
+++ b/lib/lp/services/database/doc/decoratedresultset.rst
@@ -117,7 +117,7 @@ config option (https://bugs.launchpad.net/storm/+bug/217644):
>>> results = store.find(
... BinaryPackageRelease,
... BinaryPackageRelease.id
- ... == BinaryPackagePublishingHistory.binarypackagereleaseID,
+ ... == BinaryPackagePublishingHistory.binarypackagerelease_id,
... )
>>> results = results.config(distinct=True)
>>> len(list(results))
diff --git a/lib/lp/soyuz/adapters/overrides.py b/lib/lp/soyuz/adapters/overrides.py
index dfb4aaf..b71a12e 100644
--- a/lib/lp/soyuz/adapters/overrides.py
+++ b/lib/lp/soyuz/adapters/overrides.py
@@ -269,32 +269,32 @@ class FromExistingOverridePolicy(BaseOverridePolicy):
already_published = DecoratedResultSet(
store.find(
(
- SourcePackagePublishingHistory.sourcepackagenameID,
+ SourcePackagePublishingHistory.sourcepackagename_id,
SourcePackagePublishingHistory.component_id,
SourcePackagePublishingHistory.section_id,
SourcePackagePublishingHistory.status,
SourcePackageRelease.version,
),
SourcePackageRelease.id
- == SourcePackagePublishingHistory.sourcepackagereleaseID,
- SourcePackagePublishingHistory.archiveID == self.archive.id,
- SourcePackagePublishingHistory.distroseriesID
- == self.distroseries.id,
+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
+ SourcePackagePublishingHistory.archive == self.archive,
+ SourcePackagePublishingHistory.distroseries
+ == self.distroseries,
SourcePackagePublishingHistory.status.is_in(
self.getExistingPublishingStatuses(self.include_deleted)
),
- SourcePackagePublishingHistory.sourcepackagenameID.is_in(
+ SourcePackagePublishingHistory.sourcepackagename_id.is_in(
spn.id for spn in spns
),
*other_conditions,
)
.order_by(
- SourcePackagePublishingHistory.sourcepackagenameID,
+ SourcePackagePublishingHistory.sourcepackagename_id,
Desc(SourcePackagePublishingHistory.datecreated),
Desc(SourcePackagePublishingHistory.id),
)
.config(
- distinct=(SourcePackagePublishingHistory.sourcepackagenameID,)
+ distinct=(SourcePackagePublishingHistory.sourcepackagename_id,)
),
id_resolver((SourcePackageName, Component, Section, None, None)),
pre_iter_hook=eager_load,
@@ -334,16 +334,15 @@ class FromExistingOverridePolicy(BaseOverridePolicy):
archtags = set()
for bpn, archtag in binaries.keys():
candidates.append(
- BinaryPackagePublishingHistory.binarypackagenameID
+ BinaryPackagePublishingHistory.binarypackagename_id
== bpn.id
)
archtags.add(archtag)
other_conditions.extend(
[
- BinaryPackagePublishingHistory.archiveID
- == self.archive.id,
+ BinaryPackagePublishingHistory.archive == self.archive,
DistroArchSeries.distroseriesID == self.distroseries.id,
- BinaryPackagePublishingHistory.distroarchseriesID
+ BinaryPackagePublishingHistory.distroarchseries_id
== DistroArchSeries.id,
]
)
@@ -358,8 +357,8 @@ class FromExistingOverridePolicy(BaseOverridePolicy):
already_published = DecoratedResultSet(
store.find(
(
- BinaryPackagePublishingHistory.binarypackagenameID,
- BinaryPackagePublishingHistory.distroarchseriesID,
+ BinaryPackagePublishingHistory.binarypackagename_id,
+ BinaryPackagePublishingHistory.distroarchseries_id,
BinaryPackagePublishingHistory.component_id,
BinaryPackagePublishingHistory.section_id,
BinaryPackagePublishingHistory.priority,
@@ -367,7 +366,7 @@ class FromExistingOverridePolicy(BaseOverridePolicy):
BinaryPackageRelease.version,
),
BinaryPackageRelease.id
- == BinaryPackagePublishingHistory.binarypackagereleaseID,
+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
BinaryPackagePublishingHistory.status.is_in(
self.getExistingPublishingStatuses(self.include_deleted)
),
@@ -375,15 +374,15 @@ class FromExistingOverridePolicy(BaseOverridePolicy):
*other_conditions,
)
.order_by(
- BinaryPackagePublishingHistory.distroarchseriesID,
- BinaryPackagePublishingHistory.binarypackagenameID,
+ BinaryPackagePublishingHistory.distroarchseries_id,
+ BinaryPackagePublishingHistory.binarypackagename_id,
Desc(BinaryPackagePublishingHistory.datecreated),
Desc(BinaryPackagePublishingHistory.id),
)
.config(
distinct=(
- BinaryPackagePublishingHistory.distroarchseriesID,
- BinaryPackagePublishingHistory.binarypackagenameID,
+ BinaryPackagePublishingHistory.distroarchseries_id,
+ BinaryPackagePublishingHistory.binarypackagename_id,
)
),
id_resolver(
@@ -597,9 +596,9 @@ def calculate_target_das(distroseries, binaries):
def make_package_condition(archive, das, bpn):
return And(
- BinaryPackagePublishingHistory.archiveID == archive.id,
- BinaryPackagePublishingHistory.distroarchseriesID == das.id,
- BinaryPackagePublishingHistory.binarypackagenameID == bpn.id,
+ BinaryPackagePublishingHistory.archive == archive,
+ BinaryPackagePublishingHistory.distroarchseries == das,
+ BinaryPackagePublishingHistory.binarypackagename == bpn,
)
diff --git a/lib/lp/soyuz/doc/distribution.rst b/lib/lp/soyuz/doc/distribution.rst
index 485fa14..cb5c996 100644
--- a/lib/lp/soyuz/doc/distribution.rst
+++ b/lib/lp/soyuz/doc/distribution.rst
@@ -278,7 +278,7 @@ Celso's PPA.
... archive=cprov.archive, status=PackagePublishingStatus.PUBLISHED
... )
>>> spr = cprov_bin.binarypackagerelease.build.source_package_release
- >>> spr.publishings[0].setPublished()
+ >>> spr.publishings.first().setPublished()
>>> pending_binaries = cprov_bin.copyTo(
... warty, pocket_release, cprov.archive
... )
diff --git a/lib/lp/soyuz/doc/distroarchseriesbinarypackage.rst b/lib/lp/soyuz/doc/distroarchseriesbinarypackage.rst
index 60957e5..1a36167 100644
--- a/lib/lp/soyuz/doc/distroarchseriesbinarypackage.rst
+++ b/lib/lp/soyuz/doc/distroarchseriesbinarypackage.rst
@@ -77,7 +77,7 @@ needs to be removed.
>>> pe = BinaryPackagePublishingHistory(
... binarypackagerelease=bpr.id,
... binarypackagename=bpr.binarypackagename,
- ... _binarypackageformat=bpr.binpackageformat,
+ ... binarypackageformat=bpr.binpackageformat,
... component=main_component.id,
... section=misc_section.id,
... priority=priority,
@@ -86,10 +86,6 @@ needs to be removed.
... datecreated=UTC_NOW,
... datepublished=UTC_NOW,
... pocket=PackagePublishingPocket.RELEASE,
- ... datesuperseded=None,
- ... supersededby=None,
- ... datemadepending=None,
- ... dateremoved=None,
... archive=hoary_i386.main_archive,
... sourcepackagename=bpr.build.source_package_name,
... )
@@ -126,7 +122,7 @@ needs to be removed.
>>> pe = BinaryPackagePublishingHistory(
... binarypackagerelease=bpr.id,
... binarypackagename=bpr.binarypackagename,
- ... _binarypackageformat=bpr.binpackageformat,
+ ... binarypackageformat=bpr.binpackageformat,
... component=main_component.id,
... section=misc_section.id,
... priority=priority,
@@ -135,10 +131,6 @@ needs to be removed.
... datecreated=UTC_NOW,
... datepublished=UTC_NOW,
... pocket=PackagePublishingPocket.RELEASE,
- ... datesuperseded=None,
- ... supersededby=None,
- ... datemadepending=None,
- ... dateremoved=None,
... archive=hoary_i386.main_archive,
... sourcepackagename=bpr.build.source_package_name,
... )
diff --git a/lib/lp/soyuz/doc/distroseriesqueue-translations.rst b/lib/lp/soyuz/doc/distroseriesqueue-translations.rst
index 7a82713..f758a6c 100644
--- a/lib/lp/soyuz/doc/distroseriesqueue-translations.rst
+++ b/lib/lp/soyuz/doc/distroseriesqueue-translations.rst
@@ -76,7 +76,7 @@ queue:
... distroseries=dapper.id,
... sourcepackagerelease=source_package_release.id,
... sourcepackagename=source_package_release.sourcepackagename,
- ... _format=source_package_release.format,
+ ... format=source_package_release.format,
... component=source_package_release.component.id,
... section=source_package_release.section.id,
... status=PackagePublishingStatus.PUBLISHED,
diff --git a/lib/lp/soyuz/doc/gina-multiple-arch.rst b/lib/lp/soyuz/doc/gina-multiple-arch.rst
index 70c851a..fa9ca09 100644
--- a/lib/lp/soyuz/doc/gina-multiple-arch.rst
+++ b/lib/lp/soyuz/doc/gina-multiple-arch.rst
@@ -3,6 +3,7 @@ Gina over Multiple Architectures (and Pockets, and Components)
Get the current counts of stuff in the database:
+ >>> from lp.services.database.interfaces import IStore
>>> from lp.services.identity.model.emailaddress import EmailAddress
>>> from lp.registry.model.person import Person
>>> from lp.registry.model.teammembership import TeamParticipation
@@ -17,13 +18,13 @@ Get the current counts of stuff in the database:
>>> SBPPH = BinaryPackagePublishingHistory
>>> orig_spr_count = SourcePackageRelease.select().count()
- >>> orig_sspph_count = SSPPH.select().count()
+ >>> orig_sspph_count = IStore(SSPPH).find(SSPPH).count()
>>> orig_person_count = Person.select().count()
>>> orig_tp_count = TeamParticipation.select().count()
>>> orig_email_count = EmailAddress.select().count()
>>> orig_bpr_count = BinaryPackageRelease.select().count()
>>> orig_build_count = BinaryPackageBuild.select().count()
- >>> orig_sbpph_count = SBPPH.select().count()
+ >>> orig_sbpph_count = IStore(SBPPH).find(SBPPH).count()
Create a distribution series and an arch series for dapper:
@@ -127,7 +128,7 @@ breezy:
>>> SourcePackageRelease.select().count() - orig_spr_count
2
- >>> print(SSPPH.select().count() - orig_sspph_count)
+ >>> print(IStore(SSPPH).find(SSPPH).count() - orig_sspph_count)
2
Each source package has its own maintainer (in this case, fabbione and
@@ -148,7 +149,7 @@ distroarchseries:
4
>>> BinaryPackageBuild.select().count() - orig_build_count
2
- >>> SBPPH.select().count() - orig_sbpph_count
+ >>> IStore(SBPPH).find(SBPPH).count() - orig_sbpph_count
4
Check that the source package was correctly imported:
@@ -228,8 +229,10 @@ Check that we publishing bdftopcf into the correct distroarchseries:
... )
>>> print(dar.architecturetag)
i386
- >>> for entry in SBPPH.selectBy(
- ... distroarchseriesID=dar.id, orderBy="binarypackagerelease"
+ >>> for entry in (
+ ... IStore(SBPPH)
+ ... .find(SBPPH, distroarchseries=dar)
+ ... .order_by("binarypackagerelease")
... ):
... package = entry.binarypackagerelease
... print(package.binarypackagename.name, package.version)
diff --git a/lib/lp/soyuz/doc/gina.rst b/lib/lp/soyuz/doc/gina.rst
index ae17b6e..405cf53 100644
--- a/lib/lp/soyuz/doc/gina.rst
+++ b/lib/lp/soyuz/doc/gina.rst
@@ -7,6 +7,7 @@ quiet mode over it.
Get the current counts of stuff in the database:
+ >>> from storm.locals import Desc
>>> from lp.services.database.interfaces import IStore
>>> from lp.services.identity.model.emailaddress import EmailAddress
>>> from lp.soyuz.interfaces.publishing import active_publishing_status
@@ -24,16 +25,20 @@ Get the current counts of stuff in the database:
>>> SBPPH = BinaryPackagePublishingHistory
>>> orig_spr_count = SourcePackageRelease.select().count()
- >>> orig_sspph_count = SSPPH.select().count()
+ >>> orig_sspph_count = IStore(SSPPH).find(SSPPH).count()
>>> orig_person_count = Person.select().count()
>>> orig_tp_count = TeamParticipation.select().count()
>>> orig_email_count = EmailAddress.select().count()
>>> orig_bpr_count = BinaryPackageRelease.select().count()
>>> orig_build_count = BinaryPackageBuild.select().count()
- >>> orig_sbpph_count = SBPPH.select().count()
- >>> orig_sspph_main_count = SSPPH.selectBy(
- ... component_id=1, pocket=PackagePublishingPocket.RELEASE
- ... ).count()
+ >>> orig_sbpph_count = IStore(SBPPH).find(SBPPH).count()
+ >>> orig_sspph_main_count = (
+ ... IStore(SSPPH)
+ ... .find(
+ ... SSPPH, component_id=1, pocket=PackagePublishingPocket.RELEASE
+ ... )
+ ... .count()
+ ... )
Create a distribution release and an arch release for breezy:
@@ -367,8 +372,10 @@ Testing Source Package Publishing
We check that the source package publishing override facility works:
- >>> for pub in SSPPH.selectBy(
- ... sourcepackagereleaseID=db1.id, orderBy="distroseries"
+ >>> for pub in (
+ ... IStore(SSPPH)
+ ... .find(SSPPH, sourcepackagerelease=db1)
+ ... .order_by(SSPPH.distroseries_id)
... ):
... print(
... "%s %s %s"
@@ -390,12 +397,16 @@ successfully processed.
- We had 2 errors (out of 10 Sources stanzas) in breezy: python-sqllite
and util-linux (again, poor thing).
- >>> print(SSPPH.select().count() - orig_sspph_count)
+ >>> print(IStore(SSPPH).find(SSPPH).count() - orig_sspph_count)
21
- >>> new_count = SSPPH.selectBy(
- ... component_id=1, pocket=PackagePublishingPocket.RELEASE
- ... ).count()
+ >>> new_count = (
+ ... IStore(SSPPH)
+ ... .find(
+ ... SSPPH, component_id=1, pocket=PackagePublishingPocket.RELEASE
+ ... )
+ ... .count()
+ ... )
>>> print(new_count - orig_sspph_main_count)
21
@@ -415,7 +426,7 @@ work.
40
>>> BinaryPackageBuild.select().count() - orig_build_count
13
- >>> SBPPH.select().count() - orig_sbpph_count
+ >>> IStore(SBPPH).find(SBPPH).count() - orig_sbpph_count
46
Check that the shlibs parsing and bin-only-NMU version handling works as
@@ -455,8 +466,12 @@ priority was correctly munged to "extra":
We now check if the Breezy publication record has the correct priority:
- >>> ed_pub = SBPPH.selectOneBy(
- ... binarypackagereleaseID=ed.id, distroarchseriesID=breezy_i386.id
+ >>> ed_pub = (
+ ... IStore(SBPPH)
+ ... .find(
+ ... SBPPH, binarypackagerelease=ed, distroarchseries=breezy_i386
+ ... )
+ ... .one()
... )
>>> print(ed_pub.priority)
Standard
@@ -637,51 +652,53 @@ changed, etc.
But the overrides do generate extra publishing entries:
- >>> SBPPH.select().count() - orig_sbpph_count
+ >>> IStore(SBPPH).find(SBPPH).count() - orig_sbpph_count
47
- >>> print(SSPPH.select().count() - orig_sspph_count)
+ >>> IStore(SSPPH).find(SSPPH).count() - orig_sspph_count
23
Check that the overrides we did were correctly issued. We can't use
-selectOneBy because, of course, there may be multiple rows published for that
+``.one()`` because, of course, there may be multiple rows published for that
package -- that's what overrides actually do.
- >>> from lp.services.database.sqlbase import sqlvalues
- >>> x11_pub = SSPPH.select(
- ... """
- ... sourcepackagerelease = %s AND
- ... distroseries = %s AND
- ... status in %s
- ... """
- ... % sqlvalues(x11p, breezy, active_publishing_status),
- ... orderBy=["-datecreated"],
- ... )[0]
+ >>> x11_pub = (
+ ... IStore(SSPPH)
+ ... .find(
+ ... SSPPH,
+ ... SSPPH.sourcepackagerelease == x11p,
+ ... SSPPH.distroseries == breezy,
+ ... SSPPH.status.is_in(active_publishing_status),
+ ... )
+ ... .order_by(Desc(SSPPH.datecreated))[0]
+ ... )
>>> print(x11_pub.section.name)
net
- >>> ed_pub = SBPPH.select(
- ... """
- ... binarypackagerelease = %s AND
- ... distroarchseries = %s AND
- ... status in %s
- ... """
- ... % sqlvalues(ed, breezy_i386, active_publishing_status),
- ... orderBy=["-datecreated"],
- ... )[0]
+ >>> ed_pub = (
+ ... IStore(SBPPH)
+ ... .find(
+ ... SBPPH,
+ ... SBPPH.binarypackagerelease == ed,
+ ... SBPPH.distroarchseries == breezy_i386,
+ ... SBPPH.status.is_in(active_publishing_status),
+ ... )
+ ... .order_by(Desc(SBPPH.datecreated))[0]
+ ... )
>>> print(ed_pub.priority)
Extra
>>> n = SourcePackageName.selectOneBy(name="archive-copier")
>>> ac = SourcePackageRelease.selectOneBy(
... sourcepackagenameID=n.id, version="0.3.6"
... )
- >>> ac_pub = SSPPH.select(
- ... """
- ... sourcepackagerelease = %s AND
- ... distroseries = %s AND
- ... status in %s
- ... """
- ... % sqlvalues(ac, breezy, active_publishing_status),
- ... orderBy=["-datecreated"],
- ... )[0]
+ >>> ac_pub = (
+ ... IStore(SSPPH)
+ ... .find(
+ ... SSPPH,
+ ... SSPPH.sourcepackagerelease == ac,
+ ... SSPPH.distroseries == breezy,
+ ... SSPPH.status.is_in(active_publishing_status),
+ ... )
+ ... .order_by(Desc(SSPPH.datecreated))[0]
+ ... )
>>> print(ac_pub.component.name)
universe
@@ -699,11 +716,11 @@ First get a set of existing publishings for both source and binary:
>>> hoary = ubuntu["hoary"]
>>> hoary_i386 = hoary["i386"]
>>> partner_source_set = set(
- ... SSPPH.select("distroseries = %s" % sqlvalues(hoary))
+ ... IStore(SSPPH).find(SSPPH, distroseries=hoary)
... )
>>> partner_binary_set = set(
- ... SBPPH.select("distroarchseries = %s" % sqlvalues(hoary_i386))
+ ... IStore(SBPPH).find(SBPPH, distroarchseries=hoary_i386)
... )
Now run gina to import packages and convert them to partner:
@@ -719,11 +736,11 @@ Now run gina to import packages and convert them to partner:
There will now be a number of publishings in the partner archive:
>>> partner_source_set_after = set(
- ... SSPPH.select("distroseries = %s" % sqlvalues(hoary))
+ ... IStore(SSPPH).find(SSPPH, distroseries=hoary)
... )
>>> partner_binary_set_after = set(
- ... SBPPH.select("distroarchseries = %s" % sqlvalues(hoary_i386))
+ ... IStore(SBPPH).find(SBPPH, distroarchseries=hoary_i386)
... )
>>> source_difference = partner_source_set_after - partner_source_set
@@ -818,7 +835,9 @@ We will also store the number of binaries already published in debian
PRIMARY archive, so we can check later it was unaffected by the
import.
- >>> debian_binaries = SBPPH.selectBy(archive=debian.main_archive)
+ >>> debian_binaries = IStore(SBPPH).find(
+ ... SBPPH, archive=debian.main_archive
+ ... )
>>> number_of_debian_binaries = debian_binaries.count()
Commit the changes and run the importer script.
@@ -837,7 +856,7 @@ Commit the changes and run the importer script.
There is now a number of source publications in PUBLISHED status for the
targeted distroseries, 'lenny'.
- >>> lenny_sources = SSPPH.select("distroseries = %s" % sqlvalues(lenny))
+ >>> lenny_sources = IStore(SSPPH).find(SSPPH, distroseries=lenny)
>>> lenny_sources.count()
12
@@ -850,11 +869,15 @@ As mentioned before, lenny/i386 is empty, no binaries were imported.
Also, the number of binaries published in the whole debian distribution
hasn't changed.
- >>> lenny_binaries = SBPPH.selectBy(distroarchseries=lenny_i386)
+ >>> lenny_binaries = IStore(SBPPH).find(
+ ... SBPPH, distroarchseries=lenny_i386
+ ... )
>>> lenny_binaries.count()
0
- >>> debian_binaries = SBPPH.selectBy(archive=debian.main_archive)
+ >>> debian_binaries = IStore(SBPPH).find(
+ ... SBPPH, archive=debian.main_archive
+ ... )
>>> debian_binaries.count() == number_of_debian_binaries
True
diff --git a/lib/lp/soyuz/doc/soyuz-set-of-uploads.rst b/lib/lp/soyuz/doc/soyuz-set-of-uploads.rst
index 6b73a73..1ba2b35 100644
--- a/lib/lp/soyuz/doc/soyuz-set-of-uploads.rst
+++ b/lib/lp/soyuz/doc/soyuz-set-of-uploads.rst
@@ -214,6 +214,9 @@ it into the accepted queue
Finally, as a very simplistic publishing process, we may need to punt any
given upload into the published state, so here's a very simplistic publisher
+ >>> from lp.registry.model.distroseries import DistroSeries
+ >>> from lp.services.database.interfaces import IStore
+ >>> from lp.soyuz.model.distroarchseries import DistroArchSeries
>>> from lp.soyuz.model.publishing import (
... SourcePackagePublishingHistory as SPPH,
... BinaryPackagePublishingHistory as BPPH,
@@ -221,29 +224,20 @@ given upload into the published state, so here's a very simplistic publisher
>>> from lp.soyuz.enums import PackagePublishingStatus as PPS
>>> from lp.services.database.constants import UTC_NOW
>>> def simple_publish(distro):
- ... srcs_to_publish = SPPH.select(
- ... """
- ... SourcePackagePublishingHistory.distroseries = DistroSeries.id
- ... AND DistroSeries.distribution = Distribution.id
- ... AND Distribution.name = '%s'
- ... AND SourcePackagePublishingHistory.status = 1"""
- ... % distro,
- ... clauseTables=["DistroSeries", "Distribution"],
+ ... srcs_to_publish = IStore(SPPH).find(
+ ... SPPH,
+ ... SPPH.distroseries == DistroSeries.id,
+ ... DistroSeries.distribution == Distribution.id,
+ ... Distribution.name == distro,
+ ... SPPH.status == PPS.PENDING,
... )
- ... bins_to_publish = BPPH.select(
- ... """
- ... BinaryPackagePublishingHistory.distroarchseries =
- ... DistroArchSeries.id
- ... AND DistroArchSeries.distroseries = DistroSeries.id
- ... AND DistroSeries.distribution = Distribution.id
- ... AND Distribution.name = '%s'
- ... AND BinaryPackagePublishingHistory.status = 1"""
- ... % distro,
- ... clauseTables=[
- ... "DistroArchSeries",
- ... "DistroSeries",
- ... "Distribution",
- ... ],
+ ... bins_to_publish = IStore(BPPH).find(
+ ... BPPH,
+ ... BPPH.distroarchseries == DistroArchSeries.id,
+ ... DistroArchSeries.distroseries == DistroSeries.id,
+ ... DistroSeries.distribution == Distribution.id,
+ ... Distribution.name == distro,
+ ... BPPH.status == PPS.PENDING,
... )
... published_one = False
... for src in srcs_to_publish:
diff --git a/lib/lp/soyuz/doc/soyuz-upload.rst b/lib/lp/soyuz/doc/soyuz-upload.rst
index 0b4fd40..f6027d6 100644
--- a/lib/lp/soyuz/doc/soyuz-upload.rst
+++ b/lib/lp/soyuz/doc/soyuz-upload.rst
@@ -498,7 +498,7 @@ These packages must now be in the publishing history. Let's check it.
>>> for name in package_names:
... spn = SourcePackageName.selectOneBy(name=name)
... spr = SourcePackageRelease.selectOneBy(sourcepackagenameID=spn.id)
- ... sspph = SSPPH.selectOneBy(sourcepackagereleaseID=spr.id)
+ ... sspph = IStore(SSPPH).find(SSPPH, sourcepackagerelease=spr).one()
... if sspph:
... print(name, sspph.status.title)
... else:
@@ -604,9 +604,13 @@ component 'multiverse'.
Check if we have new pending publishing record as expected
- >>> for pub in SSPPH.selectBy(
- ... sourcepackagereleaseID=etherwake_drspr.sourcepackagerelease.id,
- ... orderBy=["id"],
+ >>> for pub in (
+ ... IStore(SSPPH)
+ ... .find(
+ ... SSPPH,
+ ... sourcepackagerelease=etherwake_drspr.sourcepackagerelease,
+ ... )
+ ... .order_by(SSPPH.id)
... ):
... print(pub.status.name, pub.component.name, pub.pocket.name)
PUBLISHED universe RELEASE
@@ -636,9 +640,13 @@ already on disk, verify the contents are as expected.
Check the publishing history again
- >>> for pub in SSPPH.selectBy(
- ... sourcepackagereleaseID=etherwake_drspr.sourcepackagerelease.id,
- ... orderBy=["id"],
+ >>> for pub in (
+ ... IStore(SSPPH)
+ ... .find(
+ ... SSPPH,
+ ... sourcepackagerelease=etherwake_drspr.sourcepackagerelease,
+ ... )
+ ... .order_by(SSPPH.id)
... ):
... print(pub.status.name, pub.component.name, pub.pocket.name)
SUPERSEDED universe RELEASE
diff --git a/lib/lp/soyuz/interfaces/publishing.py b/lib/lp/soyuz/interfaces/publishing.py
index 600f089..f0689a0 100644
--- a/lib/lp/soyuz/interfaces/publishing.py
+++ b/lib/lp/soyuz/interfaces/publishing.py
@@ -212,13 +212,13 @@ class ISourcePackagePublishingHistoryPublic(IPublishingView):
required=True,
readonly=True,
)
- sourcepackagenameID = Int(
+ sourcepackagename_id = Int(
title=_("The DB id for the sourcepackagename."),
required=False,
readonly=False,
)
sourcepackagename = Attribute("The source package name being published")
- sourcepackagereleaseID = Int(
+ sourcepackagerelease_id = Int(
title=_("The DB id for the sourcepackagerelease."),
required=False,
readonly=False,
@@ -241,7 +241,7 @@ class ISourcePackagePublishingHistoryPublic(IPublishingView):
readonly=False,
)
)
- distroseriesID = Attribute("DB ID for distroseries.")
+ distroseries_id = Attribute("DB ID for distroseries.")
distroseries = exported(
Reference(
IDistroSeries,
@@ -358,7 +358,7 @@ class ISourcePackagePublishingHistoryPublic(IPublishingView):
),
exported_as="date_removed",
)
- removed_byID = Attribute("DB ID for removed_by.")
+ removed_by_id = Attribute("DB ID for removed_by.")
removed_by = exported(
Reference(
IPerson,
@@ -438,7 +438,7 @@ class ISourcePackagePublishingHistoryPublic(IPublishingView):
readonly=True,
)
- creatorID = Attribute("DB ID for creator.")
+ creator_id = Attribute("DB ID for creator.")
creator = exported(
Reference(
IPerson,
@@ -449,7 +449,7 @@ class ISourcePackagePublishingHistoryPublic(IPublishingView):
)
)
- sponsorID = Attribute("DB ID for sponsor.")
+ sponsor_id = Attribute("DB ID for sponsor.")
sponsor = exported(
Reference(
IPerson,
@@ -692,13 +692,13 @@ class IBinaryPackagePublishingHistoryPublic(IPublishingView):
"""A binary package publishing record."""
id = Int(title=_("ID"), required=True, readonly=True)
- binarypackagenameID = Int(
+ binarypackagename_id = Int(
title=_("The DB id for the binarypackagename."),
required=False,
readonly=False,
)
binarypackagename = Attribute("The binary package name being published")
- binarypackagereleaseID = Int(
+ binarypackagerelease_id = Int(
title=_("The DB id for the binarypackagerelease."),
required=False,
readonly=False,
@@ -734,7 +734,7 @@ class IBinaryPackagePublishingHistoryPublic(IPublishingView):
readonly=True,
)
)
- distroarchseriesID = Int(
+ distroarchseries_id = Int(
title=_("The DB id for the distroarchseries."),
required=False,
readonly=False,
diff --git a/lib/lp/soyuz/interfaces/sourcepackagerelease.py b/lib/lp/soyuz/interfaces/sourcepackagerelease.py
index 8fba1f1..a6f1c64 100644
--- a/lib/lp/soyuz/interfaces/sourcepackagerelease.py
+++ b/lib/lp/soyuz/interfaces/sourcepackagerelease.py
@@ -117,7 +117,7 @@ class ISourcePackageRelease(Interface):
"The distroseries in which this package "
"was first uploaded in Launchpad"
)
- publishings = Attribute("MultipleJoin on SourcepackagePublishing")
+ publishings = Attribute("Publishing records that link to this release")
user_defined_fields = List(
title=_("Sequence of user-defined fields as key-value pairs.")
diff --git a/lib/lp/soyuz/model/archive.py b/lib/lp/soyuz/model/archive.py
index 1e82709..505b278 100644
--- a/lib/lp/soyuz/model/archive.py
+++ b/lib/lp/soyuz/model/archive.py
@@ -730,7 +730,7 @@ class Archive(SQLBase):
only_unpublished=False,
):
"""See `IArchive`."""
- clauses = [SourcePackagePublishingHistory.archiveID == self.id]
+ clauses = [SourcePackagePublishingHistory.archive == self]
if order_by_date:
order_by = [
@@ -745,7 +745,7 @@ class Archive(SQLBase):
if not order_by_date or name is not None:
clauses.append(
- SourcePackagePublishingHistory.sourcepackagenameID
+ SourcePackagePublishingHistory.sourcepackagename_id
== SourcePackageName.id
)
@@ -762,7 +762,7 @@ class Archive(SQLBase):
if not order_by_date or version is not None:
clauses.append(
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== SourcePackageRelease.id
)
@@ -797,8 +797,7 @@ class Archive(SQLBase):
if distroseries is not None:
clauses.append(
- SourcePackagePublishingHistory.distroseriesID
- == distroseries.id
+ SourcePackagePublishingHistory.distroseries == distroseries
)
if pocket is not None:
@@ -837,7 +836,7 @@ class Archive(SQLBase):
# \o/ circular imports.
from lp.registry.model.distroseries import DistroSeries
- ids = set(map(attrgetter("distroseriesID"), rows))
+ ids = set(map(attrgetter("distroseries_id"), rows))
ids.discard(None)
if ids:
list(store.find(DistroSeries, DistroSeries.id.is_in(ids)))
@@ -845,7 +844,7 @@ class Archive(SQLBase):
ids.discard(None)
if ids:
list(store.find(Section, Section.id.is_in(ids)))
- ids = set(map(attrgetter("sourcepackagereleaseID"), rows))
+ ids = set(map(attrgetter("sourcepackagerelease_id"), rows))
ids.discard(None)
if not ids:
return
@@ -868,10 +867,10 @@ class Archive(SQLBase):
# rather than linking through BPB, BPR and BPPH since we don't condemn
# sources until their binaries are all gone due to GPL compliance.
clauses = [
- SourcePackagePublishingHistory.archiveID == self.id,
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.archive == self,
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== SourcePackageRelease.id,
- SourcePackagePublishingHistory.sourcepackagenameID
+ SourcePackagePublishingHistory.sourcepackagename_id
== SourcePackageName.id,
SourcePackagePublishingHistory.scheduleddeletiondate == None,
]
@@ -885,8 +884,7 @@ class Archive(SQLBase):
if distroseries:
clauses.append(
- SourcePackagePublishingHistory.distroseriesID
- == distroseries.id
+ SourcePackagePublishingHistory.distroseries == distroseries
)
if name:
@@ -904,7 +902,7 @@ class Archive(SQLBase):
def eager_load(rows):
load_related(
- SourcePackageRelease, rows, ["sourcepackagereleaseID"]
+ SourcePackageRelease, rows, ["sourcepackagerelease_id"]
)
return DecoratedResultSet(sources, pre_iter_hook=eager_load)
@@ -927,7 +925,7 @@ class Archive(SQLBase):
),
SourcePackagePublishingHistory.archive == self.id,
SourcePackagePublishingHistory.dateremoved == None,
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== SourcePackageReleaseFile.sourcepackagerelease_id,
SourcePackageReleaseFile.libraryfile_id == LibraryFileAlias.id,
LibraryFileAlias.contentID == LibraryFileContent.id,
@@ -968,7 +966,7 @@ class Archive(SQLBase):
Returns a list of 'clauses' (to be joined in the callsite).
"""
- clauses = [BinaryPackagePublishingHistory.archiveID == self.id]
+ clauses = [BinaryPackagePublishingHistory.archive == self]
if order_by_date:
ordered = False
@@ -991,7 +989,7 @@ class Archive(SQLBase):
if ordered or name is not None:
clauses.append(
- BinaryPackagePublishingHistory.binarypackagenameID
+ BinaryPackagePublishingHistory.binarypackagename_id
== BinaryPackageName.id
)
@@ -1003,7 +1001,7 @@ class Archive(SQLBase):
if need_bpr or ordered or version is not None:
clauses.append(
- BinaryPackagePublishingHistory.binarypackagereleaseID
+ BinaryPackagePublishingHistory.binarypackagerelease_id
== BinaryPackageRelease.id
)
@@ -1034,7 +1032,7 @@ class Archive(SQLBase):
except TypeError:
distroarchseries = (distroarchseries,)
clauses.append(
- BinaryPackagePublishingHistory.distroarchseriesID.is_in(
+ BinaryPackagePublishingHistory.distroarchseries_id.is_in(
[d.id for d in distroarchseries]
)
)
@@ -1111,7 +1109,7 @@ class Archive(SQLBase):
def eager_load_api(bpphs):
bprs = load_related(
- BinaryPackageRelease, bpphs, ["binarypackagereleaseID"]
+ BinaryPackageRelease, bpphs, ["binarypackagerelease_id"]
)
load_related(BinaryPackageName, bprs, ["binarypackagenameID"])
bpbs = load_related(BinaryPackageBuild, bprs, ["buildID"])
@@ -1122,7 +1120,7 @@ class Archive(SQLBase):
load_related(Component, bpphs, ["component_id"])
load_related(Section, bpphs, ["section_id"])
dases = load_related(
- DistroArchSeries, bpphs, ["distroarchseriesID"]
+ DistroArchSeries, bpphs, ["distroarchseries_id"]
)
load_related(DistroSeries, dases, ["distroseriesID"])
@@ -1156,7 +1154,7 @@ class Archive(SQLBase):
clauses.extend(
[
- BinaryPackagePublishingHistory.distroarchseriesID
+ BinaryPackagePublishingHistory.distroarchseries_id
== DistroArchSeries.id,
DistroArchSeries.distroseriesID == DistroSeries.id,
]
@@ -1170,7 +1168,7 @@ class Archive(SQLBase):
# architecture-specific built for 'nominatedarchindep'.
nominated_arch_independent_clauses = clauses + [
DistroSeries.nominatedarchindepID
- == BinaryPackagePublishingHistory.distroarchseriesID,
+ == BinaryPackagePublishingHistory.distroarchseries_id,
]
nominated_arch_independents = store.find(
BinaryPackagePublishingHistory, *nominated_arch_independent_clauses
@@ -1180,7 +1178,7 @@ class Archive(SQLBase):
# 'nominatedarchindep' (already included in the previous query).
no_nominated_arch_independent_clauses = clauses + [
DistroSeries.nominatedarchindepID
- != BinaryPackagePublishingHistory.distroarchseriesID,
+ != BinaryPackagePublishingHistory.distroarchseries_id,
BinaryPackageRelease.architecturespecific == True,
]
no_nominated_arch_independents = store.find(
@@ -1216,7 +1214,7 @@ class Archive(SQLBase):
),
BinaryPackagePublishingHistory.archive == self.id,
BinaryPackagePublishingHistory.dateremoved == None,
- BinaryPackagePublishingHistory.binarypackagereleaseID
+ BinaryPackagePublishingHistory.binarypackagerelease_id
== BinaryPackageFile.binarypackagerelease_id,
BinaryPackageFile.libraryfile_id == LibraryFileAlias.id,
LibraryFileAlias.contentID == LibraryFileContent.id,
@@ -1342,7 +1340,7 @@ class Archive(SQLBase):
archive_clause = Or(
[
And(
- BinaryPackagePublishingHistory.archiveID == archive.id,
+ BinaryPackagePublishingHistory.archive == archive,
BinaryPackagePublishingHistory.pocket == pocket,
Component.name.is_in(components),
)
@@ -2009,21 +2007,21 @@ class Archive(SQLBase):
if re_issource.match(filename):
clauses = (
SourcePackagePublishingHistory.archive == self.id,
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== SourcePackageReleaseFile.sourcepackagerelease_id,
SourcePackageReleaseFile.libraryfile_id == LibraryFileAlias.id,
)
elif re_isadeb.match(filename):
clauses = (
BinaryPackagePublishingHistory.archive == self.id,
- BinaryPackagePublishingHistory.binarypackagereleaseID
+ BinaryPackagePublishingHistory.binarypackagerelease_id
== BinaryPackageFile.binarypackagerelease_id,
BinaryPackageFile.libraryfile_id == LibraryFileAlias.id,
)
elif filename.endswith(".changes"):
clauses = (
SourcePackagePublishingHistory.archive == self.id,
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== PackageUploadSource.sourcepackagerelease_id,
PackageUploadSource.packageupload_id == PackageUpload.id,
PackageUpload.status == PackageUploadStatus.DONE,
@@ -2048,7 +2046,7 @@ class Archive(SQLBase):
if filename.endswith(".diff.gz"):
clauses = (
SourcePackagePublishingHistory.archive == self.id,
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== PackageDiff.to_source_id,
PackageDiff.diff_content_id == LibraryFileAlias.id,
)
@@ -2065,7 +2063,7 @@ class Archive(SQLBase):
result = IStore(LibraryFileAlias).find(
LibraryFileAlias,
SourcePackagePublishingHistory.archive == self,
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== SourcePackageRelease.id,
SourcePackageRelease.sourcepackagename == SourcePackageName.id,
SourcePackageName.name == name,
@@ -2170,7 +2168,7 @@ class Archive(SQLBase):
BinaryPackageRelease,
BinaryPackagePublishingHistory.archive == self,
BinaryPackagePublishingHistory.binarypackagename == name,
- BinaryPackagePublishingHistory.binarypackagereleaseID
+ BinaryPackagePublishingHistory.binarypackagerelease_id
== BinaryPackageRelease.id,
Cast(BinaryPackageRelease.version, "text") == version,
BinaryPackageBuild.id == BinaryPackageRelease.buildID,
@@ -2194,7 +2192,7 @@ class Archive(SQLBase):
BinaryPackageFile.libraryfile_id == LibraryFileAlias.id,
LibraryFileAlias.filename == filename,
BinaryPackagePublishingHistory.archive == self,
- BinaryPackagePublishingHistory.binarypackagereleaseID
+ BinaryPackagePublishingHistory.binarypackagerelease_id
== BinaryPackageRelease.id,
)
.order_by(Desc(BinaryPackagePublishingHistory.id))
diff --git a/lib/lp/soyuz/model/binarypackagebuild.py b/lib/lp/soyuz/model/binarypackagebuild.py
index 22351b8..22ca39a 100644
--- a/lib/lp/soyuz/model/binarypackagebuild.py
+++ b/lib/lp/soyuz/model/binarypackagebuild.py
@@ -1170,7 +1170,7 @@ class BinaryPackageBuildSet(SpecificBuildFarmJobSourceMixin):
Join(
BinaryPackageRelease,
BinaryPackageRelease.id
- == BinaryPackagePublishingHistory.binarypackagereleaseID,
+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
),
),
where=And(
diff --git a/lib/lp/soyuz/model/binarypackagename.py b/lib/lp/soyuz/model/binarypackagename.py
index 1516166..a60dbab 100644
--- a/lib/lp/soyuz/model/binarypackagename.py
+++ b/lib/lp/soyuz/model/binarypackagename.py
@@ -88,12 +88,12 @@ class BinaryPackageNameSet:
BinaryPackagePublishingHistory,
Join(
BinaryPackageName,
- BinaryPackagePublishingHistory.binarypackagenameID
+ BinaryPackagePublishingHistory.binarypackagename_id
== BinaryPackageName.id,
),
Join(
DistroArchSeries,
- BinaryPackagePublishingHistory.distroarchseriesID
+ BinaryPackagePublishingHistory.distroarchseries_id
== DistroArchSeries.id,
),
)
@@ -103,8 +103,8 @@ class BinaryPackageNameSet:
BinaryPackagePublishingHistory.status.is_in(
active_publishing_status
),
- BinaryPackagePublishingHistory.archiveID.is_in(archive_ids),
- BinaryPackagePublishingHistory.binarypackagenameID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(archive_ids),
+ BinaryPackagePublishingHistory.binarypackagename_id.is_in(
name_ids
),
)
diff --git a/lib/lp/soyuz/model/binarysourcereference.py b/lib/lp/soyuz/model/binarysourcereference.py
index 0962186..a65a7f9 100644
--- a/lib/lp/soyuz/model/binarysourcereference.py
+++ b/lib/lp/soyuz/model/binarysourcereference.py
@@ -134,7 +134,7 @@ class BinarySourceReferenceSet:
)
)
values.append(
- (bpr.id, closest_spph.sourcepackagereleaseID, reference_type)
+ (bpr.id, closest_spph.sourcepackagerelease_id, reference_type)
)
return create(
diff --git a/lib/lp/soyuz/model/distributionsourcepackagecache.py b/lib/lp/soyuz/model/distributionsourcepackagecache.py
index 31ee732..aba6e2d 100644
--- a/lib/lp/soyuz/model/distributionsourcepackagecache.py
+++ b/lib/lp/soyuz/model/distributionsourcepackagecache.py
@@ -89,7 +89,7 @@ class DistributionSourcePackageCache(StormBase):
)
else:
spn_ids = IStore(SourcePackagePublishingHistory).find(
- SourcePackagePublishingHistory.sourcepackagenameID,
+ SourcePackagePublishingHistory.sourcepackagename_id,
SourcePackagePublishingHistory.archive == archive,
SourcePackagePublishingHistory.status.is_in(
active_publishing_status
@@ -174,8 +174,8 @@ class DistributionSourcePackageCache(StormBase):
SourcePackageRelease.version,
),
SourcePackageRelease.id
- == SourcePackagePublishingHistory.sourcepackagereleaseID,
- SourcePackagePublishingHistory.sourcepackagenameID.is_in(
+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
+ SourcePackagePublishingHistory.sourcepackagename_id.is_in(
[spn.id for spn in sourcepackagenames]
),
SourcePackagePublishingHistory.archive == archive,
diff --git a/lib/lp/soyuz/model/distributionsourcepackagerelease.py b/lib/lp/soyuz/model/distributionsourcepackagerelease.py
index 9002ce6..19eb9f3 100644
--- a/lib/lp/soyuz/model/distributionsourcepackagerelease.py
+++ b/lib/lp/soyuz/model/distributionsourcepackagerelease.py
@@ -49,17 +49,17 @@ class DistributionSourcePackageRelease:
res = Store.of(distribution).find(
SourcePackagePublishingHistory,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
distribution.all_distro_archive_ids
),
- SourcePackagePublishingHistory.distroseriesID == DistroSeries.id,
+ SourcePackagePublishingHistory.distroseries_id == DistroSeries.id,
DistroSeries.distribution == distribution,
- SourcePackagePublishingHistory.sourcepackagereleaseID.is_in(
+ SourcePackagePublishingHistory.sourcepackagerelease_id.is_in(
spr.id for spr in sprs
),
)
return res.order_by(
- Desc(SourcePackagePublishingHistory.sourcepackagereleaseID),
+ Desc(SourcePackagePublishingHistory.sourcepackagerelease_id),
Desc(SourcePackagePublishingHistory.datecreated),
Desc(SourcePackagePublishingHistory.id),
)
@@ -118,7 +118,7 @@ class DistributionSourcePackageRelease:
BinaryPackageRelease.build == BinaryPackageBuild.id,
BinaryPackagePublishingHistory.binarypackagerelease
== BinaryPackageRelease.id,
- BinaryPackagePublishingHistory.archiveID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
*clauses,
@@ -165,7 +165,7 @@ class DistributionSourcePackageRelease:
Join(
DistroArchSeries,
DistroArchSeries.id
- == BinaryPackagePublishingHistory.distroarchseriesID,
+ == BinaryPackagePublishingHistory.distroarchseries_id,
),
Join(
DistroSeries,
@@ -174,7 +174,7 @@ class DistributionSourcePackageRelease:
Join(
BinaryPackageRelease,
BinaryPackageRelease.id
- == BinaryPackagePublishingHistory.binarypackagereleaseID,
+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
),
Join(
BinaryPackageName,
@@ -202,7 +202,7 @@ class DistributionSourcePackageRelease:
.find(
result_row,
DistroSeries.distribution == self.distribution,
- BinaryPackagePublishingHistory.archiveID.is_in(archive_ids),
+ BinaryPackagePublishingHistory.archive_id.is_in(archive_ids),
BinaryPackageBuild.source_package_release
== self.sourcepackagerelease,
)
@@ -236,12 +236,12 @@ class DistributionSourcePackageRelease:
Join(
BinaryPackagePublishingHistory,
BinaryPackageRelease.id
- == BinaryPackagePublishingHistory.binarypackagereleaseID,
+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
),
Join(
DistroArchSeries,
DistroArchSeries.id
- == BinaryPackagePublishingHistory.distroarchseriesID,
+ == BinaryPackagePublishingHistory.distroarchseries_id,
),
Join(
BinaryPackageName,
@@ -254,7 +254,7 @@ class DistributionSourcePackageRelease:
result_row,
And(
DistroArchSeries.distroseriesID == distroseries.id,
- BinaryPackagePublishingHistory.archiveID.is_in(archive_ids),
+ BinaryPackagePublishingHistory.archive_id.is_in(archive_ids),
BinaryPackageBuild.source_package_release
== self.sourcepackagerelease,
),
diff --git a/lib/lp/soyuz/model/distroarchseries.py b/lib/lp/soyuz/model/distroarchseries.py
index 66cd8b1..db9c6d8 100644
--- a/lib/lp/soyuz/model/distroarchseries.py
+++ b/lib/lp/soyuz/model/distroarchseries.py
@@ -115,7 +115,7 @@ class DistroArchSeries(SQLBase):
.find(
BinaryPackagePublishingHistory,
BinaryPackagePublishingHistory.distroarchseries == self,
- BinaryPackagePublishingHistory.archiveID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(
self.distroseries.distribution.all_distro_archive_ids
),
BinaryPackagePublishingHistory.status
@@ -302,7 +302,7 @@ class DistroArchSeries(SQLBase):
clauses = [
BinaryPackagePublishingHistory.distroarchseries == self,
- BinaryPackagePublishingHistory.archiveID.is_in(archives),
+ BinaryPackagePublishingHistory.archive_id.is_in(archives),
BinaryPackagePublishingHistory.status.is_in(
active_publishing_status
),
diff --git a/lib/lp/soyuz/model/distroarchseriesbinarypackage.py b/lib/lp/soyuz/model/distroarchseriesbinarypackage.py
index d85b423..2e710e3 100644
--- a/lib/lp/soyuz/model/distroarchseriesbinarypackage.py
+++ b/lib/lp/soyuz/model/distroarchseriesbinarypackage.py
@@ -115,12 +115,12 @@ class DistroArchSeriesBinaryPackage:
return [
BinaryPackagePublishingHistory.distroarchseries
== self.distroarchseries,
- BinaryPackagePublishingHistory.archiveID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
BinaryPackagePublishingHistory.binarypackagename
== self.binarypackagename,
- BinaryPackagePublishingHistory.binarypackagereleaseID
+ BinaryPackagePublishingHistory.binarypackagerelease_id
== BinaryPackageRelease.id,
]
diff --git a/lib/lp/soyuz/model/distroarchseriesbinarypackagerelease.py b/lib/lp/soyuz/model/distroarchseriesbinarypackagerelease.py
index 8d6a5b2..cdf4c61 100644
--- a/lib/lp/soyuz/model/distroarchseriesbinarypackagerelease.py
+++ b/lib/lp/soyuz/model/distroarchseriesbinarypackagerelease.py
@@ -93,7 +93,7 @@ class DistroArchSeriesBinaryPackageRelease:
== self.binarypackagerelease,
BinaryPackagePublishingHistory.distroarchseries
== self.distroarchseries,
- BinaryPackagePublishingHistory.archiveID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
]
@@ -122,7 +122,7 @@ class DistroArchSeriesBinaryPackageRelease:
BinaryPackagePublishingHistory,
BinaryPackagePublishingHistory.distroarchseries
== self.distroarchseries,
- BinaryPackagePublishingHistory.archiveID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
BinaryPackagePublishingHistory.binarypackagerelease
diff --git a/lib/lp/soyuz/model/distroseriesbinarypackage.py b/lib/lp/soyuz/model/distroseriesbinarypackage.py
index 3e3f4c5..6a5f6c7 100644
--- a/lib/lp/soyuz/model/distroseriesbinarypackage.py
+++ b/lib/lp/soyuz/model/distroseriesbinarypackage.py
@@ -114,7 +114,7 @@ class DistroSeriesBinaryPackage:
== BinaryPackageRelease.id,
BinaryPackagePublishingHistory.binarypackagename
== self.binarypackagename,
- BinaryPackagePublishingHistory.archiveID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(
self.distribution.all_distro_archive_ids
),
BinaryPackagePublishingHistory.dateremoved == None,
diff --git a/lib/lp/soyuz/model/distroseriesdifferencejob.py b/lib/lp/soyuz/model/distroseriesdifferencejob.py
index 9420cb6..d1e73f5 100644
--- a/lib/lp/soyuz/model/distroseriesdifferencejob.py
+++ b/lib/lp/soyuz/model/distroseriesdifferencejob.py
@@ -77,7 +77,7 @@ def create_multiple_jobs(derived_series, parent_series):
"""
store = IStore(SourcePackagePublishingHistory)
spn_ids = store.find(
- SourcePackagePublishingHistory.sourcepackagenameID,
+ SourcePackagePublishingHistory.sourcepackagename_id,
SourcePackagePublishingHistory.distroseries == derived_series.id,
SourcePackagePublishingHistory.status.is_in(active_publishing_status),
)
diff --git a/lib/lp/soyuz/model/distroseriespackagecache.py b/lib/lp/soyuz/model/distroseriespackagecache.py
index 769e654..6c09b45 100644
--- a/lib/lp/soyuz/model/distroseriespackagecache.py
+++ b/lib/lp/soyuz/model/distroseriespackagecache.py
@@ -63,8 +63,8 @@ class DistroSeriesPackageCache(StormBase):
bpn_ids = (
IStore(BinaryPackagePublishingHistory)
.find(
- BinaryPackagePublishingHistory.binarypackagenameID,
- BinaryPackagePublishingHistory.distroarchseriesID.is_in(
+ BinaryPackagePublishingHistory.binarypackagename_id,
+ BinaryPackagePublishingHistory.distroarchseries_id.is_in(
Select(
DistroArchSeries.id,
tables=[DistroArchSeries],
@@ -80,7 +80,7 @@ class DistroSeriesPackageCache(StormBase):
# Not necessary for correctness, but useful for testability; and
# at the time of writing the sort only adds perhaps 10-20 ms to
# the query time on staging.
- .order_by(BinaryPackagePublishingHistory.binarypackagenameID)
+ .order_by(BinaryPackagePublishingHistory.binarypackagename_id)
)
return bulk.load(BinaryPackageName, bpn_ids)
@@ -155,11 +155,11 @@ class DistroSeriesPackageCache(StormBase):
Max(BinaryPackageRelease.datecreated),
),
BinaryPackageRelease.id
- == BinaryPackagePublishingHistory.binarypackagereleaseID,
- BinaryPackagePublishingHistory.binarypackagenameID.is_in(
+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
+ BinaryPackagePublishingHistory.binarypackagename_id.is_in(
[bpn.id for bpn in binarypackagenames]
),
- BinaryPackagePublishingHistory.distroarchseriesID.is_in(
+ BinaryPackagePublishingHistory.distroarchseries_id.is_in(
Select(
DistroArchSeries.id,
tables=[DistroArchSeries],
diff --git a/lib/lp/soyuz/model/publishing.py b/lib/lp/soyuz/model/publishing.py
index ba47074..a6161c9 100644
--- a/lib/lp/soyuz/model/publishing.py
+++ b/lib/lp/soyuz/model/publishing.py
@@ -20,7 +20,7 @@ from pathlib import Path
from storm.databases.postgres import JSON
from storm.expr import And, Cast, Desc, Join, LeftJoin, Not, Or, Sum
from storm.info import ClassAlias
-from storm.properties import Int
+from storm.properties import DateTime, Int, Unicode
from storm.references import Reference
from storm.store import Store
from storm.zope import IResultSet
@@ -39,12 +39,10 @@ from lp.registry.model.sourcepackagename import SourcePackageName
from lp.services.channels import channel_list_to_string, channel_string_to_list
from lp.services.database import bulk
from lp.services.database.constants import UTC_NOW
-from lp.services.database.datetimecol import UtcDateTimeCol
from lp.services.database.decoratedresultset import DecoratedResultSet
from lp.services.database.enumcol import DBEnum
from lp.services.database.interfaces import IPrimaryStore, IStore
-from lp.services.database.sqlbase import SQLBase
-from lp.services.database.sqlobject import ForeignKey, IntCol, StringCol
+from lp.services.database.stormbase import StormBase
from lp.services.database.stormexpr import IsDistinctFrom
from lp.services.librarian.browser import ProxiedLibraryFileAlias
from lp.services.librarian.model import LibraryFileAlias, LibraryFileContent
@@ -236,14 +234,17 @@ class ArchivePublisherBase:
@implementer(ISourcePackagePublishingHistory)
-class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
+class SourcePackagePublishingHistory(StormBase, ArchivePublisherBase):
"""A source package release publishing record."""
- sourcepackagename = ForeignKey(
- foreignKey="SourcePackageName", dbName="sourcepackagename"
- )
- sourcepackagerelease = ForeignKey(
- foreignKey="SourcePackageRelease", dbName="sourcepackagerelease"
+ __storm_table__ = "SourcePackagePublishingHistory"
+
+ id = Int(primary=True)
+ sourcepackagename_id = Int(name="sourcepackagename")
+ sourcepackagename = Reference(sourcepackagename_id, "SourcePackageName.id")
+ sourcepackagerelease_id = Int(name="sourcepackagerelease")
+ sourcepackagerelease = Reference(
+ sourcepackagerelease_id, "SourcePackageRelease.id"
)
_format = DBEnum(
name="format",
@@ -251,7 +252,8 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
default=SourcePackageType.DPKG,
allow_none=True,
)
- distroseries = ForeignKey(foreignKey="DistroSeries", dbName="distroseries")
+ distroseries_id = Int(name="distroseries")
+ distroseries = Reference(distroseries_id, "DistroSeries.id")
# DB constraint: non-nullable for SourcePackageType.DPKG.
component_id = Int(name="component", allow_none=True)
component = Reference(component_id, "Component.id")
@@ -259,15 +261,14 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
section_id = Int(name="section", allow_none=True)
section = Reference(section_id, "Section.id")
status = DBEnum(enum=PackagePublishingStatus)
- scheduleddeletiondate = UtcDateTimeCol(default=None)
- datepublished = UtcDateTimeCol(default=None)
- datecreated = UtcDateTimeCol(default=UTC_NOW)
- datesuperseded = UtcDateTimeCol(default=None)
- supersededby = ForeignKey(
- foreignKey="SourcePackageRelease", dbName="supersededby", default=None
- )
- datemadepending = UtcDateTimeCol(default=None)
- dateremoved = UtcDateTimeCol(default=None)
+ scheduleddeletiondate = DateTime(default=None, tzinfo=timezone.utc)
+ datepublished = DateTime(default=None, tzinfo=timezone.utc)
+ datecreated = DateTime(default=UTC_NOW, tzinfo=timezone.utc)
+ datesuperseded = DateTime(default=None, tzinfo=timezone.utc)
+ supersededby_id = Int(name="supersededby", default=None)
+ supersededby = Reference(supersededby_id, "SourcePackageRelease.id")
+ datemadepending = DateTime(default=None, tzinfo=timezone.utc)
+ dateremoved = DateTime(default=None, tzinfo=timezone.utc)
pocket = DBEnum(
name="pocket",
enum=PackagePublishingPocket,
@@ -275,39 +276,77 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
allow_none=False,
)
_channel = JSON(name="channel", allow_none=True)
- archive = ForeignKey(dbName="archive", foreignKey="Archive", notNull=True)
- copied_from_archive = ForeignKey(
- dbName="copied_from_archive", foreignKey="Archive", notNull=False
+ archive_id = Int(name="archive", allow_none=False)
+ archive = Reference(archive_id, "Archive.id")
+ copied_from_archive_id = Int(name="copied_from_archive", allow_none=True)
+ copied_from_archive = Reference(copied_from_archive_id, "Archive.id")
+ removed_by_id = Int(
+ name="removed_by", validator=validate_public_person, default=None
)
- removed_by = ForeignKey(
- dbName="removed_by",
- foreignKey="Person",
- storm_validator=validate_public_person,
- default=None,
- )
- removal_comment = StringCol(dbName="removal_comment", default=None)
- ancestor = ForeignKey(
- dbName="ancestor",
- foreignKey="SourcePackagePublishingHistory",
- default=None,
- )
- creator = ForeignKey(
- dbName="creator",
- foreignKey="Person",
- storm_validator=validate_public_person,
- notNull=False,
+ removed_by = Reference(removed_by_id, "Person.id")
+ removal_comment = Unicode(name="removal_comment", default=None)
+ ancestor_id = Int(name="ancestor", default=None)
+ ancestor = Reference(ancestor_id, "SourcePackagePublishingHistory.id")
+ creator_id = Int(
+ name="creator",
+ validator=validate_public_person,
+ allow_none=True,
default=None,
)
- sponsor = ForeignKey(
- dbName="sponsor",
- foreignKey="Person",
- storm_validator=validate_public_person,
- notNull=False,
+ creator = Reference(creator_id, "Person.id")
+ sponsor_id = Int(
+ name="sponsor",
+ validator=validate_public_person,
+ allow_none=True,
default=None,
)
+ sponsor = Reference(sponsor_id, "Person.id")
packageupload_id = Int(name="packageupload", allow_none=True, default=None)
packageupload = Reference(packageupload_id, "PackageUpload.id")
+ def __init__(
+ self,
+ sourcepackagename,
+ sourcepackagerelease,
+ format,
+ distroseries,
+ pocket,
+ status,
+ archive,
+ component=None,
+ section=None,
+ scheduleddeletiondate=None,
+ datepublished=None,
+ datecreated=None,
+ dateremoved=None,
+ channel=None,
+ copied_from_archive=None,
+ ancestor=None,
+ creator=None,
+ sponsor=None,
+ packageupload=None,
+ ):
+ super().__init__()
+ self.sourcepackagename = sourcepackagename
+ self.sourcepackagerelease = sourcepackagerelease
+ self._format = format
+ self.distroseries = distroseries
+ self.pocket = pocket
+ self.status = status
+ self.archive = archive
+ self.component = component
+ self.section = section
+ self.scheduleddeletiondate = scheduleddeletiondate
+ self.datepublished = datepublished
+ self.datecreated = datecreated
+ self.dateremoved = dateremoved
+ self._channel = channel
+ self.copied_from_archive = copied_from_archive
+ self.ancestor = ancestor
+ self.creator = creator
+ self.sponsor = sponsor
+ self.packageupload = packageupload
+
@property
def format(self):
# XXX cjwatson 2022-04-04: Remove once this column has been backfilled.
@@ -359,22 +398,22 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
Store.of(self)
.find(
BinaryPackagePublishingHistory,
- BinaryPackagePublishingHistory.binarypackagereleaseID
+ BinaryPackagePublishingHistory.binarypackagerelease_id
== BinaryPackageRelease.id,
- BinaryPackagePublishingHistory.distroarchseriesID
+ BinaryPackagePublishingHistory.distroarchseries_id
== DistroArchSeries.id,
- BinaryPackagePublishingHistory.archiveID == self.archiveID,
+ BinaryPackagePublishingHistory.archive == self.archive_id,
BinaryPackagePublishingHistory.pocket == self.pocket,
BinaryPackageBuild.id == BinaryPackageRelease.buildID,
BinaryPackageBuild.source_package_release_id
- == self.sourcepackagereleaseID,
- DistroArchSeries.distroseriesID == self.distroseriesID,
+ == self.sourcepackagerelease_id,
+ DistroArchSeries.distroseriesID == self.distroseries_id,
)
.order_by(Desc(BinaryPackagePublishingHistory.id))
)
# Preload attached BinaryPackageReleases.
- bpr_ids = {pub.binarypackagereleaseID for pub in binary_publications}
+ bpr_ids = {pub.binarypackagerelease_id for pub in binary_publications}
list(
Store.of(self).find(
BinaryPackageRelease, BinaryPackageRelease.id.is_in(bpr_ids)
@@ -662,7 +701,7 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
LibraryFileContent.id == LibraryFileAlias.contentID,
LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
SourcePackageReleaseFile.sourcepackagerelease
- == self.sourcepackagereleaseID,
+ == self.sourcepackagerelease_id,
)
source_urls = proxied_source_urls(
[source for source, _ in sources], self
@@ -746,21 +785,23 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
@implementer(IBinaryPackagePublishingHistory)
-class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
+class BinaryPackagePublishingHistory(StormBase, ArchivePublisherBase):
"""A binary package publishing record."""
- binarypackagename = ForeignKey(
- foreignKey="BinaryPackageName", dbName="binarypackagename"
- )
- binarypackagerelease = ForeignKey(
- foreignKey="BinaryPackageRelease", dbName="binarypackagerelease"
+ __storm_table__ = "BinaryPackagePublishingHistory"
+
+ id = Int(primary=True)
+ binarypackagename_id = Int(name="binarypackagename")
+ binarypackagename = Reference(binarypackagename_id, "BinaryPackageName.id")
+ binarypackagerelease_id = Int(name="binarypackagerelease")
+ binarypackagerelease = Reference(
+ binarypackagerelease_id, "BinaryPackageRelease.id"
)
_binarypackageformat = DBEnum(
name="binarypackageformat", enum=BinaryPackageFormat, allow_none=True
)
- distroarchseries = ForeignKey(
- foreignKey="DistroArchSeries", dbName="distroarchseries"
- )
+ distroarchseries_id = Int(name="distroarchseries")
+ distroarchseries = Reference(distroarchseries_id, "DistroArchSeries.id")
# DB constraint: non-nullable for BinaryPackageFormat.{DEB,UDEB,DDEB}.
component_id = Int(name="component", allow_none=True)
component = Reference(component_id, "Component.id")
@@ -772,43 +813,80 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
name="priority", enum=PackagePublishingPriority, allow_none=True
)
status = DBEnum(name="status", enum=PackagePublishingStatus)
- phased_update_percentage = IntCol(
- dbName="phased_update_percentage", notNull=False, default=None
+ phased_update_percentage = Int(
+ name="phased_update_percentage", allow_none=True, default=None
)
- scheduleddeletiondate = UtcDateTimeCol(default=None)
- creator = ForeignKey(
- dbName="creator",
- foreignKey="Person",
- storm_validator=validate_public_person,
- notNull=False,
+ scheduleddeletiondate = DateTime(default=None, tzinfo=timezone.utc)
+ creator_id = Int(
+ name="creator",
+ validator=validate_public_person,
+ allow_none=True,
default=None,
)
- datepublished = UtcDateTimeCol(default=None)
- datecreated = UtcDateTimeCol(default=UTC_NOW)
- datesuperseded = UtcDateTimeCol(default=None)
- supersededby = ForeignKey(
- foreignKey="BinaryPackageBuild", dbName="supersededby", default=None
- )
- datemadepending = UtcDateTimeCol(default=None)
- dateremoved = UtcDateTimeCol(default=None)
+ creator = Reference(creator_id, "Person.id")
+ datepublished = DateTime(default=None, tzinfo=timezone.utc)
+ datecreated = DateTime(default=UTC_NOW, tzinfo=timezone.utc)
+ datesuperseded = DateTime(default=None, tzinfo=timezone.utc)
+ supersededby_id = Int(name="supersededby", default=None)
+ supersededby = Reference(supersededby_id, "BinaryPackageBuild.id")
+ datemadepending = DateTime(default=None, tzinfo=timezone.utc)
+ dateremoved = DateTime(default=None, tzinfo=timezone.utc)
pocket = DBEnum(name="pocket", enum=PackagePublishingPocket)
_channel = JSON(name="channel", allow_none=True)
- archive = ForeignKey(dbName="archive", foreignKey="Archive", notNull=True)
- copied_from_archive = ForeignKey(
- dbName="copied_from_archive", foreignKey="Archive", notNull=False
- )
- removed_by = ForeignKey(
- dbName="removed_by",
- foreignKey="Person",
- storm_validator=validate_public_person,
- default=None,
- )
- removal_comment = StringCol(dbName="removal_comment", default=None)
- sourcepackagename = ForeignKey(
- foreignKey="SourcePackageName",
- dbName="sourcepackagename",
- notNull=False,
+ archive_id = Int(name="archive", allow_none=False)
+ archive = Reference(archive_id, "Archive.id")
+ copied_from_archive_id = Int(name="copied_from_archive", allow_none=True)
+ copied_from_archive = Reference(copied_from_archive_id, "Archive.id")
+ removed_by_id = Int(
+ name="removed_by", validator=validate_public_person, default=None
)
+ removed_by = Reference(removed_by_id, "Person.id")
+ removal_comment = Unicode(name="removal_comment", default=None)
+ sourcepackagename_id = Int(name="sourcepackagename", allow_none=True)
+ sourcepackagename = Reference(sourcepackagename_id, "SourcePackageName.id")
+
+ def __init__(
+ self,
+ binarypackagename,
+ binarypackagerelease,
+ binarypackageformat,
+ distroarchseries,
+ pocket,
+ status,
+ archive,
+ sourcepackagename,
+ component=None,
+ section=None,
+ priority=None,
+ phased_update_percentage=None,
+ scheduleddeletiondate=None,
+ creator=None,
+ datepublished=None,
+ datecreated=None,
+ dateremoved=None,
+ channel=None,
+ copied_from_archive=None,
+ ):
+ super().__init__()
+ self.binarypackagename = binarypackagename
+ self.binarypackagerelease = binarypackagerelease
+ self._binarypackageformat = binarypackageformat
+ self.distroarchseries = distroarchseries
+ self.pocket = pocket
+ self.status = status
+ self.archive = archive
+ self.sourcepackagename = sourcepackagename
+ self.component = component
+ self.section = section
+ self.priority = priority
+ self.phased_update_percentage = phased_update_percentage
+ self.scheduleddeletiondate = scheduleddeletiondate
+ self.creator = creator
+ self.datepublished = datepublished
+ self.datecreated = datecreated
+ self.dateremoved = dateremoved
+ self._channel = channel
+ self.copied_from_archive = copied_from_archive
@property
def binarypackageformat(self):
@@ -961,7 +1039,7 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
BinaryPackagePublishingHistory.status.is_in(
active_publishing_status
),
- BinaryPackagePublishingHistory.distroarchseriesID.is_in(
+ BinaryPackagePublishingHistory.distroarchseries_id.is_in(
available_architectures
),
binarypackagerelease=self.binarypackagerelease,
@@ -1130,7 +1208,7 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
BinaryPackagePublishingHistory(
binarypackagename=debug.binarypackagename,
binarypackagerelease=debug.binarypackagerelease,
- _binarypackageformat=debug.binarypackageformat,
+ binarypackageformat=debug.binarypackageformat,
distroarchseries=debug.distroarchseries,
status=PackagePublishingStatus.PENDING,
datecreated=UTC_NOW,
@@ -1141,15 +1219,15 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
creator=creator,
archive=debug.archive,
phased_update_percentage=new_phased_update_percentage,
- _channel=removeSecurityProxy(debug)._channel,
+ channel=removeSecurityProxy(debug)._channel,
sourcepackagename=debug.sourcepackagename,
)
# Append the modified package publishing entry
- return BinaryPackagePublishingHistory(
+ bpph = BinaryPackagePublishingHistory(
binarypackagename=bpr.binarypackagename,
binarypackagerelease=bpr,
- _binarypackageformat=bpr.binpackageformat,
+ binarypackageformat=bpr.binpackageformat,
distroarchseries=self.distroarchseries,
status=PackagePublishingStatus.PENDING,
datecreated=UTC_NOW,
@@ -1160,13 +1238,15 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
archive=self.archive,
creator=creator,
phased_update_percentage=new_phased_update_percentage,
- _channel=self._channel,
+ channel=self._channel,
sourcepackagename=(
bpr.build.source_package_name
if bpr.build is not None
else None
),
)
+ IStore(bpph).flush()
+ return bpph
def copyTo(self, distroseries, pocket, archive):
"""See `BinaryPackagePublishingHistory`."""
@@ -1257,7 +1337,7 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
LibraryFileContent.id == LibraryFileAlias.contentID,
LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
BinaryPackageFile.binarypackagerelease
- == self.binarypackagereleaseID,
+ == self.binarypackagerelease_id,
)
binary_urls = proxied_urls(
[binary for binary, _ in binaries], self.archive
@@ -1351,10 +1431,10 @@ class PublishingSet:
# conflicting binaries from other sources.
def make_package_condition(archive, das, bpr):
return And(
- BinaryPackagePublishingHistory.archiveID == archive.id,
- BinaryPackagePublishingHistory.distroarchseriesID == das.id,
- BinaryPackagePublishingHistory.binarypackagenameID
- == bpr.binarypackagenameID,
+ BinaryPackagePublishingHistory.archive == archive,
+ BinaryPackagePublishingHistory.distroarchseries == das,
+ BinaryPackagePublishingHistory.binarypackagename
+ == bpr.binarypackagename,
Cast(BinaryPackageRelease.version, "text") == bpr.version,
)
@@ -1366,7 +1446,7 @@ class PublishingSet:
IPrimaryStore(BinaryPackagePublishingHistory)
.find(
(
- BinaryPackagePublishingHistory.distroarchseriesID,
+ BinaryPackagePublishingHistory.distroarchseries_id,
BinaryPackageRelease.binarypackagenameID,
BinaryPackageRelease.version,
),
@@ -1381,7 +1461,7 @@ class PublishingSet:
active_publishing_status
),
BinaryPackageRelease.id
- == BinaryPackagePublishingHistory.binarypackagereleaseID,
+ == BinaryPackagePublishingHistory.binarypackagerelease_id,
Or(*candidates),
)
.config(distinct=True)
@@ -1610,7 +1690,7 @@ class PublishingSet:
archive=archive,
sourcepackagename=sourcepackagerelease.sourcepackagename,
sourcepackagerelease=sourcepackagerelease,
- _format=sourcepackagerelease.format,
+ format=sourcepackagerelease.format,
component=get_component(archive, distroseries, component),
section=section,
status=PackagePublishingStatus.PENDING,
@@ -1619,7 +1699,7 @@ class PublishingSet:
creator=creator,
sponsor=sponsor,
packageupload=packageupload,
- _channel=channel,
+ channel=channel,
)
DistributionSourcePackage.ensure(pub)
@@ -1655,9 +1735,9 @@ class PublishingSet:
# We'll be looking for builds in the same distroseries as the
# SPPH for the same release.
builds_for_distroseries_expr = (
- SourcePackagePublishingHistory.distroseriesID
+ SourcePackagePublishingHistory.distroseries_id
== BinaryPackageBuild.distro_series_id,
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== BinaryPackageBuild.source_package_release_id,
SourcePackagePublishingHistory.id.is_in(source_publication_ids),
DistroArchSeries.id == BinaryPackageBuild.distro_arch_series_id,
@@ -1669,7 +1749,7 @@ class PublishingSet:
BinaryPackageBuild,
builds_for_distroseries_expr,
(
- SourcePackagePublishingHistory.archiveID
+ SourcePackagePublishingHistory.archive_id
== BinaryPackageBuild.archive_id
),
*extra_exprs,
@@ -1682,11 +1762,11 @@ class PublishingSet:
BinaryPackageBuild,
builds_for_distroseries_expr,
(
- SourcePackagePublishingHistory.archiveID
+ SourcePackagePublishingHistory.archive_id
!= BinaryPackageBuild.archive_id
),
BinaryPackagePublishingHistory.archive
- == SourcePackagePublishingHistory.archiveID,
+ == SourcePackagePublishingHistory.archive_id,
BinaryPackagePublishingHistory.binarypackagerelease
== BinaryPackageRelease.id,
BinaryPackageRelease.build == BinaryPackageBuild.id,
@@ -1768,20 +1848,20 @@ class PublishingSet:
):
"""Return the join linking sources with binaries."""
join = [
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== BinaryPackageBuild.source_package_release_id,
BinaryPackageRelease.build == BinaryPackageBuild.id,
BinaryPackageRelease.binarypackagenameID == BinaryPackageName.id,
- SourcePackagePublishingHistory.distroseriesID
+ SourcePackagePublishingHistory.distroseries_id
== DistroArchSeries.distroseriesID,
- BinaryPackagePublishingHistory.distroarchseriesID
+ BinaryPackagePublishingHistory.distroarchseries_id
== DistroArchSeries.id,
BinaryPackagePublishingHistory.binarypackagerelease
== BinaryPackageRelease.id,
BinaryPackagePublishingHistory.pocket
== SourcePackagePublishingHistory.pocket,
- BinaryPackagePublishingHistory.archiveID
- == SourcePackagePublishingHistory.archiveID,
+ BinaryPackagePublishingHistory.archive_id
+ == SourcePackagePublishingHistory.archive_id,
SourcePackagePublishingHistory.id.is_in(source_publication_ids),
]
@@ -1852,12 +1932,12 @@ class PublishingSet:
LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
BinaryPackageFile.binarypackagerelease == BinaryPackageRelease.id,
BinaryPackageRelease.buildID == BinaryPackageBuild.id,
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== BinaryPackageBuild.source_package_release_id,
- BinaryPackagePublishingHistory.binarypackagereleaseID
+ BinaryPackagePublishingHistory.binarypackagerelease_id
== BinaryPackageRelease.id,
- BinaryPackagePublishingHistory.archiveID
- == SourcePackagePublishingHistory.archiveID,
+ BinaryPackagePublishingHistory.archive_id
+ == SourcePackagePublishingHistory.archive_id,
SourcePackagePublishingHistory.id.is_in(source_publication_ids),
)
@@ -1879,7 +1959,7 @@ class PublishingSet:
LibraryFileContent.id == LibraryFileAlias.contentID,
LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
SourcePackageReleaseFile.sourcepackagerelease
- == SourcePackagePublishingHistory.sourcepackagereleaseID,
+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
SourcePackagePublishingHistory.id.is_in(source_publication_ids),
)
@@ -1953,10 +2033,10 @@ class PublishingSet:
BinaryPackageBuild.source_package_release_id
== sourcepackagerelease.id,
BinaryPackageRelease.build == BinaryPackageBuild.id,
- BinaryPackagePublishingHistory.binarypackagereleaseID
+ BinaryPackagePublishingHistory.binarypackagerelease_id
== BinaryPackageRelease.id,
- BinaryPackagePublishingHistory.archiveID == archive.id,
- BinaryPackagePublishingHistory.distroarchseriesID
+ BinaryPackagePublishingHistory.archive == archive,
+ BinaryPackagePublishingHistory.distroarchseries_id
== DistroArchSeries.id,
DistroArchSeries.distroseriesID == distroseries.id,
BinaryPackagePublishingHistory.pocket == pocket,
@@ -1998,7 +2078,7 @@ class PublishingSet:
# build_source_stanza_fields.
bulk.load_related(Section, spphs, ["section_id"])
sprs = bulk.load_related(
- SourcePackageRelease, spphs, ["sourcepackagereleaseID"]
+ SourcePackageRelease, spphs, ["sourcepackagerelease_id"]
)
bulk.load_related(SourcePackageName, sprs, ["sourcepackagenameID"])
spr_ids = set(map(attrgetter("id"), sprs))
@@ -2057,7 +2137,7 @@ class PublishingSet:
# build_binary_stanza_fields.
bulk.load_related(Section, bpphs, ["section_id"])
bprs = bulk.load_related(
- BinaryPackageRelease, bpphs, ["binarypackagereleaseID"]
+ BinaryPackageRelease, bpphs, ["binarypackagerelease_id"]
)
bpbs = bulk.load_related(BinaryPackageBuild, bprs, ["buildID"])
sprs = bulk.load_related(
@@ -2107,7 +2187,7 @@ class PublishingSet:
PackageUploadSource.sourcepackagerelease
== SourcePackageRelease.id,
SourcePackageRelease.id
- == SourcePackagePublishingHistory.sourcepackagereleaseID,
+ == SourcePackagePublishingHistory.sourcepackagerelease_id,
SourcePackagePublishingHistory.id.is_in(source_publication_ids),
)
@@ -2259,7 +2339,7 @@ class PublishingSet:
affected_pubs.set(
status=PackagePublishingStatus.DELETED,
datesuperseded=UTC_NOW,
- removed_byID=removed_by_id,
+ removed_by_id=removed_by_id,
removal_comment=removal_comment,
)
@@ -2277,7 +2357,7 @@ class PublishingSet:
).set(
status=PackagePublishingStatus.DELETED,
datesuperseded=UTC_NOW,
- removed_byID=removed_by_id,
+ removed_by_id=removed_by_id,
removal_comment=removal_comment,
)
@@ -2290,11 +2370,11 @@ class PublishingSet:
deb_bpph,
Join(
BinaryPackageRelease,
- deb_bpph.binarypackagereleaseID == BinaryPackageRelease.id,
+ deb_bpph.binarypackagerelease_id == BinaryPackageRelease.id,
),
Join(
debug_bpph,
- debug_bpph.binarypackagereleaseID
+ debug_bpph.binarypackagerelease_id
== BinaryPackageRelease.debug_packageID,
),
]
@@ -2305,8 +2385,8 @@ class PublishingSet:
debug_bpph,
deb_bpph.id.is_in(ids),
debug_bpph.status.is_in(active_publishing_status),
- deb_bpph.archiveID == debug_bpph.archiveID,
- deb_bpph.distroarchseriesID == debug_bpph.distroarchseriesID,
+ deb_bpph.archive_id == debug_bpph.archive_id,
+ deb_bpph.distroarchseries_id == debug_bpph.distroarchseries_id,
deb_bpph.pocket == debug_bpph.pocket,
deb_bpph.component_id == debug_bpph.component_id,
deb_bpph.section_id == debug_bpph.section_id,
@@ -2393,10 +2473,10 @@ def get_current_source_releases(
series_clauses = []
for context, package_names in context_sourcepackagenames.items():
clause = And(
- SourcePackagePublishingHistory.sourcepackagenameID.is_in(
+ SourcePackagePublishingHistory.sourcepackagename_id.is_in(
map(attrgetter("id"), package_names)
),
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
archive_ids_func(context)
),
package_clause_func(context),
@@ -2409,7 +2489,7 @@ def get_current_source_releases(
IStore(SourcePackageRelease)
.find(
(SourcePackageRelease, key_col),
- SourcePackagePublishingHistory.sourcepackagereleaseID
+ SourcePackagePublishingHistory.sourcepackagerelease_id
== SourcePackageRelease.id,
SourcePackagePublishingHistory.status.is_in(
active_publishing_status
diff --git a/lib/lp/soyuz/model/queue.py b/lib/lp/soyuz/model/queue.py
index 7b55896..fd7b594 100644
--- a/lib/lp/soyuz/model/queue.py
+++ b/lib/lp/soyuz/model/queue.py
@@ -1891,9 +1891,9 @@ def prefill_packageupload_caches(uploads, puses, pubs, pucs, logs):
load_related(Component, sprs, ["component_id"])
load_related(LibraryFileAlias, uploads, ["changes_file_id"])
publications = load_referencing(
- SourcePackagePublishingHistory, sprs, ["sourcepackagereleaseID"]
+ SourcePackagePublishingHistory, sprs, ["sourcepackagerelease_id"]
)
- load_related(Archive, publications, ["archiveID"])
+ load_related(Archive, publications, ["archive_id"])
diffs = getUtility(IPackageDiffSet).getDiffsToReleases(
sprs, preload_for_display=True
)
diff --git a/lib/lp/soyuz/model/sourcepackagerelease.py b/lib/lp/soyuz/model/sourcepackagerelease.py
index c3b7ed3..8c27732 100644
--- a/lib/lp/soyuz/model/sourcepackagerelease.py
+++ b/lib/lp/soyuz/model/sourcepackagerelease.py
@@ -39,11 +39,7 @@ from lp.services.database.decoratedresultset import DecoratedResultSet
from lp.services.database.enumcol import DBEnum
from lp.services.database.interfaces import IStore
from lp.services.database.sqlbase import SQLBase, cursor, sqlvalues
-from lp.services.database.sqlobject import (
- ForeignKey,
- SQLMultipleJoin,
- StringCol,
-)
+from lp.services.database.sqlobject import ForeignKey, StringCol
from lp.services.librarian.model import LibraryFileAlias, LibraryFileContent
from lp.services.propertycache import cachedproperty, get_property_cache
from lp.soyuz.interfaces.archive import MAIN_ARCHIVE_PURPOSES
@@ -143,13 +139,6 @@ class SourcePackageRelease(SQLBase):
dsc_format = StringCol(dbName="dsc_format")
dsc_binaries = StringCol(dbName="dsc_binaries")
- # MultipleJoins
- publishings = SQLMultipleJoin(
- "SourcePackagePublishingHistory",
- joinColumn="sourcepackagerelease",
- orderBy="-datecreated",
- )
-
_user_defined_fields = StringCol(dbName="user_defined_fields")
def __init__(self, *args, **kwargs):
@@ -281,12 +270,36 @@ class SourcePackageRelease(SQLBase):
def title(self):
return "%s - %s" % (self.sourcepackagename.name, self.version)
+ @property
+ def publishings(self):
+ # Circular import.
+ from lp.soyuz.model.publishing import SourcePackagePublishingHistory
+
+ return (
+ IStore(self)
+ .find(
+ SourcePackagePublishingHistory,
+ SourcePackagePublishingHistory.sourcepackagerelease == self,
+ )
+ .order_by(Desc(SourcePackagePublishingHistory.datecreated))
+ )
+
@cachedproperty
def published_archives(self):
- archives = {
- pub.archive for pub in self.publishings.prejoin(["archive"])
- }
- return sorted(archives, key=operator.attrgetter("id"))
+ # Circular imports.
+ from lp.soyuz.model.archive import Archive
+ from lp.soyuz.model.publishing import SourcePackagePublishingHistory
+
+ return list(
+ IStore(self)
+ .find(
+ Archive,
+ SourcePackagePublishingHistory.sourcepackagerelease == self,
+ SourcePackagePublishingHistory.archive == Archive.id,
+ )
+ .config(distinct=True)
+ .order_by(Archive.id)
+ )
def addFile(self, file, filetype=None):
"""See ISourcePackageRelease."""
diff --git a/lib/lp/soyuz/scripts/expire_archive_files.py b/lib/lp/soyuz/scripts/expire_archive_files.py
index 13af377..2a2e2bc 100755
--- a/lib/lp/soyuz/scripts/expire_archive_files.py
+++ b/lib/lp/soyuz/scripts/expire_archive_files.py
@@ -115,13 +115,13 @@ class ArchiveExpirer(LaunchpadCronScript):
eligible_clauses.extend(
[
BPF.libraryfile == LFA.id,
- BPF.binarypackagerelease == BPPH.binarypackagereleaseID,
+ BPF.binarypackagerelease == BPPH.binarypackagerelease_id,
BPPH.archive == Archive.id,
]
)
denied_clauses.extend(
[
- BPF.binarypackagerelease == BPPH.binarypackagereleaseID,
+ BPF.binarypackagerelease == BPPH.binarypackagerelease_id,
BPPH.archive == Archive.id,
]
)
@@ -133,13 +133,13 @@ class ArchiveExpirer(LaunchpadCronScript):
eligible_clauses.extend(
[
SPRF.libraryfile == LFA.id,
- SPRF.sourcepackagerelease == SPPH.sourcepackagereleaseID,
+ SPRF.sourcepackagerelease == SPPH.sourcepackagerelease_id,
SPPH.archive == Archive.id,
]
)
denied_clauses.extend(
[
- SPRF.sourcepackagerelease == SPPH.sourcepackagereleaseID,
+ SPRF.sourcepackagerelease == SPPH.sourcepackagerelease_id,
SPPH.archive == Archive.id,
]
)
diff --git a/lib/lp/soyuz/scripts/gina/handlers.py b/lib/lp/soyuz/scripts/gina/handlers.py
index a595340..fd62506 100644
--- a/lib/lp/soyuz/scripts/gina/handlers.py
+++ b/lib/lp/soyuz/scripts/gina/handlers.py
@@ -1038,7 +1038,7 @@ class BinaryPackagePublisher:
BinaryPackagePublishingHistory(
binarypackagerelease=binarypackage.id,
binarypackagename=binarypackage.binarypackagename,
- _binarypackageformat=binarypackage.binpackageformat,
+ binarypackageformat=binarypackage.binpackageformat,
component=component.id,
section=section.id,
priority=priority,
@@ -1047,10 +1047,6 @@ class BinaryPackagePublisher:
datecreated=UTC_NOW,
datepublished=UTC_NOW,
pocket=self.pocket,
- datesuperseded=None,
- supersededby=None,
- datemadepending=None,
- dateremoved=None,
archive=archive,
sourcepackagename=binarypackage.build.source_package_name,
)
diff --git a/lib/lp/soyuz/scripts/packagecopier.py b/lib/lp/soyuz/scripts/packagecopier.py
index 2e1557d..a09270a 100644
--- a/lib/lp/soyuz/scripts/packagecopier.py
+++ b/lib/lp/soyuz/scripts/packagecopier.py
@@ -163,12 +163,14 @@ def check_copy_permissions(
if len(sources) > 1:
# Bulk-load the data we'll need from each source publication.
- load_related(SourcePackageRelease, sources, ["sourcepackagereleaseID"])
+ load_related(
+ SourcePackageRelease, sources, ["sourcepackagerelease_id"]
+ )
if move:
# Bulk-load at least some of the data we'll need for permission
# checks on each source archive. Not all of this is currently
# preloadable.
- archives = load_related(Archive, sources, ["archiveID"])
+ archives = load_related(Archive, sources, ["archive_id"])
load_related(Person, archives, ["ownerID"])
# If there is a requester, check that they have upload permission into
diff --git a/lib/lp/soyuz/scripts/tests/test_copypackage.py b/lib/lp/soyuz/scripts/tests/test_copypackage.py
index b2bb41c..5e867fa 100644
--- a/lib/lp/soyuz/scripts/tests/test_copypackage.py
+++ b/lib/lp/soyuz/scripts/tests/test_copypackage.py
@@ -1434,7 +1434,7 @@ class TestDoDirectCopy(BaseDoCopyTests, TestCaseWithFactory):
archive=target_archive,
binarypackagename=bin_i386.binarypackagename,
binarypackagerelease=bin_i386.binarypackagerelease,
- _binarypackageformat=bin_i386.binarypackageformat,
+ binarypackageformat=bin_i386.binarypackageformat,
distroarchseries=nobby["i386"],
pocket=bin_i386.pocket,
component=bin_i386.component,
diff --git a/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py b/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py
index 7151a9d..54e193c 100644
--- a/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py
+++ b/lib/lp/soyuz/scripts/tests/test_obsoletedistroseries.py
@@ -119,7 +119,7 @@ class TestObsoleteDistroseries(TestCaseWithFactory):
SourcePackagePublishingHistory.distroseries == distroseries,
SourcePackagePublishingHistory.status
== PackagePublishingStatus.PUBLISHED,
- SourcePackagePublishingHistory.archiveID.is_in(
+ SourcePackagePublishingHistory.archive_id.is_in(
self.main_archive_ids
),
)
@@ -130,7 +130,7 @@ class TestObsoleteDistroseries(TestCaseWithFactory):
DistroArchSeries.distroseries == distroseries,
BinaryPackagePublishingHistory.status
== PackagePublishingStatus.PUBLISHED,
- BinaryPackagePublishingHistory.archiveID.is_in(
+ BinaryPackagePublishingHistory.archive_id.is_in(
self.main_archive_ids
),
)
diff --git a/lib/lp/soyuz/tests/test_hasbuildrecords.py b/lib/lp/soyuz/tests/test_hasbuildrecords.py
index b0b8e8c..948089d 100644
--- a/lib/lp/soyuz/tests/test_hasbuildrecords.py
+++ b/lib/lp/soyuz/tests/test_hasbuildrecords.py
@@ -274,7 +274,7 @@ class TestSourcePackageHasBuildRecords(TestHasBuildRecordsInterface):
removeSecurityProxy(spr).sourcepackagename = gedit_name
IStore(SourcePackagePublishingHistory).find(
SourcePackagePublishingHistory, sourcepackagerelease=spr
- ).set(sourcepackagenameID=gedit_name.id)
+ ).set(sourcepackagename_id=gedit_name.id)
# Set them as successfully built
for build in self.builds:
diff --git a/lib/lp/soyuz/tests/test_publishing.py b/lib/lp/soyuz/tests/test_publishing.py
index e9cede9..c3c5d9e 100644
--- a/lib/lp/soyuz/tests/test_publishing.py
+++ b/lib/lp/soyuz/tests/test_publishing.py
@@ -43,6 +43,7 @@ from lp.registry.interfaces.sourcepackagename import ISourcePackageNameSet
from lp.services.channels import channel_string_to_list
from lp.services.config import config
from lp.services.database.constants import UTC_NOW
+from lp.services.database.interfaces import IStore
from lp.services.librarian.interfaces import ILibraryFileAliasSet
from lp.services.log.logger import BufferLogger, DevNullLogger
from lp.soyuz.enums import (
@@ -340,7 +341,7 @@ class SoyuzTestPublisher:
distroseries=distroseries,
sourcepackagerelease=spr,
sourcepackagename=spr.sourcepackagename,
- _format=spr.format,
+ format=spr.format,
component=spr.component,
section=spr.section,
status=status,
@@ -351,7 +352,7 @@ class SoyuzTestPublisher:
pocket=pocket,
archive=archive,
creator=creator,
- _channel=channel,
+ channel=channel,
)
return spph
@@ -642,7 +643,7 @@ class SoyuzTestPublisher:
distroarchseries=arch,
binarypackagerelease=binarypackagerelease,
binarypackagename=binarypackagerelease.binarypackagename,
- _binarypackageformat=binarypackagerelease.binpackageformat,
+ binarypackageformat=binarypackagerelease.binpackageformat,
component=binarypackagerelease.component,
section=binarypackagerelease.section,
priority=binarypackagerelease.priority,
@@ -653,7 +654,7 @@ class SoyuzTestPublisher:
pocket=pocket,
archive=archive,
phased_update_percentage=phased_update_percentage,
- _channel=channel,
+ channel=channel,
sourcepackagename=(
binarypackagerelease.build.source_package_name
),
@@ -1010,7 +1011,7 @@ class TestNativePublishing(TestNativePublishingBase):
self.layer.commit()
foo_name = "%s/main/f/foo/foo_666.dsc" % self.pool_dir
- pub_source.sync()
+ IStore(pub_source).flush()
self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
with open(foo_name) as foo:
self.assertEqual(foo.read().strip(), "foo is happy")
@@ -1022,7 +1023,7 @@ class TestNativePublishing(TestNativePublishingBase):
pub_source2.publish(self.disk_pool, self.logger)
self.layer.commit()
- pub_source2.sync()
+ IStore(pub_source2).flush()
self.assertEqual(pub_source2.status, PackagePublishingStatus.PENDING)
with open(foo_name) as foo:
self.assertEqual(foo.read().strip(), "foo is happy")
@@ -1041,7 +1042,7 @@ class TestNativePublishing(TestNativePublishingBase):
bar_name = "%s/main/b/bar/bar_666.dsc" % self.pool_dir
with open(bar_name) as bar:
self.assertEqual(bar.read().strip(), "bar is good")
- pub_source.sync()
+ IStore(pub_source).flush()
self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
pub_source2 = self.getPubSource(
@@ -1049,7 +1050,7 @@ class TestNativePublishing(TestNativePublishingBase):
)
pub_source2.publish(self.disk_pool, self.logger)
self.layer.commit()
- pub_source2.sync()
+ IStore(pub_source2).flush()
self.assertEqual(pub_source2.status, PackagePublishingStatus.PUBLISHED)
def testPublishingSymlink(self):
@@ -1068,8 +1069,8 @@ class TestNativePublishing(TestNativePublishingBase):
pub_source2.publish(self.disk_pool, self.logger)
self.layer.commit()
- pub_source.sync()
- pub_source2.sync()
+ IStore(pub_source).flush()
+ IStore(pub_source2).flush()
self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
self.assertEqual(pub_source2.status, PackagePublishingStatus.PUBLISHED)
@@ -1089,7 +1090,7 @@ class TestNativePublishing(TestNativePublishingBase):
pub_source3.publish(self.disk_pool, self.logger)
self.layer.commit()
- pub_source3.sync()
+ IStore(pub_source3).flush()
self.assertEqual(pub_source3.status, PackagePublishingStatus.PENDING)
def testPublishInAnotherArchive(self):
@@ -1113,7 +1114,7 @@ class TestNativePublishing(TestNativePublishingBase):
pub_source.publish(test_disk_pool, self.logger)
self.layer.commit()
- pub_source.sync()
+ IStore(pub_source).flush()
self.assertEqual(pub_source.status, PackagePublishingStatus.PUBLISHED)
self.assertEqual(
pub_source.sourcepackagerelease.upload_archive, cprov.archive
diff --git a/lib/lp/translations/model/vpoexport.py b/lib/lp/translations/model/vpoexport.py
index 33111ff..bca71df 100644
--- a/lib/lp/translations/model/vpoexport.py
+++ b/lib/lp/translations/model/vpoexport.py
@@ -59,7 +59,7 @@ class VPOExportSet:
SourcePackagePublishingHistory.distroseries == series,
SourcePackagePublishingHistory.component == Component.id,
POTemplate.sourcepackagename
- == SourcePackagePublishingHistory.sourcepackagenameID,
+ == SourcePackagePublishingHistory.sourcepackagename_id,
Component.name == component,
SourcePackagePublishingHistory.dateremoved == None,
SourcePackagePublishingHistory.archive
diff --git a/lib/lp/translations/scripts/copy_distroseries_translations.py b/lib/lp/translations/scripts/copy_distroseries_translations.py
index 81a66eb..78e6526 100644
--- a/lib/lp/translations/scripts/copy_distroseries_translations.py
+++ b/lib/lp/translations/scripts/copy_distroseries_translations.py
@@ -131,8 +131,8 @@ def copy_distroseries_translations(
status=active_publishing_status,
)
.config(distinct=True)
- .order_by(SourcePackagePublishingHistory.sourcepackagenameID)
- .values(SourcePackagePublishingHistory.sourcepackagenameID),
+ .order_by(SourcePackagePublishingHistory.sourcepackagename_id)
+ .values(SourcePackagePublishingHistory.sourcepackagename_id),
)
else:
spns = None