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

Regression: Advanced grammar cannot be combined with other data #4764

Closed
mr-cal opened this issue Apr 29, 2024 · 2 comments · Fixed by canonical/craft-application#328
Closed
Labels
bug Actual bad behavior that don't fall into maintenance or documentation

Comments

@mr-cal
Copy link
Collaborator

mr-cal commented Apr 29, 2024

Bug Description

@kubiko raised a bug (LP#2061603) where grammar was applied before root-level keywords were applied to parts.

#4753 recently fixed this regression, but there is still another regression where grammar cannot be combined with other data.

For example, Snapcraft can parse:

build-packages:
  - on amd64:
    - gcc-aarch64-linux-gnu

But Snapcraft cannot parse:

build-packages:
  - build-essential
  - on amd64:
    - gcc-aarch64-linux-gnu

To Reproduce

snapcraft pack

Environment

n/a

snapcraft.yaml

name: test-snap
version: '0.1'
summary: test
description: test

grade: devel
confinement: devmode

base: core24

platforms:
  amd64:

parts:
  my-part:
    plugin: nil
    build-packages:
      - build-essential
      - on amd64:
        - gcc-aarch64-linux-gnu
      - on arm64:
        - gcc

Relevant log output

2024-04-29 07:28:16.113 Starting snapcraft, version 8.2.1
2024-04-29 07:28:16.113 Log verbosity level set to BRIEF
2024-04-29 07:28:16.115 Configuring application...
2024-04-29 07:28:16.115 Preparing application...
2024-04-29 07:28:16.116 Build plan: platform=None, build_for=None
2024-04-29 07:28:16.116 Loading project file '/tmp/foo/snapcraft.yaml'
2024-04-29 07:28:16.117 Setting target machine to x86_64
2024-04-29 07:28:16.122 Processing grammar (on amd64 for amd64)
2024-04-29 07:28:16.122 Processing grammar for plugin: nil
2024-04-29 07:28:16.122 Processing grammar for build-packages: ['build-essential', {'on amd64': ['gcc-aarch64-linux-gnu']}, {'on arm64': ['gcc']}]
2024-04-29 07:28:16.123 Bad snapcraft.yaml content:
- string type expected (in field 'parts.my-part.build-packages[1]')
- string type expected (in field 'parts.my-part.build-packages[2]')
2024-04-29 07:28:16.124 Traceback (most recent call last):
2024-04-29 07:28:16.124   File "/snap/snapcraft/11471/lib/python3.10/site-packages/snapcraft/models/project.py", line 826, in unmarshal
2024-04-29 07:28:16.124     project = Project(**data)
2024-04-29 07:28:16.124   File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
2024-04-29 07:28:16.124 pydantic.error_wrappers.ValidationError: 2 validation errors for Project
2024-04-29 07:28:16.124 parts -> my-part -> build-packages -> 1
2024-04-29 07:28:16.124   str type expected (type=type_error.str)
2024-04-29 07:28:16.124 parts -> my-part -> build-packages -> 2
2024-04-29 07:28:16.124   str type expected (type=type_error.str)
2024-04-29 07:28:16.124 Full execution log: '/home/developer/.local/state/snapcraft/log/snapcraft-20240429-072816.112973.log'

Additional context

No response

@mr-cal mr-cal added the bug Actual bad behavior that don't fall into maintenance or documentation label Apr 29, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2859.

This message was autogenerated

mr-cal added a commit that referenced this issue Apr 29, 2024
This regression test is for #4764

Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
mr-cal added a commit that referenced this issue Apr 29, 2024
This regression test is for #4764

Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
mr-cal added a commit that referenced this issue Apr 29, 2024
This regression test is for #4764

Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
mr-cal added a commit that referenced this issue Apr 29, 2024
This regression test is for #4764

Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
mr-cal added a commit that referenced this issue Apr 29, 2024
This regression test is for #4764

Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
mr-cal added a commit that referenced this issue Apr 29, 2024
This regression test is for #4764

Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
mr-cal added a commit that referenced this issue Apr 30, 2024
This regression test is for #4764

Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
mr-cal added a commit that referenced this issue Apr 30, 2024
This regression test is for #4764

Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
@mr-cal
Copy link
Collaborator Author

mr-cal commented Apr 30, 2024

Fixed via #4768

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Actual bad behavior that don't fall into maintenance or documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant