launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29567
[Merge] ~cjwatson/launchpad:stormify-package-files into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:stormify-package-files into launchpad:master.
Commit message:
Convert SourcePackageReleaseFile/BinaryPackageFile to Storm
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/436063
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:stormify-package-files into launchpad:master.
diff --git a/lib/lp/archivepublisher/artifactory.py b/lib/lp/archivepublisher/artifactory.py
index 5e81ee6..041e73e 100644
--- a/lib/lp/archivepublisher/artifactory.py
+++ b/lib/lp/archivepublisher/artifactory.py
@@ -142,11 +142,11 @@ class ArtifactoryPoolEntry:
"""
if ISourcePackageReleaseFile.providedBy(pub_file):
return "source:{:d}".format(
- pub_file.sourcepackagereleaseID
+ pub_file.sourcepackagerelease_id
) # type: ignore
elif IBinaryPackageFile.providedBy(pub_file):
return "binary:{:d}".format(
- pub_file.binarypackagereleaseID
+ pub_file.binarypackagerelease_id
) # type: ignore
else:
raise AssertionError("Unsupported file: %r" % pub_file)
diff --git a/lib/lp/archivepublisher/deathrow.py b/lib/lp/archivepublisher/deathrow.py
index 2d885e9..80f463e 100644
--- a/lib/lp/archivepublisher/deathrow.py
+++ b/lib/lp/archivepublisher/deathrow.py
@@ -178,7 +178,7 @@ class DeathRow:
SourcePackagePublishingHistory.archive == self.archive,
SourcePackagePublishingHistory.dateremoved == None,
SourcePackagePublishingHistory.sourcepackagerelease
- == SourcePackageReleaseFile.sourcepackagereleaseID,
+ == SourcePackageReleaseFile.sourcepackagerelease_id,
SourcePackageReleaseFile.libraryfile
== LibraryFileAlias.id,
]
@@ -189,7 +189,7 @@ class DeathRow:
BinaryPackagePublishingHistory.archive == self.archive,
BinaryPackagePublishingHistory.dateremoved == None,
BinaryPackagePublishingHistory.binarypackagerelease
- == BinaryPackageFile.binarypackagereleaseID,
+ == BinaryPackageFile.binarypackagerelease_id,
BinaryPackageFile.libraryfile == LibraryFileAlias.id,
]
)
diff --git a/lib/lp/archivepublisher/model/ftparchive.py b/lib/lp/archivepublisher/model/ftparchive.py
index 710fee5..a891a85 100644
--- a/lib/lp/archivepublisher/model/ftparchive.py
+++ b/lib/lp/archivepublisher/model/ftparchive.py
@@ -671,11 +671,11 @@ class FTPArchiveHandler:
Component.name,
)
join_conditions = [
- SourcePackageReleaseFile.sourcepackagereleaseID
+ SourcePackageReleaseFile.sourcepackagerelease_id
== SourcePackagePublishingHistory.sourcepackagereleaseID,
SourcePackageName.id
== SourcePackagePublishingHistory.sourcepackagenameID,
- LibraryFileAlias.id == SourcePackageReleaseFile.libraryfileID,
+ LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
Component.id == SourcePackagePublishingHistory.component_id,
]
select_conditions = [
@@ -713,11 +713,11 @@ class FTPArchiveHandler:
join_conditions = [
BinaryPackageRelease.id
== BinaryPackagePublishingHistory.binarypackagereleaseID,
- BinaryPackageFile.binarypackagereleaseID
+ BinaryPackageFile.binarypackagerelease_id
== BinaryPackagePublishingHistory.binarypackagereleaseID,
BinaryPackageBuild.id == BinaryPackageRelease.buildID,
SourcePackageName.id == BinaryPackageBuild.source_package_name_id,
- LibraryFileAlias.id == BinaryPackageFile.libraryfileID,
+ LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
DistroArchSeries.id
== BinaryPackagePublishingHistory.distroarchseriesID,
Component.id == BinaryPackagePublishingHistory.component_id,
diff --git a/lib/lp/registry/doc/distribution-mirror.rst b/lib/lp/registry/doc/distribution-mirror.rst
index 412d2bc..5fd9798 100644
--- a/lib/lp/registry/doc/distribution-mirror.rst
+++ b/lib/lp/registry/doc/distribution-mirror.rst
@@ -682,8 +682,13 @@ so we need to skip that upload.
... time_interval, deb_only=False
... )
- >>> bpf = BinaryPackageFile.selectOneBy(
- ... binarypackagereleaseID=upload.binarypackagerelease.id
+ >>> bpf = (
+ ... IStore(BinaryPackageFile)
+ ... .find(
+ ... BinaryPackageFile,
+ ... binarypackagerelease=upload.binarypackagerelease,
+ ... )
+ ... .one()
... )
>>> print(upload.binarypackagerelease.version)
3.14156
diff --git a/lib/lp/registry/model/distributionmirror.py b/lib/lp/registry/model/distributionmirror.py
index 317d440..7e350cf 100644
--- a/lib/lp/registry/model/distributionmirror.py
+++ b/lib/lp/registry/model/distributionmirror.py
@@ -981,7 +981,7 @@ class MirrorDistroArchSeries(StormBase, _MirrorSeriesMixIn):
clauses.extend(
[
BinaryPackagePublishingHistory.binarypackagereleaseID
- == BinaryPackageFile.binarypackagereleaseID,
+ == BinaryPackageFile.binarypackagerelease_id,
BinaryPackageFile.filetype == BinaryPackageFileType.DEB,
]
)
diff --git a/lib/lp/services/librarian/model.py b/lib/lp/services/librarian/model.py
index 210ffcf..7aaf5de 100644
--- a/lib/lp/services/librarian/model.py
+++ b/lib/lp/services/librarian/model.py
@@ -16,7 +16,7 @@ from urllib.parse import urlparse
import pytz
from lazr.delegates import delegate_to
-from storm.locals import Date, Desc, Int, Reference, Store
+from storm.locals import Date, Desc, Int, Reference, ReferenceSet, Store
from zope.component import adapter, getUtility
from zope.interface import Interface, implementer
@@ -88,11 +88,11 @@ class LibraryFileAlias(SQLBase):
intermediateTable="ProductReleaseFile",
)
- sourcepackages = SQLRelatedJoin(
- "SourcePackageRelease",
- joinColumn="libraryfile",
- otherColumn="sourcepackagerelease",
- intermediateTable="SourcePackageReleaseFile",
+ sourcepackages = ReferenceSet(
+ "id",
+ "SourcePackageReleaseFile.libraryfile_id",
+ "SourcePackageReleaseFile.sourcepackagerelease_id",
+ "SourcePackageRelease.id",
)
@property
@@ -206,11 +206,11 @@ class LibraryFileAlias(SQLBase):
intermediateTable="ProductReleaseFile",
)
- sourcepackages = SQLRelatedJoin(
- "SourcePackageRelease",
- joinColumn="libraryfile",
- otherColumn="sourcepackagerelease",
- intermediateTable="SourcePackageReleaseFile",
+ sourcepackages = ReferenceSet(
+ "id",
+ "SourcePackageReleaseFile.libraryfile_id",
+ "SourcePackageReleaseFile.sourcepackagerelease_id",
+ "SourcePackageRelease.id",
)
@property
diff --git a/lib/lp/soyuz/browser/queue.py b/lib/lp/soyuz/browser/queue.py
index 2fbcc60..7f12bd3 100644
--- a/lib/lp/soyuz/browser/queue.py
+++ b/lib/lp/soyuz/browser/queue.py
@@ -225,13 +225,13 @@ class QueueItemsView(LaunchpadView):
bpbs = load_related(BinaryPackageBuild, pubs, ["build_id"])
bprs = load_referencing(BinaryPackageRelease, bpbs, ["buildID"])
source_files = load_referencing(
- SourcePackageReleaseFile, source_sprs, ["sourcepackagereleaseID"]
+ SourcePackageReleaseFile, source_sprs, ["sourcepackagerelease_id"]
)
binary_files = load_referencing(
- BinaryPackageFile, bprs, ["binarypackagereleaseID"]
+ BinaryPackageFile, bprs, ["binarypackagerelease_id"]
)
file_lfas = load_related(
- LibraryFileAlias, source_files + binary_files, ["libraryfileID"]
+ LibraryFileAlias, source_files + binary_files, ["libraryfile_id"]
)
load_related(LibraryFileContent, file_lfas, ["contentID"])
diff --git a/lib/lp/soyuz/doc/build-files.rst b/lib/lp/soyuz/doc/build-files.rst
index a73a7d8..554f85a 100644
--- a/lib/lp/soyuz/doc/build-files.rst
+++ b/lib/lp/soyuz/doc/build-files.rst
@@ -79,6 +79,6 @@ We can also retrieve the corresponding BinaryPackageFile:
>>> bpf = build.getBinaryPackageFileByName("test_1.0_all.deb")
>>> bpf
- <BinaryPackageFile ...>
+ <...BinaryPackageFile object ...>
>>> bpf.libraryfile == deb
True
diff --git a/lib/lp/soyuz/doc/gina.rst b/lib/lp/soyuz/doc/gina.rst
index 9d78622..5d5f0c9 100644
--- a/lib/lp/soyuz/doc/gina.rst
+++ b/lib/lp/soyuz/doc/gina.rst
@@ -328,8 +328,10 @@ And check that its files actually ended up in the librarian (these sha1sums
were calculated directly on the files):
>>> from lp.soyuz.model.files import SourcePackageReleaseFile
- >>> files = SourcePackageReleaseFile.selectBy(
- ... sourcepackagereleaseID=cap.id, orderBy="libraryfile"
+ >>> files = (
+ ... IStore(SourcePackageReleaseFile)
+ ... .find(SourcePackageReleaseFile, sourcepackagerelease=cap)
+ ... .order_by("libraryfile")
... )
>>> for f in files:
... print(f.libraryfile.content.sha1)
diff --git a/lib/lp/soyuz/interfaces/files.py b/lib/lp/soyuz/interfaces/files.py
index 033afd9..85c7d37 100644
--- a/lib/lp/soyuz/interfaces/files.py
+++ b/lib/lp/soyuz/interfaces/files.py
@@ -24,7 +24,7 @@ class IPackageReleaseFile(Interface):
id = Int(title=_("ID"), required=True, readonly=True)
- libraryfileID = Int(
+ libraryfile_id = Int(
title=_("The LibraryFileAlias id for this file"),
required=True,
readonly=True,
@@ -52,7 +52,7 @@ class IBinaryPackageFile(IPackageReleaseFile):
readonly=False,
)
- binarypackagereleaseID = Int(
+ binarypackagerelease_id = Int(
title=_("ID of the binary package release being published"),
required=True,
readonly=False,
@@ -69,7 +69,7 @@ class ISourcePackageReleaseFile(IPackageReleaseFile):
readonly=False,
)
- sourcepackagereleaseID = Int(
+ sourcepackagerelease_id = Int(
title=_("ID of the source package release being published"),
required=True,
readonly=False,
diff --git a/lib/lp/soyuz/model/archive.py b/lib/lp/soyuz/model/archive.py
index c04e77f..b74321f 100644
--- a/lib/lp/soyuz/model/archive.py
+++ b/lib/lp/soyuz/model/archive.py
@@ -870,8 +870,8 @@ class Archive(SQLBase):
SourcePackagePublishingHistory.archive == self.id,
SourcePackagePublishingHistory.dateremoved == None,
SourcePackagePublishingHistory.sourcepackagereleaseID
- == SourcePackageReleaseFile.sourcepackagereleaseID,
- SourcePackageReleaseFile.libraryfileID == LibraryFileAlias.id,
+ == SourcePackageReleaseFile.sourcepackagerelease_id,
+ SourcePackageReleaseFile.libraryfile_id == LibraryFileAlias.id,
LibraryFileAlias.contentID == LibraryFileContent.id,
)
@@ -1159,8 +1159,8 @@ class Archive(SQLBase):
BinaryPackagePublishingHistory.archive == self.id,
BinaryPackagePublishingHistory.dateremoved == None,
BinaryPackagePublishingHistory.binarypackagereleaseID
- == BinaryPackageFile.binarypackagereleaseID,
- BinaryPackageFile.libraryfileID == LibraryFileAlias.id,
+ == BinaryPackageFile.binarypackagerelease_id,
+ BinaryPackageFile.libraryfile_id == LibraryFileAlias.id,
LibraryFileAlias.contentID == LibraryFileContent.id,
)
# See `IArchive.sources_size`.
@@ -1952,15 +1952,15 @@ class Archive(SQLBase):
clauses = (
SourcePackagePublishingHistory.archive == self.id,
SourcePackagePublishingHistory.sourcepackagereleaseID
- == SourcePackageReleaseFile.sourcepackagereleaseID,
- SourcePackageReleaseFile.libraryfileID == LibraryFileAlias.id,
+ == SourcePackageReleaseFile.sourcepackagerelease_id,
+ SourcePackageReleaseFile.libraryfile_id == LibraryFileAlias.id,
)
elif re_isadeb.match(filename):
clauses = (
BinaryPackagePublishingHistory.archive == self.id,
BinaryPackagePublishingHistory.binarypackagereleaseID
- == BinaryPackageFile.binarypackagereleaseID,
- BinaryPackageFile.libraryfileID == LibraryFileAlias.id,
+ == BinaryPackageFile.binarypackagerelease_id,
+ BinaryPackageFile.libraryfile_id == LibraryFileAlias.id,
)
elif filename.endswith(".changes"):
clauses = (
@@ -2013,8 +2013,8 @@ class Archive(SQLBase):
SourcePackageName.name == name,
Cast(SourcePackageRelease.version, "text") == version,
SourcePackageRelease.id
- == SourcePackageReleaseFile.sourcepackagereleaseID,
- SourcePackageReleaseFile.libraryfileID == LibraryFileAlias.id,
+ == SourcePackageReleaseFile.sourcepackagerelease_id,
+ SourcePackageReleaseFile.libraryfile_id == LibraryFileAlias.id,
LibraryFileAlias.filename == filename,
LibraryFileAlias.content != None,
)
@@ -2061,7 +2061,7 @@ class Archive(SQLBase):
BinaryPackageBuild.source_package_name
== SourcePackageName.id,
BinaryPackagePublishingHistory.binarypackagerelease
- == BinaryPackageFile.binarypackagereleaseID,
+ == BinaryPackageFile.binarypackagerelease_id,
]
)
else:
@@ -2072,7 +2072,7 @@ class Archive(SQLBase):
SourcePackagePublishingHistory.sourcepackagename
== SourcePackageName.id,
SourcePackagePublishingHistory.sourcepackagerelease
- == SourcePackageReleaseFile.sourcepackagereleaseID,
+ == SourcePackageReleaseFile.sourcepackagerelease_id,
]
)
clauses.extend(
@@ -2120,9 +2120,9 @@ class Archive(SQLBase):
IStore(BinaryPackageRelease)
.find(
BinaryPackageRelease,
- BinaryPackageFile.binarypackagereleaseID
+ BinaryPackageFile.binarypackagerelease_id
== BinaryPackageRelease.id,
- BinaryPackageFile.libraryfileID == LibraryFileAlias.id,
+ BinaryPackageFile.libraryfile_id == LibraryFileAlias.id,
LibraryFileAlias.filename == filename,
BinaryPackagePublishingHistory.archive == self,
BinaryPackagePublishingHistory.binarypackagereleaseID
@@ -2855,8 +2855,8 @@ class Archive(SQLBase):
(LibraryFileAlias.filename, LibraryFileContent.sha1),
SourcePackagePublishingHistory.archive == self,
SourcePackagePublishingHistory.sourcepackagerelease
- == SourcePackageReleaseFile.sourcepackagereleaseID,
- LibraryFileAlias.id == SourcePackageReleaseFile.libraryfileID,
+ == SourcePackageReleaseFile.sourcepackagerelease_id,
+ LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
LibraryFileAlias.filename.is_in(source_files),
LibraryFileContent.id == LibraryFileAlias.contentID,
)
diff --git a/lib/lp/soyuz/model/binarypackagebuild.py b/lib/lp/soyuz/model/binarypackagebuild.py
index a8d4352..5471460 100644
--- a/lib/lp/soyuz/model/binarypackagebuild.py
+++ b/lib/lp/soyuz/model/binarypackagebuild.py
@@ -436,8 +436,8 @@ class BinaryPackageBuild(PackageBuildMixin, SQLBase):
),
BinaryPackageRelease.build == self,
BinaryPackageRelease.id
- == BinaryPackageFile.binarypackagereleaseID,
- LibraryFileAlias.id == BinaryPackageFile.libraryfileID,
+ == BinaryPackageFile.binarypackagerelease_id,
+ LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
LibraryFileContent.id == LibraryFileAlias.contentID,
)
return result.order_by(
@@ -796,7 +796,7 @@ class BinaryPackageBuild(PackageBuildMixin, SQLBase):
BinaryPackageRelease.build == self.id,
BinaryPackageFile.binarypackagerelease
== BinaryPackageRelease.id,
- LibraryFileAlias.id == BinaryPackageFile.libraryfileID,
+ LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
LibraryFileAlias.filename == filename,
)
.one()
@@ -1576,7 +1576,7 @@ class BinaryPackageBuildMacaroonIssuer(MacaroonIssuerBase):
clauses.extend(
[
BinaryPackageBuild.source_package_release_id
- == SourcePackageReleaseFile.sourcepackagereleaseID,
+ == SourcePackageReleaseFile.sourcepackagerelease_id,
SourcePackageReleaseFile.libraryfile == context,
]
)
diff --git a/lib/lp/soyuz/model/files.py b/lib/lp/soyuz/model/files.py
index a54a779..4145321 100644
--- a/lib/lp/soyuz/model/files.py
+++ b/lib/lp/soyuz/model/files.py
@@ -7,12 +7,12 @@ __all__ = [
"SourcePackageReleaseFile",
]
+from storm.locals import Int, Reference
from zope.interface import implementer
from lp.registry.interfaces.sourcepackage import SourcePackageFileType
from lp.services.database.enumcol import DBEnum
-from lp.services.database.sqlbase import SQLBase
-from lp.services.database.sqlobject import ForeignKey
+from lp.services.database.stormbase import StormBase
from lp.soyuz.enums import BinaryPackageFileType
from lp.soyuz.interfaces.files import (
IBinaryPackageFile,
@@ -21,20 +21,29 @@ from lp.soyuz.interfaces.files import (
@implementer(IBinaryPackageFile)
-class BinaryPackageFile(SQLBase):
+class BinaryPackageFile(StormBase):
"""See IBinaryPackageFile"""
- _table = "BinaryPackageFile"
+ __storm_table__ = "BinaryPackageFile"
- binarypackagerelease = ForeignKey(
- dbName="binarypackagerelease",
- foreignKey="BinaryPackageRelease",
- notNull=True,
+ id = Int(primary=True)
+ binarypackagerelease_id = Int(
+ name="binarypackagerelease", allow_none=False
)
- libraryfile = ForeignKey(
- dbName="libraryfile", foreignKey="LibraryFileAlias", notNull=True
+ binarypackagerelease = Reference(
+ binarypackagerelease_id, "BinaryPackageRelease.id"
)
- filetype = DBEnum(name="filetype", enum=BinaryPackageFileType)
+ libraryfile_id = Int(name="libraryfile", allow_none=False)
+ libraryfile = Reference(libraryfile_id, "LibraryFileAlias.id")
+ filetype = DBEnum(
+ name="filetype", enum=BinaryPackageFileType, allow_none=False
+ )
+
+ def __init__(self, binarypackagerelease, libraryfile, filetype):
+ super().__init__()
+ self.binarypackagerelease = binarypackagerelease
+ self.libraryfile = libraryfile
+ self.filetype = filetype
class SourceFileMixin:
@@ -51,13 +60,26 @@ class SourceFileMixin:
@implementer(ISourcePackageReleaseFile)
-class SourcePackageReleaseFile(SourceFileMixin, SQLBase):
+class SourcePackageReleaseFile(SourceFileMixin, StormBase):
"""See ISourcePackageFile"""
- sourcepackagerelease = ForeignKey(
- foreignKey="SourcePackageRelease", dbName="sourcepackagerelease"
+ __storm_table__ = "SourcePackageReleaseFile"
+
+ id = Int(primary=True)
+ sourcepackagerelease_id = Int(
+ name="sourcepackagerelease", allow_none=False
)
- libraryfile = ForeignKey(
- foreignKey="LibraryFileAlias", dbName="libraryfile"
+ sourcepackagerelease = Reference(
+ sourcepackagerelease_id, "SourcePackageRelease.id"
)
- filetype = DBEnum(enum=SourcePackageFileType)
+ libraryfile_id = Int(name="libraryfile", allow_none=False)
+ libraryfile = Reference(libraryfile_id, "LibraryFileAlias.id")
+ filetype = DBEnum(
+ name="filetype", enum=SourcePackageFileType, allow_none=False
+ )
+
+ def __init__(self, sourcepackagerelease, libraryfile, filetype):
+ super().__init__()
+ self.sourcepackagerelease = sourcepackagerelease
+ self.libraryfile = libraryfile
+ self.filetype = filetype
diff --git a/lib/lp/soyuz/model/packagediff.py b/lib/lp/soyuz/model/packagediff.py
index 92677ef..1eb35fe 100644
--- a/lib/lp/soyuz/model/packagediff.py
+++ b/lib/lp/soyuz/model/packagediff.py
@@ -195,10 +195,10 @@ class PackageDiff(StormBase):
IStore(LibraryFileAlias)
.find(
LibraryFileAlias.id,
- SourcePackageReleaseFile.sourcepackagereleaseID.is_in(
+ SourcePackageReleaseFile.sourcepackagerelease_id.is_in(
(self.from_source_id, self.to_source_id)
),
- SourcePackageReleaseFile.libraryfileID == LibraryFileAlias.id,
+ SourcePackageReleaseFile.libraryfile_id == LibraryFileAlias.id,
LibraryFileAlias.content == None,
)
.count()
diff --git a/lib/lp/soyuz/model/publishing.py b/lib/lp/soyuz/model/publishing.py
index 1df1fa6..b2f7a9d 100644
--- a/lib/lp/soyuz/model/publishing.py
+++ b/lib/lp/soyuz/model/publishing.py
@@ -385,7 +385,7 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
bpfs = list(
Store.of(self).find(
BinaryPackageFile,
- BinaryPackageFile.binarypackagereleaseID.is_in(bpr_ids),
+ BinaryPackageFile.binarypackagerelease_id.is_in(bpr_ids),
)
)
bpfs_by_bpr = defaultdict(list)
@@ -395,7 +395,7 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
get_property_cache(bpr).files = bpfs_by_bpr[bpr]
# Preload LibraryFileAliases.
- lfa_ids = {bpf.libraryfileID for bpf in bpfs}
+ lfa_ids = {bpf.libraryfile_id for bpf in bpfs}
list(
Store.of(self).find(
LibraryFileAlias, LibraryFileAlias.id.is_in(lfa_ids)
@@ -476,7 +476,7 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
def files(self):
"""See `IPublishing`."""
files = self.sourcepackagerelease.files
- lfas = bulk.load_related(LibraryFileAlias, files, ["libraryfileID"])
+ lfas = bulk.load_related(LibraryFileAlias, files, ["libraryfile_id"])
bulk.load_related(LibraryFileContent, lfas, ["contentID"])
return files
@@ -659,7 +659,7 @@ class SourcePackagePublishingHistory(SQLBase, ArchivePublisherBase):
sources = Store.of(self).find(
(LibraryFileAlias, LibraryFileContent),
LibraryFileContent.id == LibraryFileAlias.contentID,
- LibraryFileAlias.id == SourcePackageReleaseFile.libraryfileID,
+ LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
SourcePackageReleaseFile.sourcepackagerelease
== self.sourcepackagereleaseID,
)
@@ -834,7 +834,7 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
def files(self):
"""See `IPublishing`."""
files = self.binarypackagerelease.files
- lfas = bulk.load_related(LibraryFileAlias, files, ["libraryfileID"])
+ lfas = bulk.load_related(LibraryFileAlias, files, ["libraryfile_id"])
bulk.load_related(LibraryFileContent, lfas, ["contentID"])
return files
@@ -1254,7 +1254,7 @@ class BinaryPackagePublishingHistory(SQLBase, ArchivePublisherBase):
binaries = Store.of(self).find(
(LibraryFileAlias, LibraryFileContent),
LibraryFileContent.id == LibraryFileAlias.contentID,
- LibraryFileAlias.id == BinaryPackageFile.libraryfileID,
+ LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
BinaryPackageFile.binarypackagerelease
== self.binarypackagereleaseID,
)
@@ -1848,7 +1848,7 @@ class PublishingSet:
LibraryFileContent,
),
LibraryFileContent.id == LibraryFileAlias.contentID,
- LibraryFileAlias.id == BinaryPackageFile.libraryfileID,
+ LibraryFileAlias.id == BinaryPackageFile.libraryfile_id,
BinaryPackageFile.binarypackagerelease == BinaryPackageRelease.id,
BinaryPackageRelease.buildID == BinaryPackageBuild.id,
SourcePackagePublishingHistory.sourcepackagereleaseID
@@ -1876,7 +1876,7 @@ class PublishingSet:
LibraryFileContent,
),
LibraryFileContent.id == LibraryFileAlias.contentID,
- LibraryFileAlias.id == SourcePackageReleaseFile.libraryfileID,
+ LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
SourcePackageReleaseFile.sourcepackagerelease
== SourcePackagePublishingHistory.sourcepackagereleaseID,
SourcePackagePublishingHistory.id.is_in(source_publication_ids),
@@ -2005,11 +2005,11 @@ class PublishingSet:
IStore(SourcePackageReleaseFile)
.find(
SourcePackageReleaseFile,
- SourcePackageReleaseFile.sourcepackagereleaseID.is_in(
+ SourcePackageReleaseFile.sourcepackagerelease_id.is_in(
spr_ids
),
)
- .order_by(SourcePackageReleaseFile.libraryfileID)
+ .order_by(SourcePackageReleaseFile.libraryfile_id)
)
file_map = defaultdict(list)
for sprf in sprfs:
@@ -2017,7 +2017,7 @@ class PublishingSet:
for spr, files in file_map.items():
get_property_cache(spr).files = files
lfas = bulk.load_related(
- LibraryFileAlias, sprfs, ["libraryfileID"]
+ LibraryFileAlias, sprfs, ["libraryfile_id"]
)
bulk.load_related(LibraryFileContent, lfas, ["contentID"])
@@ -2063,14 +2063,16 @@ class PublishingSet:
SourcePackageRelease, bpbs, ["source_package_release_id"]
)
bpfs = bulk.load_referencing(
- BinaryPackageFile, bprs, ["binarypackagereleaseID"]
+ BinaryPackageFile, bprs, ["binarypackagerelease_id"]
)
file_map = defaultdict(list)
for bpf in bpfs:
file_map[bpf.binarypackagerelease].append(bpf)
for bpr, files in file_map.items():
get_property_cache(bpr).files = files
- lfas = bulk.load_related(LibraryFileAlias, bpfs, ["libraryfileID"])
+ lfas = bulk.load_related(
+ LibraryFileAlias, bpfs, ["libraryfile_id"]
+ )
bulk.load_related(LibraryFileContent, lfas, ["contentID"])
bulk.load_related(SourcePackageName, sprs, ["sourcepackagenameID"])
bulk.load_related(BinaryPackageName, bprs, ["binarypackagenameID"])
diff --git a/lib/lp/soyuz/model/sourcepackagerelease.py b/lib/lp/soyuz/model/sourcepackagerelease.py
index 0dcd8da..9cb4baf 100644
--- a/lib/lp/soyuz/model/sourcepackagerelease.py
+++ b/lib/lp/soyuz/model/sourcepackagerelease.py
@@ -305,7 +305,7 @@ class SourcePackageRelease(SQLBase):
return list(
Store.of(self)
.find(SourcePackageReleaseFile, sourcepackagerelease=self)
- .order_by(SourcePackageReleaseFile.libraryfileID)
+ .order_by(SourcePackageReleaseFile.libraryfile_id)
)
def getFileByName(self, filename):
@@ -315,7 +315,7 @@ class SourcePackageRelease(SQLBase):
.find(
SourcePackageReleaseFile,
SourcePackageReleaseFile.sourcepackagerelease == self.id,
- LibraryFileAlias.id == SourcePackageReleaseFile.libraryfileID,
+ LibraryFileAlias.id == SourcePackageReleaseFile.libraryfile_id,
LibraryFileAlias.filename == filename,
)
.one()
diff --git a/lib/lp/soyuz/scripts/expire_archive_files.py b/lib/lp/soyuz/scripts/expire_archive_files.py
index ed91efc..ef82fef 100755
--- a/lib/lp/soyuz/scripts/expire_archive_files.py
+++ b/lib/lp/soyuz/scripts/expire_archive_files.py
@@ -126,7 +126,7 @@ class ArchiveExpirer(LaunchpadCronScript):
),
)
denied = Select(
- xPF.libraryfileID,
+ xPF.libraryfile_id,
where=And(
xPR_join,
xPPH.archive == Archive.id,
diff --git a/lib/lp/soyuz/scripts/gina/handlers.py b/lib/lp/soyuz/scripts/gina/handlers.py
index 1e0ff96..a595340 100644
--- a/lib/lp/soyuz/scripts/gina/handlers.py
+++ b/lib/lp/soyuz/scripts/gina/handlers.py
@@ -916,7 +916,7 @@ class BinaryPackageHandler:
alias = getLibraryAlias(path, fname)
BinaryPackageFile(
- binarypackagerelease=binpkg.id,
+ binarypackagerelease=binpkg,
libraryfile=alias,
filetype=determine_binary_file_type(fname),
)