launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #29884
[Merge] ~pelpsi/lpcraft:backward-compatibility into lpcraft:main
Simone Pelosi has proposed merging ~pelpsi/lpcraft:backward-compatibility into lpcraft:main.
Commit message:
Forced classic to True if snaps are configured as string
If snaps are configured as string the classic confinment is forced
to improve backward compatibility
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~pelpsi/lpcraft/+git/lpcraft/+merge/440492
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~pelpsi/lpcraft:backward-compatibility into lpcraft:main.
diff --git a/lpcraft/commands/tests/test_run.py b/lpcraft/commands/tests/test_run.py
index 361661c..b1fc6c2 100644
--- a/lpcraft/commands/tests/test_run.py
+++ b/lpcraft/commands/tests/test_run.py
@@ -2103,6 +2103,7 @@ class TestRun(RunBaseTestCase):
"chromium",
"--channel",
"latest/stable",
+ "--classic",
],
check=True,
capture_output=True,
@@ -2125,6 +2126,7 @@ class TestRun(RunBaseTestCase):
"firefox",
"--channel",
"latest/stable",
+ "--classic",
],
check=True,
capture_output=True,
@@ -2259,6 +2261,7 @@ class TestRun(RunBaseTestCase):
"firefox",
"--channel",
"latest/stable",
+ "--classic",
],
check=True,
capture_output=True,
diff --git a/lpcraft/config.py b/lpcraft/config.py
index 0fdb9b4..4590cce 100644
--- a/lpcraft/config.py
+++ b/lpcraft/config.py
@@ -8,6 +8,7 @@ from pathlib import Path
from typing import Any, Dict, Iterator, List, Optional, Tuple, Type, Union
import pydantic
+from craft_cli import emit
from pydantic import AnyHttpUrl, StrictStr, root_validator, validator
from lpcraft.errors import ConfigurationError
@@ -304,7 +305,13 @@ class Job(ModelConfigDefaults):
for value in v:
# Backward compatibility, i.e. [chromium, firefox]
if type(value) is str:
- clean_values.append({"name": value})
+ emit.message(
+ f"Warning: You configured snap `{value}` but "
+ + "you used a deprecated format. "
+ + "Please refer to the documentation for an "
+ + "overview of supported formats.",
+ )
+ clean_values.append({"name": value, "classic": True})
elif type(value) is dict:
if "name" not in value or value["name"] is None:
raise ValueError(
Follow ups