Merge lp:~jtv/launchpad/pre-832647 into lp:launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: William Grant
Approved revision: no longer in the source branch.
Merged at revision: 13911
Proposed branch: lp:~jtv/launchpad/pre-832647
Merge into: lp:launchpad
Diff against target: 502 lines (+280/-65)
5 files modified
lib/lp/archivepublisher/domination.py (+122/-50)
lib/lp/archivepublisher/tests/test_dominator.py (+150/-2)
lib/lp/soyuz/interfaces/publishing.py (+0/-3)
lib/lp/soyuz/model/publishing.py (+4/-4)
scripts/gina.py (+4/-6)
To merge this branch: bzr merge lp:~jtv/launchpad/pre-832647
Reviewer Review Type Date Requested Status
William Grant code Approve
Review via email: mp+74087@code.launchpad.net

Commit message

[r=wgrant][bug=832647] Rearrange bits of domcination and gina.

Description of the change

= Summary =

Moving some code about to prepare for the introduction of domination into gina.

== Pre-implementation notes ==

This is the product of extensive discussions with William and Julian, but I'm sort of empty right now and can't reproduce it all! The upshot of it is that they both think what I'm trying to do in the larger picture would work.

== Implementation details ==

The gina changes aren't very important; they're basically just putting the horse back before the cart.

Then there's the publisher changes: a base class has 2 child classes, BPPH and SPPH. (Or more formally, BinaryPackagePublishingHistory and SourcePackagePublishingHistory). Each of these 3 classes has a method “supersede,” with the two derived-class methods calling the base-class one. The base class is never instantiated, so there's really no reason to give its method the same name. I renamed it “setSuperseded” to match the new structure of requestDeletion calling setDeleted.

But the main course is in the dominator. Code in this class is very aggressively unified between BPPH and SPPH. That makes it a little harder to work with. I extracted the specializations away underneath a separate class, really a sub-module of helper functions that hide the differences between BPPH and SPPH. And finally I extracted a few smaller helpers that exploratory coding reveals a need for, and which I think help make the code more readable.

== Tests ==

{{{
./bin/test -vvc lp.archivepublisher
./bin/test -vvc lp.soyuz
}}}

= Launchpad lint =

Nothing to do about the remaining lint, I think; it was all present before I started. Last I heard, someone or other was working to retract the "two spaces" rule so I did nothing about them.

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/lp/archivepublisher/domination.py
  lib/lp/soyuz/model/publishing.py
  lib/lp/soyuz/interfaces/publishing.py
  scripts/gina.py
  lib/lp/archivepublisher/tests/test_dominator.py

./lib/lp/soyuz/interfaces/publishing.py
     381: E261 at least two spaces before inline comment
     478: E261 at least two spaces before inline comment
     511: E261 at least two spaces before inline comment
     681: E261 at least two spaces before inline comment
     767: E261 at least two spaces before inline comment
./scripts/gina.py
      26: '_pythonpath' imported but unused

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) wrote :

189 + def _composeActiveSourcePubsCondition(self, distroseries, pocket):

It seems slightly odd to have this take distroseries and pocket, but grab archive from self. This is a common problem in Soyuz, since archives didn't exist when most of it was written. Something to think about, maybe.

234 + And(join_spr_spn(), join_spph_spr(), spph_location_clauses),

This would possibly be clearer if the order of arguments was reversed. The (SPR, SPN) -> (SPPH, SPR) -> SPPH chaining takes a while to pick up here.

319 + def listCreaitonDates(self, spphs):

