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

feat: make build plans for snaps with platforms #21

Merged
merged 13 commits into from
Sep 9, 2024
Merged

Conversation

lengau
Copy link
Collaborator

@lengau lengau commented Jul 25, 2024

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run tox?

Adds a function to make build plans for snaps that use the platforms keyword.

Fixes #5
Requires #39
CRAFT-3008

@lengau lengau requested a review from mr-cal July 25, 2024 22:29
@lengau lengau marked this pull request as draft July 26, 2024 15:07
@lengau lengau closed this Sep 4, 2024
@lengau lengau reopened this Sep 4, 2024
@lengau lengau requested a review from a team September 4, 2024 18:39
@lengau lengau marked this pull request as ready for review September 4, 2024 18:39
Copy link
Contributor

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

Looking good! I found some missing corner cases for some of snapcraft's esoteric base/build-base definitions

craft_platforms/snap/_build.py Outdated Show resolved Hide resolved
tests/unit/snap/test_build.py Show resolved Hide resolved
craft_platforms/snap/_build.py Outdated Show resolved Hide resolved
craft_platforms/snap/_build.py Outdated Show resolved Hide resolved
craft_platforms/snap/_build.py Outdated Show resolved Hide resolved
@lengau lengau requested a review from mr-cal September 5, 2024 23:46
Copy link
Contributor

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

Minor feedback on type: snapd and the docs but it looks good! Nice job catching the complexities of base/build-base combinations.

craft_platforms/snap/_build.py Outdated Show resolved Hide resolved
craft_platforms/snap/_build.py Outdated Show resolved Hide resolved
Copy link
Contributor

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

One more thought - base: devel should be an error, I don't think it is:

def test_base_devel_error():
    """'base: devel' raises an error."""
    build_plan = _build.get_platforms_snap_build_plan(
        base="devel",
        platforms={"amd64": None},
        build_base=None,
        snap_type="app",
    )

@lengau
Copy link
Collaborator Author

lengau commented Sep 6, 2024

@mr-cal I've added the devel error test - it simply calls the base unknown or invalid.

@lengau lengau requested review from a team and mr-cal September 6, 2024 14:42
tests/unit/snap/test_build.py Outdated Show resolved Hide resolved
@lengau
Copy link
Collaborator Author

lengau commented Sep 6, 2024

Re-requesting reviews from @mr-cal and @cmatsuoka because I've reworked this following our discussion

Copy link
Contributor

@mr-cal mr-cal left a comment

Choose a reason for hiding this comment

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

Looks great!

@mr-cal
Copy link
Contributor

mr-cal commented Sep 9, 2024

Note to self: With this latest design, we are moving some of the validation to snapcraft because craft-platforms will accept arbitrary base names.

For example, snapcraft is responsible for raising an error for base: devel or build-base: almalinux@9.

Copy link

@cmatsuoka cmatsuoka left a comment

Choose a reason for hiding this comment

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

Nice, this seems to follow all the rules established for snap bases and build-bases.

@cmatsuoka
Copy link

Can you add a PR description?

@lengau lengau merged commit 5278aa0 into main Sep 9, 2024
12 checks passed
@lengau lengau deleted the work/snap-plans branch September 9, 2024 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement get_platforms_snap_build_plan()
3 participants