diff --git a/.bumpversion.cfg b/.bumpversion.cfg index d1efa359c..99a117640 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 1.19.2 +current_version = 1.19.3 commit = True tag = True diff --git a/craft_parts/__init__.py b/craft_parts/__init__.py index be468cd1e..aa0df51a0 100644 --- a/craft_parts/__init__.py +++ b/craft_parts/__init__.py @@ -16,7 +16,7 @@ """Craft a project from several parts.""" -__version__ = "1.19.2" +__version__ = "1.19.3" from . import plugins from .actions import Action, ActionProperties, ActionType diff --git a/craft_parts/sequencer.py b/craft_parts/sequencer.py index 171b6fc77..ab6c75d81 100644 --- a/craft_parts/sequencer.py +++ b/craft_parts/sequencer.py @@ -256,7 +256,7 @@ def _run_step( self._add_action(part, step, reason=reason) state: states.StepState - part_properties = part.spec.marshal() + part_properties = {**part.spec.marshal(), **part.plugin_properties.marshal()} # create step state diff --git a/craft_parts/state_manager/reports.py b/craft_parts/state_manager/reports.py index 36afc044d..d74bfdb2e 100644 --- a/craft_parts/state_manager/reports.py +++ b/craft_parts/state_manager/reports.py @@ -16,12 +16,15 @@ """Provide a report on why a step is outdated.""" +import logging from dataclasses import dataclass from typing import List, Optional from craft_parts.steps import Step from craft_parts.utils import formatting_utils +logger = logging.getLogger(__name__) + @dataclass(frozen=True) class Dependency: @@ -123,6 +126,7 @@ def reason(self) -> str: reasons_count += 1 if self.dirty_properties: + logger.debug("dirty properties: %r", self.dirty_properties) # Be specific only if this is the only reason if reasons_count > 1 or len(self.dirty_properties) > 1: reasons.append("properties") @@ -130,6 +134,7 @@ def reason(self) -> str: reasons.append(f"{self.dirty_properties[0]!r} property") if self.dirty_project_options: + logger.debug("dirty project options: %r", self.dirty_project_options) # Be specific only if this is the only reason if reasons_count > 1 or len(self.dirty_project_options) > 1: reasons.append("options") @@ -137,6 +142,7 @@ def reason(self) -> str: reasons.append(f"{self.dirty_project_options[0]!r} option") if self.changed_dependencies: + logger.debug("changed dependencies: %r", self.changed_dependencies) # Be specific only if this is the only reason if reasons_count > 1 or len(self.changed_dependencies) > 1: reasons.append("dependencies") diff --git a/craft_parts/state_manager/step_state.py b/craft_parts/state_manager/step_state.py index 49008b8ce..7168c6651 100644 --- a/craft_parts/state_manager/step_state.py +++ b/craft_parts/state_manager/step_state.py @@ -16,6 +16,7 @@ """The step state preserves step execution context information.""" +import logging from abc import ABC, abstractmethod from pathlib import Path from typing import Any, Dict, List, Optional, Set @@ -24,6 +25,8 @@ from craft_parts.utils import os_utils +logger = logging.getLogger(__name__) + class MigrationState(YamlModel): """State information collected when migrating steps. @@ -155,11 +158,13 @@ def _get_differing_keys(dict1: Dict[str, Any], dict2: Dict[str, Any]) -> Set[str for key, dict1_value in dict1.items(): dict2_value = dict2.get(key) if dict1_value != dict2_value: + logger.debug("%s: %r != %r", key, dict1_value, dict2_value) differing_keys.add(key) for key, dict2_value in dict2.items(): dict1_value = dict1.get(key) if dict1_value != dict2_value: + logger.debug("%s: %r != %r", key, dict1_value, dict2_value) differing_keys.add(key) return differing_keys diff --git a/docs/changelog.rst b/docs/changelog.rst index 4b6ba24b7..bd5c77eb4 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -2,6 +2,11 @@ Changelog ********* +1.19.3 (2023-04-30) +------------------- + +- Fix plugin properties state in planning phase + 1.19.2 (2023-04-24) ------------------- diff --git a/docs/conf.py b/docs/conf.py index 7a6bf2578..1e91fbdde 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -37,7 +37,7 @@ author = "Canonical Ltd." # The full version, including alpha/beta/rc tags -release = "1.19.2" +release = "1.19.3" # -- General configuration --------------------------------------------------- diff --git a/setup.py b/setup.py index bc1b9db08..8718046a9 100644 --- a/setup.py +++ b/setup.py @@ -97,7 +97,7 @@ def is_rtd() -> bool: setup( name="craft-parts", - version="1.19.2", + version="1.19.3", description="Craft parts tooling", long_description=readme, author="Canonical Ltd.", diff --git a/tests/unit/test_sequencer.py b/tests/unit/test_sequencer.py index c1cdb1667..83b3ac9ec 100644 --- a/tests/unit/test_sequencer.py +++ b/tests/unit/test_sequencer.py @@ -21,6 +21,7 @@ from craft_parts.actions import Action, ActionProperties, ActionType from craft_parts.infos import ProjectInfo from craft_parts.parts import Part, PartSpec +from craft_parts.plugins.make_plugin import MakePluginProperties from craft_parts.sequencer import Sequencer from craft_parts.state_manager import states from craft_parts.steps import Step @@ -56,7 +57,14 @@ def test_sequencer_add_actions(new_dir): ) def test_sequencer_run_step(step, state_class, new_dir): info = ProjectInfo(arch="aarch64", application_name="test", cache_dir=new_dir) - p1 = Part("p1", {"stage": ["pkg"]}) + plugin_props = MakePluginProperties.unmarshal( + {"source": "src", "make-parameters": ["-Dfoo=bar"]} + ) + p1 = Part( + "p1", + {"plugin": "make", "stage": ["pkg"]}, + plugin_properties=plugin_props, + ) seq = Sequencer(part_list=[p1], project_info=info) seq._run_step(p1, step) @@ -73,8 +81,12 @@ def test_sequencer_run_step(step, state_class, new_dir): ] # check if states were updated - props = PartSpec.unmarshal({"stage": ["pkg"]}) - assert state.part_properties == props.marshal() + props = PartSpec.unmarshal({"plugin": "make", "stage": ["pkg"]}) + assert state.part_properties == { + **props.marshal(), + "source": "src", + "make-parameters": ["-Dfoo=bar"], + } assert state.project_options == { "application_name": "test", "arch_triplet": "aarch64-linux-gnu",