launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29546
[Merge] ~lgp171188/lpcraft:fix-suites-value-not-being-an-enum-item into lpcraft:main
Guruprasad has proposed merging ~lgp171188/lpcraft:fix-suites-value-not-being-an-enum-item into lpcraft:main.
Commit message:
Fix the issue caused by the value of 'suites' not being an enum item
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~lgp171188/lpcraft/+git/lpcraft/+merge/435744
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/lpcraft:fix-suites-value-not-being-an-enum-item into lpcraft:main.
diff --git a/lpcraft/config.py b/lpcraft/config.py
index d228270..4664176 100644
--- a/lpcraft/config.py
+++ b/lpcraft/config.py
@@ -276,7 +276,9 @@ class Job(ModelConfigDefaults):
if not package_repository.suites:
if not package_repositories:
package_repositories = v.copy()
- package_repositories[index].suites = [values["series"]]
+ package_repositories[index].suites = [
+ PackageSuite[values["series"]]
+ ]
return package_repositories or v
@pydantic.root_validator(pre=True)
diff --git a/lpcraft/tests/test_config.py b/lpcraft/tests/test_config.py
index 6c69eab..58248e8 100644
--- a/lpcraft/tests/test_config.py
+++ b/lpcraft/tests/test_config.py
@@ -601,9 +601,21 @@ class TestConfig(TestCase):
)
config = Config.load(path)
- for package_repository in config.jobs["test"][0].package_repositories:
- self.assertEqual(["deb"], package_repository.formats)
- self.assertEqual(["focal"], package_repository.suites)
+ package_repository_1 = config.jobs["test"][0].package_repositories[0]
+ self.assertEqual(["deb"], package_repository_1.formats)
+ self.assertEqual(["focal"], package_repository_1.suites)
+ self.assertEqual(
+ [f"deb {LAUNCHPAD_PPA_BASE_URL}/launchpad/ppa/ubuntu focal main"],
+ list(package_repository_1.sources_list_lines()),
+ )
+
+ package_repository_2 = config.jobs["test"][0].package_repositories[1]
+ self.assertEqual(["deb"], package_repository_2.formats)
+ self.assertEqual(["focal"], package_repository_2.suites)
+ self.assertEqual(
+ ["deb https://canonical.example.org/ubuntu focal main"],
+ list(package_repository_2.sources_list_lines()),
+ )
def test_missing_ppa_and_url(self):
path = self.create_config(