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

Enable building via Meson build system #268

Merged
merged 20 commits into from
Mar 23, 2022
Merged

Enable building via Meson build system #268

merged 20 commits into from
Mar 23, 2022

Conversation

slyon
Copy link
Collaborator

@slyon slyon commented Mar 17, 2022

Description

Adding a Meson build environment in addition to the plain Makefile netplan is using currently.
The new build system should be able to support all the Makefile's features and implement them in a more standard conform way. Furthermore, using Meson we'll be able to extend the build-time features more easily in the future, like implementing build-time options and properly acknowledging dpkg buildflags (hardening/LTO/...).

Meson is easy to use, here are some sample commands, to do the usual netplan stuff:

  • meson setup build --prefix=/usr [-Db_coverage=true]
  • meson compile -C build
  • meson test -C build --verbose [TEST_NAME]
  • meson install -C build --destdir ../tmproot

All things are done inside the build directory, specified during the meson setup command ("build" in the example above), except the code generated in src/_features.h and python/_features.py, that is still inside the source directory.

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad.

@slyon slyon force-pushed the slyon/meson branch 2 times, most recently from ecf46a9 to 2603961 Compare March 18, 2022 13:41
@codecov-commenter
Copy link

codecov-commenter commented Mar 18, 2022

Codecov Report

Merging #268 (8fe20ce) into main (2e84550) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head 8fe20ce differs from pull request most recent head 873d3a2. Consider uploading reports for the commit 873d3a2 to get more accurate results

@@            Coverage Diff             @@
##             main     #268      +/-   ##
==========================================
- Coverage   99.07%   99.07%   -0.01%     
==========================================
  Files          61       61              
  Lines       10867    10864       -3     
==========================================
- Hits        10767    10764       -3     
  Misses        100      100              
Impacted Files Coverage Δ
netplan/cli/utils.py 100.00% <ø> (ø)
tests/test_libnetplan.py 100.00% <ø> (ø)
tests/dbus/test_dbus.py 100.00% <100.00%> (ø)
tests/generator/base.py 100.00% <100.00%> (ø)
tests/parser/base.py 100.00% <100.00%> (ø)
tests/parser/test_keyfile.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2e84550...873d3a2. Read the comment docs.

.gitignore Outdated Show resolved Hide resolved
systemd_unit_dir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir')
bash_completions_dir = completions.get_variable(pkgconfig: 'completionsdir', default_value: '/etc/bash_completion.d')

pandoc = find_program('pandoc', required: false)

Choose a reason for hiding this comment

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

You might want to use a meson_options.txt feature option for this. That would allow people to specify -Ddoc=disabled and force disable trying to detect pandoc or build anything with it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess I'd like to land an initial basic version first, before starting with customization and optimizations.

Thank you very much for your hints, though, those are very welcome!

endforeach
else
warning('Program "pandoc" not found! Cannot generate documentation/man pages')
endif

Choose a reason for hiding this comment

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

... and then you can skip this warning, because people who absolutely want the docs can configure it with enabled, people who are okay gracefully degrading can configure it with auto, and people who absolutely don't want a pandoc dependency can disable it and not get a big yellow warning.

@slyon slyon force-pushed the slyon/meson branch 2 times, most recently from 94793b6 to 8fe20ce Compare March 22, 2022 11:30
@slyon slyon marked this pull request as ready for review March 22, 2022 11:38
@slyon slyon requested a review from schopin-pro March 22, 2022 11:54
Copy link
Contributor

@schopin-pro schopin-pro left a comment

Choose a reason for hiding this comment

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

I'm not really familiar with Meson, so I'm discovering it here, but this all looks good, I only have a couple of minor questions/suggestions that can be skipped if in a hurry.

tests/cli.py Outdated Show resolved Hide resolved
Makefile Show resolved Hide resolved
README.md Show resolved Hide resolved
src/meson.build Outdated Show resolved Hide resolved
Co-authored-by: Simon Chopin <[email protected]>
@slyon
Copy link
Collaborator Author

slyon commented Mar 23, 2022

Thank you for all your comments! I'm going to merge this once all the tests passed.

@slyon slyon merged commit d692ce7 into main Mar 23, 2022
@slyon slyon deleted the slyon/meson branch March 23, 2022 11:47
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.

4 participants