launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #32861
[Merge] ~mwhudson/launchpad:add-distroseries-underlying-arch-model into launchpad:master
Michael Hudson-Doyle has proposed merging ~mwhudson/launchpad:add-distroseries-underlying-arch-model into launchpad:master with ~mwhudson/launchpad:add-distroseries-underlying-arch as a prerequisite.
Commit message:
add model/interface fields for underlying_architecturetag
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~mwhudson/launchpad/+git/launchpad/+merge/490642
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~mwhudson/launchpad:add-distroseries-underlying-arch-model into launchpad:master.
diff --git a/lib/lp/registry/interfaces/distroseries.py b/lib/lp/registry/interfaces/distroseries.py
index 9389bc9..e010c43 100644
--- a/lib/lp/registry/interfaces/distroseries.py
+++ b/lib/lp/registry/interfaces/distroseries.py
@@ -1000,7 +1000,14 @@ class IDistroSeriesPublic(
:return: A new `PackageUpload`.
"""
- def newArch(architecturetag, processor, official, owner, enabled=True):
+ def newArch(
+ architecturetag,
+ processor,
+ official,
+ owner,
+ enabled=True,
+ underlying_architecturetag=None,
+ ):
"""Create a new port or DistroArchSeries for this DistroSeries."""
def getPOFileContributorsByLanguage(language):
diff --git a/lib/lp/registry/model/distroseries.py b/lib/lp/registry/model/distroseries.py
index d67dc65..2c10ea2 100644
--- a/lib/lp/registry/model/distroseries.py
+++ b/lib/lp/registry/model/distroseries.py
@@ -1385,7 +1385,13 @@ class DistroSeries(
return DecoratedResultSet(package_caches, result_to_dsbp)
def newArch(
- self, architecturetag, processor, official, owner, enabled=True
+ self,
+ architecturetag,
+ processor,
+ official,
+ owner,
+ enabled=True,
+ underlying_architecturetag=None,
):
"""See `IDistroSeries`."""
das = DistroArchSeries(
@@ -1395,6 +1401,7 @@ class DistroSeries(
distroseries=self,
owner=owner,
enabled=enabled,
+ underlying_architecturetag=underlying_architecturetag,
)
IStore(das).flush()
return das
diff --git a/lib/lp/soyuz/interfaces/distroarchseries.py b/lib/lp/soyuz/interfaces/distroarchseries.py
index 4e5c67a..03915a7 100644
--- a/lib/lp/soyuz/interfaces/distroarchseries.py
+++ b/lib/lp/soyuz/interfaces/distroarchseries.py
@@ -105,6 +105,18 @@ class IDistroArchSeriesPublic(IHasBuildRecords, IHasOwner):
),
exported_as="architecture_tag",
)
+ underlying_architecturetag = exported(
+ TextLine(
+ title=_("Underlying Architecture Tag"),
+ description=_(
+ "If set, identifies architecture_tag as a 'variant' of the "
+ "specified architecture."
+ ),
+ required=False,
+ constraint=name_validator,
+ ),
+ exported_as="underlying_architecture_tag",
+ )
official = exported(
Bool(
title=_("Official Support"),
diff --git a/lib/lp/soyuz/model/distroarchseries.py b/lib/lp/soyuz/model/distroarchseries.py
index c2960e9..d02365a 100644
--- a/lib/lp/soyuz/model/distroarchseries.py
+++ b/lib/lp/soyuz/model/distroarchseries.py
@@ -56,6 +56,7 @@ class DistroArchSeries(StormBase):
processor_id = Int(name="processor", allow_none=False)
processor = Reference(processor_id, Processor.id)
architecturetag = Unicode(allow_none=False)
+ underlying_architecturetag = Unicode(allow_none=True)
official = Bool(allow_none=False)
owner_id = Int(
name="owner", validator=validate_public_person, allow_none=False
@@ -79,6 +80,7 @@ class DistroArchSeries(StormBase):
official,
owner,
enabled=True,
+ underlying_architecturetag=None,
):
super().__init__()
self.distroseries = distroseries
@@ -87,6 +89,7 @@ class DistroArchSeries(StormBase):
self.official = official
self.owner = owner
self.enabled = enabled
+ self.underlying_architecturetag = underlying_architecturetag
def __getitem__(self, name):
return self.getBinaryPackage(name)
diff --git a/lib/lp/soyuz/scripts/initialize_distroseries.py b/lib/lp/soyuz/scripts/initialize_distroseries.py
index 4097a10..6626a47 100644
--- a/lib/lp/soyuz/scripts/initialize_distroseries.py
+++ b/lib/lp/soyuz/scripts/initialize_distroseries.py
@@ -470,10 +470,23 @@ class InitializeDistroSeries:
self._store.execute(
"""
INSERT INTO DistroArchSeries
- (distroseries, processor, architecturetag, owner, official)
- SELECT %s, processor, architecturetag, %s, bool_and(official)
+ (
+ distroseries,
+ processor,
+ architecturetag,
+ owner,
+ official,
+ underlying_architecturetag
+ )
+ SELECT
+ %s,
+ processor,
+ architecturetag,
+ %s,
+ bool_and(official),
+ underlying_architecturetag
FROM DistroArchSeries WHERE enabled = TRUE %s
- GROUP BY processor, architecturetag
+ GROUP BY processor, architecturetag, underlying_architecturetag
"""
% (
sqlvalues(self.distroseries.id, self.distroseries.owner.id)
diff --git a/lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py b/lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py
index c0d6b57..c38fb84 100644
--- a/lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py
+++ b/lib/lp/soyuz/scripts/tests/test_initialize_distroseries.py
@@ -872,6 +872,41 @@ class TestInitializeDistroSeries(InitializationHelperTestCase):
das[0].architecturetag, self.parent_das.architecturetag
)
+ def test_initialize_variant(self):
+ # Test a full initialize with no errors, but only copy i386 to
+ # the child.
+ self.parent, self.parent_das = self.setupParent()
+ variant_das = self.factory.makeDistroArchSeries(
+ distroseries=self.parent,
+ underlying_architecturetag=self.parent_das.architecturetag,
+ )
+ child = self._fullInitialize([self.parent])
+ self.assertDistroSeriesInitializedCorrectly(
+ child, self.parent, self.parent_das
+ )
+ das = list(
+ IStore(DistroArchSeries).find(DistroArchSeries, distroseries=child)
+ )
+ self.assertEqual(len(das), 2)
+ new_underlying_das = child[self.parent_das.architecturetag]
+ new_variant_das = child[variant_das.architecturetag]
+ self.assertEqual(
+ new_underlying_das.architecturetag,
+ self.parent_das.architecturetag,
+ )
+ self.assertEqual(
+ new_underlying_das.underlying_architecturetag,
+ self.parent_das.underlying_architecturetag,
+ )
+ self.assertEqual(
+ new_variant_das.architecturetag,
+ variant_das.architecturetag,
+ )
+ self.assertEqual(
+ new_variant_das.underlying_architecturetag,
+ variant_das.underlying_architecturetag,
+ )
+
def test_copying_packagesets(self):
# If a parent series has packagesets, we should copy them.
self.parent, self.parent_das = self.setupParent()
diff --git a/lib/lp/soyuz/stories/webservice/xx-distroarchseries.rst b/lib/lp/soyuz/stories/webservice/xx-distroarchseries.rst
index 9f16056..682b99d 100644
--- a/lib/lp/soyuz/stories/webservice/xx-distroarchseries.rst
+++ b/lib/lp/soyuz/stories/webservice/xx-distroarchseries.rst
@@ -49,6 +49,7 @@ For a distroarchseries we publish a subset of its attributes.
self_link: 'http://.../ubuntu/hoary/i386'
supports_virtualized: True
title: 'The Hoary Hedgehog Release for i386 (386)'
+ underlying_architecture_tag: None
web_link: 'http://launchpad.../ubuntu/hoary/i386'
DistroArchSeries.enabled is published in the API devel version.
@@ -73,4 +74,5 @@ DistroArchSeries.enabled is published in the API devel version.
self_link: 'http://.../ubuntu/hoary/i386'
supports_virtualized: True
title: 'The Hoary Hedgehog Release for i386 (386)'
+ underlying_architecture_tag: None
web_link: 'http://launchpad.../ubuntu/hoary/i386'
diff --git a/lib/lp/testing/factory.py b/lib/lp/testing/factory.py
index 52d93e5..c8d5f9d 100644
--- a/lib/lp/testing/factory.py
+++ b/lib/lp/testing/factory.py
@@ -3618,6 +3618,7 @@ class LaunchpadObjectFactory(ObjectFactory):
official=True,
owner=None,
enabled=True,
+ underlying_architecturetag=None,
):
"""Create a new distroarchseries"""
@@ -3634,7 +3635,12 @@ class LaunchpadObjectFactory(ObjectFactory):
architecturetag = self.getUniqueString("arch")
return ProxyFactory(
distroseries.newArch(
- architecturetag, processor, official, owner, enabled
+ architecturetag,
+ processor,
+ official,
+ owner,
+ enabled,
+ underlying_architecturetag,
)
)