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
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:
But Snapcraft cannot parse:
To Reproduce
snapcraft pack
Environment
n/a
snapcraft.yaml
Relevant log output
Additional context
No response