launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #03505
[Merge] lp:~julian-edwards/launchpad/slow-build-hunt-bug-777183 into lp:launchpad
Julian Edwards has proposed merging lp:~julian-edwards/launchpad/slow-build-hunt-bug-777183 into lp:launchpad.
Requested reviews:
William Grant (wgrant)
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #777183 in Launchpad itself: "SourcePackageRelease.getBuildByArch should not refer to distroseries.parent_series"
https://bugs.launchpad.net/launchpad/+bug/777183
For more details, see:
https://code.launchpad.net/~julian-edwards/launchpad/slow-build-hunt-bug-777183/+merge/59968
= Summary =
SourcePackageRelease.getBuildByArch should not refer to
distroseries.parent_series
== Pre-implementation notes ==
/me waves at wgrant
== Implementation details ==
Remove the crazy parent_series traversal and just query the whole distribution
instead, it's the same thing.
We didn't talk about the archive traversal, but I think it can go too. I've
restricted it to the context archive but XXXed a bug about fixing that for
derived distros.
I'm not too sad about losing the guadalinex archive inheritance at the moment,
we can model it as a proper derived distro later.
== Tests ==
bin/test -cvvt sourcepackagerelease-build-lookup.txt -t test_add_missing_builds
== Demo and Q/A ==
n/a
--
https://code.launchpad.net/~julian-edwards/launchpad/slow-build-hunt-bug-777183/+merge/59968
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/launchpad/slow-build-hunt-bug-777183 into lp:launchpad.
=== modified file 'lib/lp/soyuz/model/sourcepackagerelease.py'
--- lib/lp/soyuz/model/sourcepackagerelease.py 2011-03-24 11:38:50 +0000
+++ lib/lp/soyuz/model/sourcepackagerelease.py 2011-05-04 16:39:30 +0000
@@ -466,66 +466,24 @@
queries = [
"BinaryPackageBuild.package_build = PackageBuild.id AND "
"PackageBuild.build_farm_job = BuildFarmJob.id AND "
+ "DistroArchSeries.id = BinaryPackageBuild.distro_arch_series AND "
+ "PackageBuild.archive = %s AND "
+ "DistroArchSeries.architecturetag = %s AND "
"BinaryPackageBuild.source_package_release = %s" % (
- sqlvalues(self))]
-
- # Find out all the possible parent DistroArchSeries
- # a build could be issued (then inherited).
- parent_architectures = []
- archtag = distroarchseries.architecturetag
-
- if archive.purpose in MAIN_ARCHIVE_PURPOSES:
- # XXX cprov 20070720: this code belongs to IDistroSeries content
- # class as 'parent_series' property. Other parts of the system
- # can benefit of this, like SP.packagings, for instance.
- parent_series = []
- candidate = distroarchseries.distroseries
- while candidate is not None:
- parent_series.append(candidate)
- candidate = candidate.parent_series
-
- for series in parent_series:
- try:
- candidate = series[archtag]
- except NotFoundError:
- pass
- else:
- parent_architectures.append(candidate)
- # end-of-XXX.
- else:
- parent_architectures.append(distroarchseries)
-
- architectures = [
- architecture.id for architecture in parent_architectures]
- queries.append(
- "BinaryPackageBuild.distro_arch_series IN %s" % (
- sqlvalues(architectures)))
-
- # Follow archive inheritance across distribution offical archives,
- # for example:
- # guadalinex/foobar/PRIMARY was initialised from ubuntu/dapper/PRIMARY
- # guadalinex/foobar/PARTNER was initialised from ubuntu/dapper/PARTNER
- # and so on
- if archive.purpose in MAIN_ARCHIVE_PURPOSES:
- parent_archives = set()
- archive_set = getUtility(IArchiveSet)
- for series in parent_series:
- target_archive = archive_set.getByDistroPurpose(
- series.distribution, archive.purpose)
- parent_archives.add(target_archive)
- archives = [archive.id for archive in parent_archives]
- else:
- archives = [archive.id, ]
-
- queries.append(
- "PackageBuild.archive IN %s" % sqlvalues(archives))
+ sqlvalues(archive.id, distroarchseries.architecturetag, self))]
+
+ # XXX bigjools 2011-05-04 bug=777234
+ # We'll need exceptions in here for when we start initialising
+ # derived distros without rebuilding binaries. The matched
+ # archives will need to traverse the DistroSeriesParent tree.
# Query only the last build record for this sourcerelease
# across all possible locations.
query = " AND ".join(queries)
return BinaryPackageBuild.selectFirst(
- query, clauseTables=['BuildFarmJob', 'PackageBuild'],
+ query, clauseTables=[
+ 'BuildFarmJob', 'PackageBuild', 'DistroArchSeries'],
orderBy=['-BuildFarmJob.date_created'])
def override(self, component=None, section=None, urgency=None):
Follow ups