parts: replace snapcraft command-chain with environment
Metadata
Current evaluation
Merged updates replacing snapcraft command-chain with global environment variables (LD_LIBRARY_PATH and PATH) for core22 snaps. The adapter field is deprecated. Approved and merged after passing CI checks.
Suggested action: —
No scores available.
Issue body
Changes for core22 snaps:
1. Pass `command_chain` to snap.yaml.
2. Deprecate `adapter` field.
3. Replace `snapcraft_runner` and it's entry in the `command_chain` with global environment variables (`LD_LIBRARY_PATH` and `PATH`).
4. Assume `command-chain` if app or hook `command-chain`s are declared.
<br />
Behavior for overriding `LD_LIBRARY_PATH` and `PATH` in snapcraft.yaml:
- If `LD_LIBRARY_PATH` or `PATH` are defined, keep user-defined values.
- If `LD_LIBRARY_PATH` or `PATH` are not defined, set to default values.
- If `LD_LIBRARY_PATH` or `PATH` are null, do not use default values
<br />
Default values:
- `LD_LIBRARY_PATH`: `$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH`
- `PATH`: `$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH`
<br />
LP: #[1973173](https://bugs.launchpad.net/snapcraft/+bug/1973173)
CRAFT-1065
Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
Co-authored-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `make lint`?
- [x] Have you successfully run `pytest tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged updates replacing snapcraft command-chain with global environment variables (LD_LIBRARY_PATH and PATH) for core22 snaps. The adapter field is deprecated. Approved and merged after passing CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged replacement of snapcraft command-chain with environment variables (LD_LIBRARY_PATH and PATH) for core22 snaps. Deprecated the adapter field and updated env handling. Successfully merged into main after passing checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Replaces snapcraft command-chain with global environment variables for core22 snaps, deprecates the adapter field, and applies default LD_LIBRARY_PATH and PATH values unless overridden or nullified. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1794261 Put environment in command-chain instead of the opaque wrapper | snapcraft (launchpad) | closed | Closed and implemented as part of the command-chain migration. Environment configuration was moved to a separate binary, replacing the opaque wrapper approach for snapcraft applications. | |
| #3208 snap: set PATH for snapcraft command | snapcraft | merged | Merged to configure the PATH for the snapcraft command in the build environment, ensuring parity with launchpad buildd and destructive-mode instances. Approved, passed CI, and modified three files. | |
| #2897 meta: include environment in hook wrappers | snapcraft | merged | Merged a fix restoring environment variable inclusion for Snapcraft hook wrappers, correcting a regression that limited it to apps. Approved, passed CI, and modified three files. Resolves LP #1824255. |