← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:fix-built-using-model into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:fix-built-using-model into launchpad:master.

Commit message:
Revert BinarySourceReference preloading

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/382878

An earlier version of my built-using-model branch used BinarySourceReference to construct Built-Using fields in build_binary_stanza_fields, and so needed to preload it.  However, the branch as landed put Built-Using in user_defined_fields instead, but I forgot to remove the corresponding preloading.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:fix-built-using-model into launchpad:master.
diff --git a/lib/lp/registry/model/distroseries.py b/lib/lp/registry/model/distroseries.py
index fefc8cd..a34eff1 100644
--- a/lib/lp/registry/model/distroseries.py
+++ b/lib/lp/registry/model/distroseries.py
@@ -124,7 +124,6 @@ from lp.services.propertycache import (
 from lp.services.worlddata.model.language import Language
 from lp.soyuz.enums import (
     ArchivePurpose,
-    BinarySourceReferenceType,
     IndexCompressionType,
     PackagePublishingStatus,
     PackageUploadStatus,
@@ -1139,9 +1138,6 @@ class DistroSeries(SQLBase, BugTargetBase, HasSpecificationsMixin,
 
     def getBinaryPackagePublishing(self, archtag, pocket, component, archive):
         """See `IDistroSeries`."""
-        # Circular import.
-        from lp.soyuz.model.binarysourcereference import BinarySourceReference
-
         bpphs = Store.of(self).find(
             BinaryPackagePublishingHistory,
             DistroArchSeries.distroseries == self,
@@ -1165,22 +1161,6 @@ class DistroSeries(SQLBase, BugTargetBase, HasSpecificationsMixin,
             bpbs = load_related(BinaryPackageBuild, bprs, ["buildID"])
             sprs = load_related(
                 SourcePackageRelease, bpbs, ["source_package_release_id"])
-
-            built_using_bsrs = load_referencing(
-                BinarySourceReference, bprs, ["binary_package_release_id"],
-                extra_conditions=[
-                    BinarySourceReference.reference_type ==
-                        BinarySourceReferenceType.BUILT_USING,
-                    ])
-            # Make sure this is initialised for all BPRs, as some may not
-            # have any BinarySourceReferences.
-            built_using_bsr_map = {bpr: [] for bpr in bprs}
-            for bsr in built_using_bsrs:
-                built_using_bsr_map[bsr.binary_package_release].append(bsr)
-            for bpr, bsrs in built_using_bsr_map.items():
-                get_property_cache(bpr).built_using_references = sorted(
-                    bsrs, key=attrgetter("id"))
-
             bpfs = load_referencing(
                 BinaryPackageFile, bprs, ["binarypackagereleaseID"])
             file_map = collections.defaultdict(list)