Skip to content

Commit

Permalink
Merge branch 'hotfix/1.19.3' into merge-1.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
cmatsuoka committed May 1, 2023
2 parents 80dc1cc + b91ad1e commit b7fc72a
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.19.2
current_version = 1.19.3
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion craft_parts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion craft_parts/sequencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions craft_parts/state_manager/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -123,20 +126,23 @@ 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")
else:
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")
else:
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")
Expand Down
5 changes: 5 additions & 0 deletions craft_parts/state_manager/step_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -24,6 +25,8 @@

from craft_parts.utils import os_utils

logger = logging.getLogger(__name__)


class MigrationState(YamlModel):
"""State information collected when migrating steps.
Expand Down Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog
*********

1.19.3 (2023-04-30)
-------------------

- Fix plugin properties state in planning phase

1.19.2 (2023-04-24)
-------------------

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
18 changes: 15 additions & 3 deletions tests/unit/test_sequencer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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",
Expand Down

0 comments on commit b7fc72a

Please sign in to comment.