many: add meson project files - #17681
valentindavid wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #17681 +/- ##
==========================================
+ Coverage 78.38% 78.44% +0.05%
==========================================
Files 1418 1409 -9
Lines 200785 200620 -165
Branches 2503 2503
==========================================
- Hits 157385 157376 -9
+ Misses 33968 33807 -161
- Partials 9432 9437 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
6d8cd31 to
92ef7c6
Compare
|
Thu Sep 24 13:10:15 UTC 2026 Test Predictor AnalysisPreparing
Executing
Skipped tests from snapd-testing-skipIf you wish to have any of the below tests run in your PR, in your PR description, add 'unskip:' followed by a copy-and-pasted list of the below tests you wish to run (unskip plus test list must be valid yaml)
|
bdea2b7 to
89d0944
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Unresolved critical and moderate issues affect configuration, linking, security integration, installation paths, and test coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 29
Open (32)
Add Bash shebang to directly executed check script · New Define missing clang-format-check target · New Wire SELinux support into snap-confine · New Enable SELinux support in snap-confine target · New Link snap-confine with libdl · New Avoid duplicate unit-tests target name · New Install void directory with mode 0111 · New Wire AppArmor support into snap-confine · New Rename duplicate unit-tests target · New Link snap-discard-ns with libcap · New Rename fourth duplicate unit-tests target · New Fix completion install destination · New Use absolute bindir in D-Bus Exec paths · New Use absolute paths in desktop entries · New Use absolute bindir in systemd ExecStart · New Install snapd failure handler unconditionally · New Invoke version.sh with a valid source path · New Enable AppArmor configuration and linking · New Configure AppArmor and SELinux support correctly · New Make rst2man lookup optional · New
And 12 more that still need to be addressed.
What changed in this PR
Adds Meson-based build, installation, packaging, testing, and static-check integration for snapd.
Changes:
- Adds Meson configuration and Go/C build targets.
- Adds system integration and packaging rules.
- Ports unit tests, formatting, and static checks to Meson.
| File | Description |
|---|---|
version.sh |
Handles build and distribution versions. |
vendor.sh |
Vendors Go and C dependencies. |
setcap.sh |
Applies installation capabilities. |
meson.options |
Defines Meson configuration options. |
meson.build |
Orchestrates builds, tests, installation, and packaging. |
info.version.in |
Templates version metadata. |
data/systemd/meson.build |
Installs systemd units. |
data/systemd-user/meson.build |
Installs user systemd units. |
data/systemd-tmpfiles/meson.build |
Installs tmpfiles configuration. |
data/systemd-env/meson.build |
Generates environment configuration. |
data/selinux/meson.build |
Builds and installs SELinux policy. |
data/polkit/meson.build |
Installs polkit policy. |
data/meson.build |
Registers data subdirectories. |
data/env/meson.build |
Generates shell environment files. |
data/dracut/meson.build |
Installs dracut configuration. |
data/desktop/meson.build |
Generates desktop integration files. |
data/dbus/meson.build |
Generates D-Bus service files. |
data/completion/zsh/meson.build |
Installs Zsh completion. |
data/completion/meson.build |
Registers completion subdirectories. |
data/completion/bash/meson.build |
Installs Bash completion. |
config.h.in |
Defines generated C configuration. |
cmd/system-shutdown/meson.build |
Builds shutdown support and tests. |
cmd/snapd/snap-cli.sh |
Provides the snap CLI wrapper. |
cmd/snapd-tool-wrap/meson.build |
Builds the tool wrapper. |
cmd/snapd-generator/meson.build |
Builds the systemd generator. |
cmd/snapd-env-generator/meson.build |
Builds the environment generator. |
cmd/snapd-env-generator/main.c |
Adjusts a private-header include. |
cmd/snap-strace-shim/meson.build |
Builds the strace shim. |
cmd/snap-mgmt/meson.build |
Generates management scripts. |
cmd/snap-gdb-shim/meson.build |
Builds the debugger shim. |
cmd/snap-discard-ns/meson.build |
Builds namespace cleanup tooling. |
cmd/snap-device-helper/meson.build |
Builds the device helper and tests. |
cmd/snap-confine/meson.build |
Builds snap-confine and related assets. |
cmd/snap-cli-wrap/meson.build |
Builds the SELinux CLI wrapper. |
cmd/meson.build |
Registers native command targets. |
cmd/libsnap-confine-private/meson.build |
Builds the private library and tests. |
checks/tests_formatting.sh |
Provides a formatting-check entry point. |
checks/shellcheck.sh |
Checks repository shell scripts. |
checks/shellcheck-spread.sh |
Checks Spread shell fragments. |
checks/register_ensure.sh |
Validates ensure registrations. |
checks/missing_interface_spread_test.sh |
Checks interface test coverage. |
checks/meson.build |
Registers static checks as tests. |
checks/mdlint.sh |
Checks Markdown files. |
checks/math_rand.sh |
Rejects direct math/rand usage. |
checks/ioutil.sh |
Rejects deprecated io/ioutil usage. |
checks/http_status.sh |
Checks HTTP status usage. |
checks/gopath.sh |
Checks GOPATH assumptions. |
checks/gofmt.sh |
Checks Go formatting. |
checks/forbidden_cmd_go_deps.sh |
Checks forbidden command dependencies. |
checks/equals.sh |
Checks ErrNoState comparisons. |
checks/check_mountinfo_override.sh |
Checks AppArmor mountinfo overrides. |
checks/bad_multiline.sh |
Checks Spread multiline syntax. |
checks/bad_match.sh |
Checks suspicious MATCH usage. |
.clang-format-include |
Selects C sources for formatting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| # This check verifies that interfaces that grant access to /proc/self/mountinfo | ||
| # (directly or not) also have a prioritized override (see basePrioritizedSnippets | ||
| # in interfaces/apparmor/template.go for why this is necessary). We do this | ||
| # by looking for a "AddPrioritizedSnippet(*, apparmor.MountInfoKey, ...)" call | ||
| # for any such interfaces. |
| if clang_format.found() and meson.backend() == 'ninja' | ||
| ninja = find_program('ninja') | ||
| test('clang-format', | ||
| ninja, | ||
| args : ['clang-format-check'], |
There was a problem hiding this comment.
| if get_option('selinux') | ||
| executable( | ||
| 'snap', | ||
| 'snap-cli-wrap.c', | ||
| install : true, |
| executable( | ||
| 'snap-confine', | ||
| 'cookie-support.c', |
| dependencies : [ | ||
| libcap, | ||
| libudev, | ||
| ], |
| capture : true, | ||
| command: [ | ||
| env, '-C', meson.current_source_dir(), go.full_path(), 'run', | ||
| ] + go_mod_args + tag_args + [ |
|
|
||
| set -eu | ||
|
|
||
| setcap -q - "${MESON_INSTALL_DESTDIR_PREFIX}/usr/lib/snapd/snap-confine" <"${MESON_SOURCE_ROOT}/cmd/snap-confine/snap-confine.caps" |
| 'http_status.sh', | ||
| 'math_rand.sh', | ||
| 'ioutil.sh', | ||
| 'forbidden_cmd_go_deps.sh', | ||
| 'check_mountinfo_override.sh', |
| cfg = configuration_data({ | ||
| 'LIBEXECDIR': get_option('libexecdir'), | ||
| }) |
| executable( | ||
| 'snap-gdbserver-shim', | ||
| 'snap-gdbserver-shim.c', | ||
| install : true, | ||
| install_dir : get_option('libexecdir'), |
bboozzoo
left a comment
There was a problem hiding this comment.
Can you try and change the build on e.g. Arch to use it?
#17613 contains changes for arch, fedora and snapcraft. |
I will need to resync it though. |
726adcb to
d240118
Compare
I have created draft PR: #17700 This does not touch the CI. |
2966b83 to
f310afc
Compare
f310afc to
96bc74f
Compare
|
Also cherry-picked the Fedora one and created #17705 |
|
And #17706 for snapcraft. |


Quick start
Create a build directory
Build
Run tests and checks
Make a tarball