From 17c86f6421c7a6b9c6884a3db949eecf9d96c065 Mon Sep 17 00:00:00 2001 From: Dariusz Duda Date: Thu, 23 Jan 2025 10:26:01 -0500 Subject: [PATCH] feat(PartSpec): add source-channel attribute (#981) Signed-off-by: Dariusz Duda --- craft_parts/parts.py | 1 + craft_parts/sources/sources.py | 1 + craft_parts/state_manager/pull_state.py | 1 + docs/reference/changelog.rst | 15 +++++++++++++++ tests/unit/features/overlay/test_parts.py | 1 + tests/unit/state_manager/test_pull_state.py | 2 ++ tests/unit/test_parts.py | 1 + 7 files changed, 22 insertions(+) diff --git a/craft_parts/parts.py b/craft_parts/parts.py index 87725b812..42806c348 100644 --- a/craft_parts/parts.py +++ b/craft_parts/parts.py @@ -50,6 +50,7 @@ class PartSpec(BaseModel): plugin: str | None = None source: str | None = None source_checksum: str = "" + source_channel: str | None = None source_branch: str = "" source_commit: str = "" source_depth: int = 0 diff --git a/craft_parts/sources/sources.py b/craft_parts/sources/sources.py index 7b60bec10..f10aa0688 100644 --- a/craft_parts/sources/sources.py +++ b/craft_parts/sources/sources.py @@ -173,6 +173,7 @@ def get_source_handler( source=part.spec.source, part_src_dir=part.part_src_dir, source_checksum=part.spec.source_checksum, + source_channel=part.spec.source_channel, source_branch=part.spec.source_branch, source_tag=part.spec.source_tag, source_depth=part.spec.source_depth, diff --git a/craft_parts/state_manager/pull_state.py b/craft_parts/state_manager/pull_state.py index 39460a3a4..97c1f9ad1 100644 --- a/craft_parts/state_manager/pull_state.py +++ b/craft_parts/state_manager/pull_state.py @@ -70,6 +70,7 @@ def properties_of_interest( "source-depth", "source-tag", "source-type", + "source-channel", "source-branch", "source-subdir", "source-submodules", diff --git a/docs/reference/changelog.rst b/docs/reference/changelog.rst index e9f0ebf2f..792df6a95 100644 --- a/docs/reference/changelog.rst +++ b/docs/reference/changelog.rst @@ -6,10 +6,18 @@ Changelog X.Y.Z (2025-MM-DD) ------------------ +New features: + +- Add new PartSpec property ``source-channel``. + Bug fixes: - Correctly handle ``source-subdir`` values on the ``go-use`` plugin. +Documentation: + +- Add missing links to GitHub releases. + 2.3.0 (2025-01-20) ------------------ @@ -30,6 +38,7 @@ Documentation: - Correct the Maven plugin docstring to refer to Maven from Go. +For a complete list of commits, check out the `2.3.0`_ release on GitHub. 2.2.2 (2025-01-13) ------------------ @@ -38,6 +47,7 @@ Documentation: - Add a cross-reference target for Poetry external links. +For a complete list of commits, check out the `2.2.2`_ release on GitHub. 2.2.1 (2024-12-19) ------------------ @@ -47,6 +57,8 @@ Bug fixes: - Fix how extras and groups are parsed for the :ref:`uv plugin`. +For a complete list of commits, check out the `2.2.1`_ release on GitHub. + 2.2.0 (2024-12-16) ------------------ @@ -722,6 +734,9 @@ For a complete list of commits, check out the `2.0.0`_ release on GitHub. .. _craft-cli issue #172: https://github.com/canonical/craft-cli/issues/172 .. _Poetry: https://python-poetry.org +.. _2.3.0: https://github.com/canonical/craft-parts/releases/tag/2.3.0 +.. _2.2.2: https://github.com/canonical/craft-parts/releases/tag/2.2.2 +.. _2.2.1: https://github.com/canonical/craft-parts/releases/tag/2.2.1 .. _2.2.0: https://github.com/canonical/craft-parts/releases/tag/2.2.0 .. _2.1.4: https://github.com/canonical/craft-parts/releases/tag/2.1.4 .. _2.1.3: https://github.com/canonical/craft-parts/releases/tag/2.1.3 diff --git a/tests/unit/features/overlay/test_parts.py b/tests/unit/features/overlay/test_parts.py index 9ef19f1b7..4c338fdfb 100644 --- a/tests/unit/features/overlay/test_parts.py +++ b/tests/unit/features/overlay/test_parts.py @@ -36,6 +36,7 @@ def test_marshal_unmarshal(self): "plugin": "nil", "source": "http://example.com/hello-2.3.tar.gz", "source-checksum": "md5/d9210476aac5f367b14e513bdefdee08", + "source-channel": None, "source-branch": "release", "source-commit": "2514f9533ec9b45d07883e10a561b248497a8e3c", "source-depth": 3, diff --git a/tests/unit/state_manager/test_pull_state.py b/tests/unit/state_manager/test_pull_state.py index 6859b8c8c..b25b6d1c1 100644 --- a/tests/unit/state_manager/test_pull_state.py +++ b/tests/unit/state_manager/test_pull_state.py @@ -92,6 +92,7 @@ def test_property_changes(self, properties): "source-depth", "source-tag", "source-type", + "source-channel", "source-branch", "source-subdir", "source-submodules", @@ -125,6 +126,7 @@ def test_extra_property_changes(self, properties): "source-depth", "source-tag", "source-type", + "source-channel", "source-branch", "source-subdir", "source-submodules", diff --git a/tests/unit/test_parts.py b/tests/unit/test_parts.py index 359179148..8790a719e 100644 --- a/tests/unit/test_parts.py +++ b/tests/unit/test_parts.py @@ -36,6 +36,7 @@ def test_marshal_unmarshal(self, partitions): "plugin": "nil", "source": "http://example.com/hello-2.3.tar.gz", "source-checksum": "md5/d9210476aac5f367b14e513bdefdee08", + "source-channel": None, "source-branch": "release", "source-commit": "2514f9533ec9b45d07883e10a561b248497a8e3c", "source-depth": 3,