launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #17178
[Merge] lp:~wgrant/launchpad/overrides-include-versions into lp:launchpad
William Grant has proposed merging lp:~wgrant/launchpad/overrides-include-versions into lp:launchpad with lp:~wgrant/launchpad/overrides-arch-indep as a prerequisite.
Commit message:
FromExistingOverridePolicy now includes the version of the ancestor it uses. archiveuploader and packagecopier need it to ensure packages don't go backwards.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wgrant/launchpad/overrides-include-versions/+merge/227500
FromExistingOverridePolicy now includes the version of the ancestor it uses. archiveuploader and packagecopier need it to ensure packages don't go backwards.
--
https://code.launchpad.net/~wgrant/launchpad/overrides-include-versions/+merge/227500
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wgrant/launchpad/overrides-include-versions into lp:launchpad.
=== modified file 'lib/lp/soyuz/adapters/overrides.py'
--- lib/lp/soyuz/adapters/overrides.py 2014-07-21 06:41:59 +0000
+++ lib/lp/soyuz/adapters/overrides.py 2014-07-21 06:41:59 +0000
@@ -36,6 +36,7 @@
from lp.soyuz.enums import PackagePublishingStatus
from lp.soyuz.interfaces.component import IComponentSet
from lp.soyuz.model.binarypackagename import BinaryPackageName
+from lp.soyuz.model.binarypackagerelease import BinaryPackageRelease
from lp.soyuz.model.component import Component
from lp.soyuz.model.distroarchseries import DistroArchSeries
from lp.soyuz.model.publishing import (
@@ -43,6 +44,7 @@
SourcePackagePublishingHistory,
)
from lp.soyuz.model.section import Section
+from lp.soyuz.model.sourcepackagerelease import SourcePackageRelease
class IOverride(Interface):
@@ -53,6 +55,7 @@
component = Attribute("The IComponent override")
section = Attribute("The ISection override")
+ version = Attribute("The exclusive lower version limit")
class ISourceOverride(IOverride):
@@ -77,9 +80,10 @@
class Override:
"""See `IOverride`."""
- def __init__(self, component=None, section=None):
+ def __init__(self, component=None, section=None, version=None):
self.component = component
self.section = section
+ self.version = version
def __ne__(self, other):
return not self == other
@@ -98,12 +102,14 @@
def __eq__(self, other):
return (
self.component == other.component and
- self.section == other.section)
+ self.section == other.section and
+ self.version == other.version)
def __repr__(self):
return (
- "<%s at %x component=%r section=%r>" %
- (self.__class__.__name__, id(self), self.component, self.section))
+ "<%s at %x component=%r section=%r version=%r>" %
+ (self.__class__.__name__, id(self), self.component, self.section,
+ self.version))
class BinaryOverride(Override):
@@ -111,8 +117,9 @@
implements(IBinaryOverride)
def __init__(self, component=None, section=None, priority=None,
- phased_update_percentage=None):
- super(BinaryOverride, self).__init__(component, section)
+ phased_update_percentage=None, version=None):
+ super(BinaryOverride, self).__init__(
+ component=component, section=section, version=version)
self.priority = priority
self.phased_update_percentage = phased_update_percentage
@@ -121,14 +128,15 @@
self.component == other.component and
self.section == other.section and
self.priority == other.priority and
- self.phased_update_percentage == other.phased_update_percentage)
+ self.phased_update_percentage == other.phased_update_percentage and
+ self.version == other.version)
def __repr__(self):
return (
"<%s at %x component=%r section=%r priority=%r "
- "phased_update_percentage=%r>" %
+ "phased_update_percentage=%r version=%r>" %
(self.__class__.__name__, id(self), self.component, self.section,
- self.priority, self.phased_update_percentage))
+ self.priority, self.phased_update_percentage, self.version))
class IOverridePolicy(Interface):
@@ -219,7 +227,10 @@
store.find(
(SourcePackagePublishingHistory.sourcepackagenameID,
SourcePackagePublishingHistory.componentID,
- SourcePackagePublishingHistory.sectionID),
+ SourcePackagePublishingHistory.sectionID,
+ SourcePackageRelease.version),
+ SourcePackageRelease.id ==
+ SourcePackagePublishingHistory.sourcepackagereleaseID,
SourcePackagePublishingHistory.archiveID == archive.id,
SourcePackagePublishingHistory.distroseriesID ==
distroseries.id,
@@ -233,11 +244,12 @@
).config(
distinct=(
SourcePackagePublishingHistory.sourcepackagenameID,)),
- id_resolver((SourcePackageName, Component, Section)),
+ id_resolver((SourcePackageName, Component, Section, None)),
pre_iter_hook=eager_load)
return dict(
- (name, SourceOverride(component=component, section=section))
- for (name, component, section) in already_published)
+ (name, SourceOverride(
+ component=component, section=section, version=version))
+ for (name, component, section, version) in already_published)
def calculateBinaryOverrides(self, archive, distroseries, pocket,
binaries, include_deleted=False):
@@ -261,7 +273,10 @@
BinaryPackagePublishingHistory.distroarchseriesID,
BinaryPackagePublishingHistory.componentID,
BinaryPackagePublishingHistory.sectionID,
- BinaryPackagePublishingHistory.priority),
+ BinaryPackagePublishingHistory.priority,
+ BinaryPackageRelease.version),
+ BinaryPackageRelease.id ==
+ BinaryPackagePublishingHistory.binarypackagereleaseID,
BinaryPackagePublishingHistory.status.is_in(
self.getExistingPublishingStatuses(include_deleted)),
Or(*candidates)).order_by(
@@ -276,10 +291,10 @@
),
id_resolver(
(BinaryPackageName, DistroArchSeries, Component, Section,
- None)),
+ None, None)),
pre_iter_hook=eager_load)
overrides = {}
- for name, das, component, section, priority in already_published:
+ for name, das, component, section, priority, ver in already_published:
# These details can always fulfill their own archtag, and may
# satisfy a None archtag if the DAS is nominatedarchindep.
matching_keys = [(name, das.architecturetag)]
@@ -290,7 +305,8 @@
continue
overrides[key] = BinaryOverride(
component=component, section=section, priority=priority,
- phased_update_percentage=self.phased_update_percentage)
+ phased_update_percentage=self.phased_update_percentage,
+ version=ver)
return overrides
=== modified file 'lib/lp/soyuz/adapters/tests/test_overrides.py'
--- lib/lp/soyuz/adapters/tests/test_overrides.py 2014-07-21 06:41:59 +0000
+++ lib/lp/soyuz/adapters/tests/test_overrides.py 2014-07-21 06:41:59 +0000
@@ -52,7 +52,8 @@
{spph.sourcepackagerelease.sourcepackagename: SourceOverride()})
expected = {
spph.sourcepackagerelease.sourcepackagename: SourceOverride(
- component=spph.component, section=spph.section)}
+ component=spph.component, section=spph.section,
+ version=spph.sourcepackagerelease.version)}
self.assertEqual(expected, overrides)
def test_source_overrides_latest_only_is_returned(self):
@@ -76,7 +77,8 @@
{spn: SourceOverride(spn)})
self.assertEqual(
{spn: SourceOverride(
- component=spph.component, section=spph.section)},
+ component=spph.component, section=spph.section,
+ version=spph.sourcepackagerelease.version)},
overrides)
def test_source_overrides_constant_query_count(self):
@@ -141,16 +143,19 @@
bpph1.distroarchseries.architecturetag):
BinaryOverride(
component=bpph1.component, section=bpph1.section,
- priority=bpph1.priority),
+ priority=bpph1.priority,
+ version=bpph1.binarypackagerelease.version),
(bpph2.binarypackagerelease.binarypackagename,
bpph2.distroarchseries.architecturetag):
BinaryOverride(
component=bpph2.component, section=bpph2.section,
- priority=bpph2.priority),
+ priority=bpph2.priority,
+ version=bpph2.binarypackagerelease.version),
(bpph2.binarypackagerelease.binarypackagename, None):
BinaryOverride(
component=bpph2.component, section=bpph2.section,
- priority=bpph2.priority),
+ priority=bpph2.priority,
+ version=bpph2.binarypackagerelease.version),
}
self.assertEqual(expected, overrides)
@@ -303,7 +308,9 @@
pocket=pocket)
spns.append(spph.sourcepackagerelease.sourcepackagename)
expected[spph.sourcepackagerelease.sourcepackagename] = (
- SourceOverride(component=spph.component, section=spph.section))
+ SourceOverride(
+ component=spph.component, section=spph.section,
+ version=spph.sourcepackagerelease.version))
spns.append(self.factory.makeSourcePackageName())
expected[spns[-1]] = SourceOverride(component=universe)
policy = UbuntuOverridePolicy()
@@ -337,7 +344,8 @@
expected[(bpn, distroarchseries.architecturetag)] = (
BinaryOverride(
component=bpph.component, section=bpph.section,
- priority=bpph.priority))
+ priority=bpph.priority,
+ version=bpph.binarypackagerelease.version))
for i in xrange(2):
distroarchseries = self.factory.makeDistroArchSeries(
distroseries=distroseries)
@@ -373,7 +381,8 @@
bpns.append((bpn, distroarchseries.architecturetag))
expected[(bpn, distroarchseries.architecturetag)] = BinaryOverride(
component=bpph.component, section=bpph.section,
- priority=bpph.priority, phased_update_percentage=50)
+ priority=bpph.priority, phased_update_percentage=50,
+ version=bpph.binarypackagerelease.version)
distroarchseries = self.factory.makeDistroArchSeries(
distroseries=distroseries)
bpns.append((bpn, distroarchseries.architecturetag))
Follow ups