Unused and misspelled :(

review: Approve (code)
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

> 189 + def _composeActiveSourcePubsCondition(self, distroseries, pocket):
>
> It seems slightly odd to have this take distroseries and pocket, but grab
> archive from self. This is a common problem in Soyuz, since archives didn't
> exist when most of it was written. Something to think about, maybe.

It did not escape notice. But the API reflects the current API of the dominator itself, and will have to rearranged in conjunction with it.

> 234 + And(join_spr_spn(), join_spph_spr(), spph_location_clauses),
>
> This would possibly be clearer if the order of arguments was reversed. The
> (SPR, SPN) -> (SPPH, SPR) -> SPPH chaining takes a while to pick up here.

True, it helps. I switched the first two around, but kept join conditions before selection conditions.

> 319 + def listCreaitonDates(self, spphs):
>
> Unused and misspelled :(

Removed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'lib/lp/archivepublisher/domination.py'
--- lib/lp/archivepublisher/domination.py 2011-08-30 06:37:55 +0000
+++ lib/lp/archivepublisher/domination.py 2011-09-05 12:08:08 +0000
@@ -53,8 +53,6 @@
53__all__ = ['Dominator']53__all__ = ['Dominator']
5454
55from datetime import timedelta55from datetime import timedelta
56import functools
57import operator
5856
59import apt_pkg57import apt_pkg
60from storm.expr import (58from storm.expr import (
@@ -68,7 +66,7 @@
68 flush_database_updates,66 flush_database_updates,
69 sqlvalues,67 sqlvalues,
70 )68 )
71from canonical.launchpad.interfaces.lpstorm import IMasterStore69from canonical.launchpad.interfaces.lpstorm import IStore
72from lp.registry.model.sourcepackagename import SourcePackageName70from lp.registry.model.sourcepackagename import SourcePackageName
73from lp.soyuz.enums import (71from lp.soyuz.enums import (
74 BinaryPackageFormat,72 BinaryPackageFormat,
@@ -87,17 +85,93 @@
87apt_pkg.InitSystem()85apt_pkg.InitSystem()
8886
8987
90def _compare_packages_by_version_and_date(get_release, p1, p2):88def join_spr_spn():
91 """Compare publications p1 and p2 by their version; using Debian rules.89 """Join condition: SourcePackageRelease/SourcePackageName."""
9290 return (
93 If the publications are for the same package, compare by datecreated91 SourcePackageName.id == SourcePackageRelease.sourcepackagenameID)
94 instead. This lets newer records win.92
95 """93
96 if get_release(p1).id == get_release(p2).id:94def join_spph_spr():
97 return cmp(p1.datecreated, p2.datecreated)95 """Join condition: SourcePackageRelease/SourcePackagePublishingHistory.
9896 """
99 return apt_pkg.VersionCompare(get_release(p1).version,97 # Avoid circular imports.
100 get_release(p2).version)98 from lp.soyuz.model.publishing import SourcePackagePublishingHistory
99
100 return (
101 SourcePackageRelease.id ==
102 SourcePackagePublishingHistory.sourcepackagereleaseID)
103
104
105class SourcePublicationTraits:
106 """Basic generalized attributes for `SourcePackagePublishingHistory`.
107
108 Used by `GeneralizedPublication` to hide the differences from
109 `BinaryPackagePublishingHistory`.
110 """
111 @staticmethod
112 def getPackageName(spph):
113 """Return the name of this publication's source package."""
114 return spph.sourcepackagerelease.sourcepackagename.name
115
116 @staticmethod
117 def getPackageRelease(spph):
118 """Return this publication's `SourcePackageRelease`."""
119 return spph.sourcepackagerelease
120
121
122class BinaryPublicationTraits:
123 """Basic generalized attributes for `BinaryPackagePublishingHistory`.
124
125 Used by `GeneralizedPublication` to hide the differences from
126 `SourcePackagePublishingHistory`.
127 """
128 @staticmethod
129 def getPackageName(bpph):
130 """Return the name of this publication's binary package."""
131 return bpph.binarypackagerelease.binarypackagename.name
132
133 @staticmethod
134 def getPackageRelease(bpph):
135 """Return this publication's `BinaryPackageRelease`."""
136 return bpph.binarypackagerelease
137
138
139class GeneralizedPublication:
140 """Generalize handling of publication records.
141
142 This allows us to write code that can be dealing with either
143 `SourcePackagePublishingHistory`s or `BinaryPackagePublishingHistory`s
144 without caring which. Differences are abstracted away in a traits
145 class.
146 """
147 def __init__(self, is_source=True):
148 if is_source:
149 self.traits = SourcePublicationTraits
150 else:
151 self.traits = BinaryPublicationTraits
152
153 def getPackageName(self, pub):
154 """Get the package's name."""
155 return self.traits.getPackageName(pub)
156
157 def getPackageVersion(self, pub):
158 """Obtain the version string for a publicaiton record."""
159 return self.traits.getPackageRelease(pub).version
160
161 def compare(self, pub1, pub2):
162 """Compare publications by version.
163
164 If both publications are for the same version, their creation dates
165 break the tie.
166 """
167 version_comparison = apt_pkg.VersionCompare(
168 self.getPackageVersion(pub1), self.getPackageVersion(pub2))
169
170 if version_comparison == 0:
171 # Use dates as tie breaker.
172 return cmp(pub1.datecreated, pub2.datecreated)
173 else:
174 return version_comparison
101175
102176
103class Dominator:177class Dominator:
@@ -125,11 +199,10 @@
125 """199 """
126 self.logger.debug("Dominating packages...")200 self.logger.debug("Dominating packages...")
127201
128 for name in pubs.keys():202 for name, publications in pubs.iteritems():
129 assert pubs[name], (203 assert publications, "Empty list of publications for %s." % name
130 "Empty list of publications for %s" % name)204 for pubrec in publications[1:]:
131 for pubrec in pubs[name][1:]:205 pubrec.supersede(publications[0], logger=self.logger)
132 pubrec.supersede(pubs[name][0], logger=self.logger)
133206
134 def _sortPackages(self, pkglist, is_source=True):207 def _sortPackages(self, pkglist, is_source=True):
135 """Map out packages by name, and sort by descending version.208 """Map out packages by name, and sort by descending version.
@@ -139,27 +212,20 @@
139 :param is_source: Whether this call involves source package212 :param is_source: Whether this call involves source package
140 publications. If so, work with `SourcePackagePublishingHistory`.213 publications. If so, work with `SourcePackagePublishingHistory`.
141 If not, work with `BinaryPackagepublishingHistory`.214 If not, work with `BinaryPackagepublishingHistory`.
142 :return: A dict mapping each package name (as UTF-8 encoded string)215 :return: A dict mapping each package name to a list of publications
143 to a list of publications from `pkglist`, newest first.216 from `pkglist`, newest first.
144 """217 """
145 self.logger.debug("Sorting packages...")218 self.logger.debug("Sorting packages...")
146219
147 if is_source:220 generalization = GeneralizedPublication(is_source)
148 get_release = operator.attrgetter("sourcepackagerelease")
149 get_name = operator.attrgetter("sourcepackagename")
150 else:
151 get_release = operator.attrgetter("binarypackagerelease")
152 get_name = operator.attrgetter("binarypackagename")
153221
154 outpkgs = {}222 outpkgs = {}
155 for inpkg in pkglist:223 for inpkg in pkglist:
156 key = get_name(get_release(inpkg)).name.encode('utf-8')224 key = generalization.getPackageName(inpkg)
157 outpkgs.setdefault(key, []).append(inpkg)225 outpkgs.setdefault(key, []).append(inpkg)
158226
159 sort_order = functools.partial(
160 _compare_packages_by_version_and_date, get_release)
161 for package_pubs in outpkgs.itervalues():227 for package_pubs in outpkgs.itervalues():
162 package_pubs.sort(cmp=sort_order, reverse=True)228 package_pubs.sort(cmp=generalization.compare, reverse=True)
163229
164 return outpkgs230 return outpkgs
165231
@@ -312,7 +378,7 @@
312 ),378 ),
313 group_by=BinaryPackageName.id,379 group_by=BinaryPackageName.id,
314 having=Count(BinaryPackagePublishingHistory.id) > 1)380 having=Count(BinaryPackagePublishingHistory.id) > 1)
315 binaries = IMasterStore(BinaryPackagePublishingHistory).find(381 binaries = IStore(BinaryPackagePublishingHistory).find(
316 BinaryPackagePublishingHistory,382 BinaryPackagePublishingHistory,
317 BinaryPackageRelease.id ==383 BinaryPackageRelease.id ==
318 BinaryPackagePublishingHistory.binarypackagereleaseID,384 BinaryPackagePublishingHistory.binarypackagereleaseID,
@@ -324,6 +390,19 @@
324 self.logger.debug("Dominating binaries...")390 self.logger.debug("Dominating binaries...")
325 self._dominatePublications(self._sortPackages(binaries, False))391 self._dominatePublications(self._sortPackages(binaries, False))
326392
393 def _composeActiveSourcePubsCondition(self, distroseries, pocket):
394 """Compose ORM condition for restricting relevant source pubs."""
395 # Avoid circular imports.
396 from lp.soyuz.model.publishing import SourcePackagePublishingHistory
397
398 return And(
399 SourcePackagePublishingHistory.status ==
400 PackagePublishingStatus.PUBLISHED,
401 SourcePackagePublishingHistory.distroseries == distroseries,
402 SourcePackagePublishingHistory.archive == self.archive,
403 SourcePackagePublishingHistory.pocket == pocket,
404 )
405
327 def dominateSources(self, distroseries, pocket):406 def dominateSources(self, distroseries, pocket):
328 """Perform domination on source package publications.407 """Perform domination on source package publications.
329408
@@ -332,34 +411,27 @@
332 """411 """
333 # Avoid circular imports.412 # Avoid circular imports.
334 from lp.soyuz.model.publishing import SourcePackagePublishingHistory413 from lp.soyuz.model.publishing import SourcePackagePublishingHistory
414
335 self.logger.debug(415 self.logger.debug(
336 "Performing domination across %s/%s (Source)",416 "Performing domination across %s/%s (Source)",
337 distroseries.name, pocket.title)417 distroseries.name, pocket.title)
338 spph_location_clauses = And(418
339 SourcePackagePublishingHistory.status ==419 spph_location_clauses = self._composeActiveSourcePubsCondition(
340 PackagePublishingStatus.PUBLISHED,420 distroseries, pocket)
341 SourcePackagePublishingHistory.distroseries == distroseries,421 having_multiple_active_publications = (
342 SourcePackagePublishingHistory.archive == self.archive,422 Count(SourcePackagePublishingHistory.id) > 1)
343 SourcePackagePublishingHistory.pocket == pocket,
344 )
345 candidate_source_names = Select(423 candidate_source_names = Select(
346 SourcePackageName.id,424 SourcePackageName.id,
347 And(425 And(join_spr_spn(), join_spph_spr(), spph_location_clauses),
348 SourcePackageRelease.sourcepackagenameID ==
349 SourcePackageName.id,
350 SourcePackagePublishingHistory.sourcepackagereleaseID ==
351 SourcePackageRelease.id,
352 spph_location_clauses,
353 ),
354 group_by=SourcePackageName.id,426 group_by=SourcePackageName.id,
355 having=Count(SourcePackagePublishingHistory.id) > 1)427 having=having_multiple_active_publications)
356 sources = IMasterStore(SourcePackagePublishingHistory).find(428 sources = IStore(SourcePackagePublishingHistory).find(
357 SourcePackagePublishingHistory,429 SourcePackagePublishingHistory,
358 SourcePackageRelease.id ==430 join_spph_spr(),
359 SourcePackagePublishingHistory.sourcepackagereleaseID,
360 SourcePackageRelease.sourcepackagenameID.is_in(431 SourcePackageRelease.sourcepackagenameID.is_in(
361 candidate_source_names),432 candidate_source_names),
362 spph_location_clauses)433 spph_location_clauses)
434
363 self.logger.debug("Dominating sources...")435 self.logger.debug("Dominating sources...")
364 self._dominatePublications(self._sortPackages(sources))436 self._dominatePublications(self._sortPackages(sources))
365 flush_database_updates()437 flush_database_updates()
366438
=== modified file 'lib/lp/archivepublisher/tests/test_dominator.py'
--- lib/lp/archivepublisher/tests/test_dominator.py 2011-02-04 05:11:00 +0000
+++ lib/lp/archivepublisher/tests/test_dominator.py 2011-09-05 12:08:08 +0000
@@ -1,4 +1,4 @@
1# Copyright 2009-2010 Canonical Ltd. This software is licensed under the1# Copyright 2009-2011 Canonical Ltd. This software is licensed under the
2# GNU Affero General Public License version 3 (see the file LICENSE).2# GNU Affero General Public License version 3 (see the file LICENSE).
33
4"""Tests for domination.py."""4"""Tests for domination.py."""
@@ -7,12 +7,20 @@
77
8import datetime8import datetime
99
10import apt_pkg
11
10from canonical.database.sqlbase import flush_database_updates12from canonical.database.sqlbase import flush_database_updates
11from lp.archivepublisher.domination import Dominator, STAY_OF_EXECUTION13from canonical.testing.layers import ZopelessDatabaseLayer
14from lp.archivepublisher.domination import (
15 Dominator,
16 GeneralizedPublication,
17 STAY_OF_EXECUTION,
18 )
12from lp.archivepublisher.publishing import Publisher19from lp.archivepublisher.publishing import Publisher
13from lp.registry.interfaces.series import SeriesStatus20from lp.registry.interfaces.series import SeriesStatus
14from lp.soyuz.enums import PackagePublishingStatus21from lp.soyuz.enums import PackagePublishingStatus
15from lp.soyuz.tests.test_publishing import TestNativePublishingBase22from lp.soyuz.tests.test_publishing import TestNativePublishingBase
23from lp.testing import TestCaseWithFactory
1624
1725
18class TestDominator(TestNativePublishingBase):26class TestDominator(TestNativePublishingBase):
@@ -200,3 +208,143 @@
200 TestDomination.setUp(self)208 TestDomination.setUp(self)
201 self.ubuntutest['breezy-autotest'].status = (209 self.ubuntutest['breezy-autotest'].status = (
202 SeriesStatus.OBSOLETE)210 SeriesStatus.OBSOLETE)
211
212
213class TestGeneralizedPublication(TestCaseWithFactory):
214 """Test publication generalization helpers."""
215
216 layer = ZopelessDatabaseLayer
217
218 def makeSPPHsForVersions(self, versions):
219 """Create publication records for each of `versions`.
220
221 They records are created in the same order in which they are
222 specified. Make the order irregular to prove that version ordering
223 is not a coincidence of object creation order etc.
224
225 Versions may also be identical; each publication record will still
226 have its own package release.
227 """
228 distroseries = self.factory.makeDistroSeries()
229 pocket = self.factory.getAnyPocket()
230 sprs = [
231 self.factory.makeSourcePackageRelease(version=version)
232 for version in versions]
233 return [
234 self.factory.makeSourcePackagePublishingHistory(
235 distroseries=distroseries, pocket=pocket,
236 sourcepackagerelease=spr)
237 for spr in sprs]
238
239 def listSourceVersions(self, spphs):
240 """Extract the versions from `spphs` as a list, in the same order."""
241 return [spph.sourcepackagerelease.version for spph in spphs]
242
243 def listCreaitonDates(self, spphs):
244 """Extract creation dates from `spphs` into a list."""
245 return [spph.datecreated for spph in spphs]
246
247 def alterCreationDates(self, spphs, ages):
248 """Set `datecreated` on each of `spphs` according to `ages`.
249
250 :param spphs: Iterable of `SourcePackagePublishingHistory`. Their
251 respective creation dates will be offset by the respective ages
252 found in `ages` (with the two being matched up in the same order).
253 :param ages: Iterable of ages. Must provide the same number of items
254 as `spphs`. Ages are `timedelta` objects that will be subtracted
255 from the creation dates on the respective records in `spph`.
256 """
257 for spph, age in zip(spphs, ages):
258 spph.datecreated -= age
259
260 def test_getPackageVersion_gets_source_version(self):
261 spph = self.factory.makeSourcePackagePublishingHistory()
262 self.assertEqual(
263 spph.sourcepackagerelease.version,
264 GeneralizedPublication(is_source=True).getPackageVersion(spph))
265
266 def test_getPackageVersion_gets_binary_version(self):
267 bpph = self.factory.makeBinaryPackagePublishingHistory()
268 self.assertEqual(
269 bpph.binarypackagerelease.version,
270 GeneralizedPublication(is_source=False).getPackageVersion(bpph))
271
272 def test_compare_sorts_versions(self):
273 versions = [
274 '1.1v2',
275 '1.1v1',
276 '1.1v3',
277 ]
278 spphs = self.makeSPPHsForVersions(versions)
279 sorted_spphs = sorted(spphs, cmp=GeneralizedPublication().compare)
280 self.assertEqual(
281 sorted(versions),
282 self.listSourceVersions(sorted_spphs))
283
284 def test_compare_orders_versions_by_debian_rules(self):
285 versions = [
286 '1.1.0',
287 '1.10',
288 '1.1',
289 '1.1ubuntu0',
290 ]
291 spphs = self.makeSPPHsForVersions(versions)
292
293 debian_sorted_versions = sorted(versions, cmp=apt_pkg.VersionCompare)
294
295 # Assumption: in this case, Debian version ordering is not the
296 # same as alphabetical version ordering.
297 self.assertNotEqual(sorted(versions), debian_sorted_versions)
298
299 # The compare method produces the Debian ordering.
300 sorted_spphs = sorted(spphs, cmp=GeneralizedPublication().compare)
301 self.assertEqual(
302 sorted(versions, cmp=apt_pkg.VersionCompare),
303 self.listSourceVersions(sorted_spphs))
304
305 def test_compare_breaks_tie_with_creation_date(self):
306 # When two publications are tied for comparison because they are
307 # for the same package release, they are ordered by creation
308 # date.
309 distroseries = self.factory.makeDistroSeries()
310 pocket = self.factory.getAnyPocket()
311 spr = self.factory.makeSourcePackageRelease()
312 ages = [
313 datetime.timedelta(2),
314 datetime.timedelta(1),
315 datetime.timedelta(3),
316 ]
317 spphs = [
318 self.factory.makeSourcePackagePublishingHistory(
319 sourcepackagerelease=spr, distroseries=distroseries,
320 pocket=pocket)
321 for counter in xrange(len(ages))]
322 self.alterCreationDates(spphs, ages)
323
324 self.assertEqual(
325 [spphs[2], spphs[0], spphs[1]],
326 sorted(spphs, cmp=GeneralizedPublication().compare))
327
328 def test_compare_breaks_tie_for_releases_with_same_version(self):
329 # When two publications are tied for comparison because they
330 # belong to releases with the same version string, they are
331 # ordered by creation date.
332 version = "1.%d" % self.factory.getUniqueInteger()
333 ages = [
334 datetime.timedelta(2),
335 datetime.timedelta(1),
336 datetime.timedelta(3),
337 ]
338 distroseries = self.factory.makeDistroSeries()
339 pocket = self.factory.getAnyPocket()
340 spphs = [
341 self.factory.makeSourcePackagePublishingHistory(
342 distroseries=distroseries, pocket=pocket,
343 sourcepackagerelease=self.factory.makeSourcePackageRelease(
344 version=version))
345 for counter in xrange(len(ages))]
346 self.alterCreationDates(spphs, ages)
347
348 self.assertEqual(
349 [spphs[2], spphs[0], spphs[1]],
350 sorted(spphs, cmp=GeneralizedPublication().compare))
203351
=== modified file 'lib/lp/soyuz/interfaces/publishing.py'
--- lib/lp/soyuz/interfaces/publishing.py 2011-09-02 04:51:25 +0000
+++ lib/lp/soyuz/interfaces/publishing.py 2011-09-05 12:08:08 +0000
@@ -195,9 +195,6 @@
195 the field name and value is the value string.195 the field name and value is the value string.
196 """196 """
197197
198 def supersede():
199 """Supersede this publication."""
200
201 def requestObsolescence():198 def requestObsolescence():
202 """Make this publication obsolete.199 """Make this publication obsolete.
203200
204201
=== modified file 'lib/lp/soyuz/model/publishing.py'
--- lib/lp/soyuz/model/publishing.py 2011-08-31 04:40:44 +0000
+++ lib/lp/soyuz/model/publishing.py 2011-09-05 12:08:08 +0000
@@ -327,8 +327,8 @@
327 fields = self.buildIndexStanzaFields()327 fields = self.buildIndexStanzaFields()
328 return fields.makeOutput()328 return fields.makeOutput()
329329
330 def supersede(self):330 def setSuperseded(self):
331 """See `IPublishing`."""331 """Set to SUPERSEDED status."""
332 self.status = PackagePublishingStatus.SUPERSEDED332 self.status = PackagePublishingStatus.SUPERSEDED
333 self.datesuperseded = UTC_NOW333 self.datesuperseded = UTC_NOW
334334
@@ -742,7 +742,7 @@
742 "Should not dominate unpublished source %s" %742 "Should not dominate unpublished source %s" %
743 self.sourcepackagerelease.title)743 self.sourcepackagerelease.title)
744744
745 super(SourcePackagePublishingHistory, self).supersede()745 self.setSuperseded()
746746
747 if dominant is not None:747 if dominant is not None:
748 if logger is not None:748 if logger is not None:
@@ -1126,7 +1126,7 @@
1126 self.distroarchseries.architecturetag))1126 self.distroarchseries.architecturetag))
1127 return1127 return
11281128
1129 super(BinaryPackagePublishingHistory, self).supersede()1129 self.setSuperseded()
11301130
1131 if dominant is not None:1131 if dominant is not None:
1132 # DDEBs cannot themselves be dominant; they are always dominated1132 # DDEBs cannot themselves be dominant; they are always dominated
11331133
=== modified file 'scripts/gina.py'
--- scripts/gina.py 2011-08-23 08:35:13 +0000
+++ scripts/gina.py 2011-09-05 12:08:08 +0000
@@ -209,9 +209,8 @@
209 npacks = len(packages_map.src_map)209 npacks = len(packages_map.src_map)
210 log.info('%i Source Packages to be imported', npacks)210 log.info('%i Source Packages to be imported', npacks)
211211
212 for list_source in sorted(212 for package in sorted(packages_map.src_map.iterkeys()):
213 packages_map.src_map.values(), key=lambda x: x[0].get("Package")):213 for source in packages_map.src_map[package]:
214 for source in list_source:
215 count += 1214 count += 1
216 attempt_source_package_import(215 attempt_source_package_import(
217 source, kdb, package_root, keyrings, importer_handler)216 source, kdb, package_root, keyrings, importer_handler)
@@ -244,10 +243,9 @@
244 log.info(243 log.info(
245 '%i Binary Packages to be imported for %s', npacks, archtag)244 '%i Binary Packages to be imported for %s', npacks, archtag)
246 # Go over binarypackages importing them for this architecture245 # Go over binarypackages importing them for this architecture
247 for binary in sorted(packages_map.bin_map[archtag].values(),246 for package_name in sorted(packages_map.bin_map[archtag].iterkeys()):
248 key=lambda x: x.get("Package")):247 binary = packages_map.bin_map[archtag][package_name]
249 count += 1248 count += 1
250 package_name = binary.get("Package", "unknown")
251 try:249 try:
252 try:250 try:
253 do_one_binarypackage(binary, archtag, kdb, package_root,251 do_one_binarypackage(binary, archtag, kdb, package_root,