Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make chisel a build snap #464

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/how-to/code/install-slice/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ parts:
plugin: nil
source: chisel-releases/
source-type: local
stage-snaps:
linostar marked this conversation as resolved.
Show resolved Hide resolved
- "chisel/latest/candidate"
override-build:
chisel cut --release ./ --root ${CRAFT_PART_INSTALL} openssl_bins
11 changes: 11 additions & 0 deletions rockcraft/services/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,25 @@ def setup(self) -> None:
# This inner import is necessary to resolve a cyclic import
from rockcraft.services import RockcraftServiceFactory

# this will be removed once part_has_slices is added to craft-parts
def part_has_slices(data: dict[str, Any]) -> bool:
stage_packages = data.get("stage-packages", [])
return any(name for name in stage_packages if "_" in name)

Comment on lines +48 to +52
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still within this PR right? Since we're waiting for canonical/craft-parts#637

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

# Configure extra args to the LifecycleManager
project = cast(Project, self._project)
project_vars = {"version": project.version}
parts = project.parts

services = cast(RockcraftServiceFactory, self._services)
image_service = services.image
image_info = image_service.obtain_image()
needs_chisel = any(part for part in parts if part_has_slices(parts[part]))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this will also slightly change after canonical/craft-parts#637

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it will become craft_parts.part_has_slices instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can move detection and chisel installing to craft-parts, it already does that with other tools such as git.


if needs_chisel:
self._manager_kwargs.update(
extra_build_snaps=["chisel/latest/candidate"],
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit worried about using a "dynamic" candidate snap here. Is there a plan/timeline for stable chisel?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not before 13th of Feb, but most likely towards the end of that month.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a discussion with Cris about this, and he said it's ok if we wait until chisel stable is released before we merge this one.

)
self._manager_kwargs.update(
base_layer_dir=image_info.base_layer_dir,
base_layer_hash=image_info.base_digest,
Expand Down
9 changes: 0 additions & 9 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,3 @@ parts:
- libbtrfs-dev
- libdevmapper-dev
- pkg-config

chisel:
plugin: nil
stage-snaps:
- chisel/latest/candidate
organize:
bin/chisel: libexec/rockcraft/chisel
stage:
- libexec/rockcraft/chisel
Loading