← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad:ocirecipebuild-arch-tag into launchpad:master

 

Colin Watson has proposed merging ~cjwatson/launchpad:ocirecipebuild-arch-tag into launchpad:master.

Commit message:
Add and export OCIRecipeBuild.arch_tag

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

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

This is useful for some build farm administration scripts, since it makes OCI recipe builds more similar to other build types.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:ocirecipebuild-arch-tag into launchpad:master.
diff --git a/lib/lp/oci/interfaces/ocirecipebuild.py b/lib/lp/oci/interfaces/ocirecipebuild.py
index 763e1ed..a43082b 100644
--- a/lib/lp/oci/interfaces/ocirecipebuild.py
+++ b/lib/lp/oci/interfaces/ocirecipebuild.py
@@ -218,6 +218,9 @@ class IOCIRecipeBuildView(IPackageBuildView, IPrivacy):
         title=_("The series and architecture for which to build."),
         required=True, readonly=True))
 
+    arch_tag = exported(
+        TextLine(title=_("Architecture tag"), required=True, readonly=True))
+
     score = exported(Int(
         title=_("Score of the related build farm job (if any)."),
         required=False, readonly=True))
diff --git a/lib/lp/oci/model/ocirecipebuild.py b/lib/lp/oci/model/ocirecipebuild.py
index 2dee003..c01448d 100644
--- a/lib/lp/oci/model/ocirecipebuild.py
+++ b/lib/lp/oci/model/ocirecipebuild.py
@@ -355,6 +355,11 @@ class OCIRecipeBuild(PackageBuildMixin, StormBase):
         return self.recipe.distro_series.getDistroArchSeriesByProcessor(
             self.processor)
 
+    @property
+    def arch_tag(self):
+        """See `IOCIRecipeBuild`."""
+        return self.distro_arch_series.architecturetag
+
     def updateStatus(self, status, builder=None, worker_status=None,
                      date_started=None, date_finished=None,
                      force_invalid_transition=False):
diff --git a/lib/lp/oci/tests/test_ocirecipebuild.py b/lib/lp/oci/tests/test_ocirecipebuild.py
index 3a1b83d..e764758 100644
--- a/lib/lp/oci/tests/test_ocirecipebuild.py
+++ b/lib/lp/oci/tests/test_ocirecipebuild.py
@@ -730,6 +730,8 @@ class TestOCIRecipeBuildWebservice(OCIConfigHelperMixin, TestCaseWithFactory):
                 "recipe_link": Equals(self.getURL(db_build.recipe)),
                 "distro_arch_series_link": Equals(
                     self.getURL(db_build.distro_arch_series)),
+                "arch_tag": Equals(
+                    db_build.distro_arch_series.architecturetag),
                 "score": Is(None),
                 "can_be_rescored": Is(False),
                 "can_be_cancelled": Is(False),
diff --git a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
index e4b0fa7..51f38de 100644
--- a/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
+++ b/lib/lp/oci/tests/test_ocirecipebuildbehaviour.py
@@ -98,9 +98,6 @@ class MakeOCIBuildMixin:
 
     def makeBuild(self):
         build = self.factory.makeOCIRecipeBuild()
-        self.factory.makeDistroSeries(
-            distribution=build.recipe.oci_project.distribution,
-            status=SeriesStatus.CURRENT)
         build.queueBuild()
         return build