Skip to content

Commit

Permalink
feat(project): [email protected] no longer requires "devel" (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
tigarmo authored Apr 9, 2024
1 parent 3dddfa1 commit 4d5e467
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
4 changes: 2 additions & 2 deletions rockcraft/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _validate_platform_set(cls, values: Mapping[str, Any]) -> Mapping[str, Any]:

DEPRECATED_COLON_BASES = ["ubuntu:20.04", "ubuntu:22.04"]

CURRENT_DEVEL_BASE = "ubuntu@24.04"
CURRENT_DEVEL_BASE = "ubuntu@26.04"

DEVEL_BASE_WARNING = (
"The development build-base should only be used for testing purposes, "
Expand All @@ -138,7 +138,7 @@ class BuildPlanner(BaseBuildPlanner):

platforms: dict[str, Any] # type: ignore[reportIncompatibleVariableOverride]
base: Literal["bare", "[email protected]", "[email protected]", "[email protected]"]
build_base: Literal["[email protected]", "[email protected]", "devel"] | None
build_base: Literal["[email protected]", "[email protected]", "[email protected]", "devel"] | None

@pydantic.root_validator(skip_on_failure=True)
@classmethod
Expand Down
1 change: 1 addition & 0 deletions schema/rockcraft.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"enum": [
"[email protected]",
"[email protected]",
"[email protected]",
"devel"
],
"type": "string"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
name: base-2404
base: [email protected]
build-base: devel

# Remaining contents will come from "parts.yaml"
18 changes: 14 additions & 4 deletions tests/unit/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@
pytestmark = [pytest.mark.usefixtures("enable_overlay_feature")]


class DevelProject(Project):
"""A Project subclass that always accepts CURRENT_DEVEL_BASE as a "base".
Needed because we might not have a currently supported base that is still in
"development", but we want to test the behavior anyway.
"""

base: str # type: ignore


@pytest.fixture()
def yaml_data():
return ROCKCRAFT_YAML
Expand Down Expand Up @@ -601,7 +611,7 @@ def test_project_generate_metadata(yaml_loaded_data):


def test_metadata_base_devel(yaml_loaded_data):
yaml_loaded_data["base"] = CURRENT_DEVEL_BASE
yaml_loaded_data["base"] = "[email protected]"
yaml_loaded_data["build-base"] = "devel"
project = Project.unmarshal(yaml_loaded_data)

Expand Down Expand Up @@ -727,7 +737,7 @@ def test_project_devel_base(yaml_loaded_data):
yaml_loaded_data["build-base"] = "[email protected]"

with pytest.raises(CraftValidationError) as err:
_ = Project.unmarshal(yaml_loaded_data)
_ = DevelProject.unmarshal(yaml_loaded_data)

expected = (
f'To use the unstable base "{CURRENT_DEVEL_BASE}", '
Expand All @@ -737,7 +747,7 @@ def test_project_devel_base(yaml_loaded_data):


def test_get_effective_devel_base(yaml_loaded_data):
yaml_loaded_data["base"] = CURRENT_DEVEL_BASE
yaml_loaded_data["base"] = "[email protected]"
yaml_loaded_data["build-base"] = "devel"
project = Project.unmarshal(yaml_loaded_data)

Expand All @@ -750,6 +760,6 @@ def test_devel_base_warning(yaml_loaded_data, emitter):
yaml_loaded_data["base"] = CURRENT_DEVEL_BASE
yaml_loaded_data["build-base"] = "devel"
del yaml_loaded_data["entrypoint-service"]
_ = Project.unmarshal(yaml_loaded_data)
_ = DevelProject.unmarshal(yaml_loaded_data)

emitter.assert_message(DEVEL_BASE_WARNING)

0 comments on commit 4d5e467

Please sign in to comment.