Skip to content

many: add meson project files - #17681

Open
valentindavid wants to merge 1 commit into
canonical:masterfrom
valentindavid:valentindavid/meson-part-1
Open

valentindavid wants to merge 1 commit into
canonical:masterfrom
valentindavid:valentindavid/meson-part-1

Conversation

@valentindavid

@valentindavid valentindavid commented Sep 21, 2026 •

Copy link
Copy Markdown
Member

Quick start

Create a build directory

meson setup mybuild

Build

meson compile -C mybuild

Run tests and checks

meson test -C mybuild

Make a tarball

meson dist -C mybuild

@codecov

codecov Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.44%. Comparing base (7f54f8b) to head (96bc74f).
⚠️ Report is 4 commits behind head on master.

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     
Flag Coverage Δ
unittests 78.44% <ø> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@valentindavid
valentindavid force-pushed the valentindavid/meson-part-1 branch from 6d8cd31 to 92ef7c6 Compare September 21, 2026 10:13
@github-actions

github-actions Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Thu Sep 24 13:10:15 UTC 2026
The following results are from: https://github.com/canonical/snapd/actions/runs/35991425039

Test Predictor Analysis

Preparing

Test Success %
openstack:ubuntu-20.04-64:tests/main/nss-modules:winbind 🟢 88.4%
openstack:ubuntu-24.04-64:tests/main/remote-home:cifs 🟢 99.0%
openstack:ubuntu-26.04-64:tests/main/nss-modules:winbind 🟢 99.0%

Executing

Test Success %
openstack:ubuntu-20.04-64:tests/main/interfaces-browser-support:allow 🟢 90.0%
openstack:ubuntu-20.04-64:tests/main/interfaces-many-core-provided 🟢 90.0%
openstack:ubuntu-core-24-64:tests/main/snap-user-service-upgrade-failure 🟢 73.7%

Skipped tests from snapd-testing-skip

If 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)

  • openstack:arch-linux-64:tests/main/interfaces-location-control
  • openstack:debian-12-64:tests/main/interfaces-location-control
  • openstack:ubuntu-20.04-64:tests/main/interfaces-location-control
  • openstack:ubuntu-24.04-64:tests/main/auto-refresh-retry
  • openstack:ubuntu-24.04-64:tests/main/i18n
  • openstack:ubuntu-24.04-64:tests/main/interfaces-location-control
  • openstack:ubuntu-24.04-64:tests/main/network-retry
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-flag-restart
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-integration-tests
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-prompt-restoration
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-smoke
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-snapd-startup
  • openstack:ubuntu-26.04-64:tests/main/apparmor-prompting-support
  • openstack:ubuntu-26.04-64:tests/main/interfaces-location-control
  • openstack:ubuntu-26.04-64:tests/main/interfaces-requests-activates-handlers

@valentindavid
valentindavid force-pushed the valentindavid/meson-part-1 branch 3 times, most recently from bdea2b7 to 89d0944 Compare September 22, 2026 10:35
@bboozzoo
bboozzoo requested a balanced review from Copilot September 23, 2026 07:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 High severity · 3 Medium severity

Open (32)

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.

Comment on lines +1 to +5
# 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.
Comment thread checks/meson.build
Comment on lines +45 to +49
if clang_format.found() and meson.backend() == 'ninja'
ninja = find_program('ninja')
test('clang-format',
ninja,
args : ['clang-format-check'],

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Comment thread cmd/snap-cli-wrap/meson.build Outdated
Comment on lines +1 to +5
if get_option('selinux')
executable(
'snap',
'snap-cli-wrap.c',
install : true,
Comment thread cmd/snap-confine/meson.build Outdated
Comment on lines +1 to +3
executable(
'snap-confine',
'cookie-support.c',
Comment thread cmd/snap-confine/meson.build Outdated
Comment on lines +36 to +39
dependencies : [
libcap,
libudev,
],
Comment thread meson.build
capture : true,
command: [
env, '-C', meson.current_source_dir(), go.full_path(), 'run',
] + go_mod_args + tag_args + [
Comment thread setcap.sh Outdated

set -eu

setcap -q - "${MESON_INSTALL_DESTDIR_PREFIX}/usr/lib/snapd/snap-confine" <"${MESON_SOURCE_ROOT}/cmd/snap-confine/snap-confine.caps"
Comment thread checks/meson.build
Comment on lines +8 to +12
'http_status.sh',
'math_rand.sh',
'ioutil.sh',
'forbidden_cmd_go_deps.sh',
'check_mountinfo_override.sh',
Comment on lines +82 to +84
cfg = configuration_data({
'LIBEXECDIR': get_option('libexecdir'),
})
Comment on lines +1 to +5
executable(
'snap-gdbserver-shim',
'snap-gdbserver-shim.c',
install : true,
install_dir : get_option('libexecdir'),

@bboozzoo bboozzoo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you try and change the build on e.g. Arch to use it?

@valentindavid

Copy link
Copy Markdown
Member Author

Can you try and change the build on e.g. Arch to use it?

#17613 contains changes for arch, fedora and snapcraft.

@valentindavid

Copy link
Copy Markdown
Member Author

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.

@valentindavid
valentindavid force-pushed the valentindavid/meson-part-1 branch 3 times, most recently from 726adcb to d240118 Compare September 23, 2026 11:39
@valentindavid

Copy link
Copy Markdown
Member Author

Can you try and change the build on e.g. Arch to use it?

I have created draft PR: #17700

This does not touch the CI.

@valentindavid
valentindavid force-pushed the valentindavid/meson-part-1 branch 3 times, most recently from 2966b83 to f310afc Compare September 23, 2026 15:58
@valentindavid

Copy link
Copy Markdown
Member Author

Also cherry-picked the Fedora one and created #17705

@valentindavid

Copy link
Copy Markdown
Member Author

And #17706 for snapcraft.

This branch has not been deployed

No deployments
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.

3 participants