### Meson Build Setup Source: https://github.com/networkmanager/networkmanager/blob/main/CONTRIBUTING.md Example of setting up the meson build environment with custom options. ```bash meson setup build -Ddocs=true ``` -------------------------------- ### Build and Install Source: https://github.com/networkmanager/networkmanager/blob/main/src/c-list/README.md Commands to build and install the c-list project using the meson build system. ```sh mkdir build cd build meson setup .. ninja meson test ninja install ``` -------------------------------- ### Build and Install from Source Source: https://github.com/networkmanager/networkmanager/blob/main/src/c-rbtree/README.md Commands to build and install the c-rbtree project using the meson build system. ```sh mkdir build cd build meson setup .. ninja Meson test ninja install ``` -------------------------------- ### Example Commit for Backporting Source: https://github.com/networkmanager/networkmanager/blob/main/MAINTAINERS.md This is an example of the output expected after a successful backport to 1.32, showing the commit details. ```text commit c94b1c43d4b5c5b88d67d7966d23a005028e78d8 Author: Thomas Haller Date: Wed Sep 1 09:30:29 2021 +0200 cloud-setup: return structure for get_config() result instead of generic hash table Returning a struct seems easier to understand, because then the result is typed. Also, we might return additional results, which are system wide and not per-interface. (cherry picked from commit 323e18276894591712a5e29f6e907562c79c5216) ``` -------------------------------- ### Standard Header Includes Source: https://github.com/networkmanager/networkmanager/blob/main/CONTRIBUTING.md Example of standard header includes for C source files in NetworkManager. ```C /* SPDX-License-Identifier: LGPL-2.1-or-later */ #include "$BASE/nm-default$EXTRA.h" ``` -------------------------------- ### Backporting API Example 1 Source: https://github.com/networkmanager/networkmanager/blob/main/MAINTAINERS.md Example of backporting new API from main to an old branch before a stable release. ```git 8763e6da9c5adb3c4ccf3b2713dbcc25a91c5ede 90671a30b771d418953bd021d50c3cc43f253e6e 551fd3e28f6b142bd57eefacfaf96b8fb8e309dd ``` -------------------------------- ### Backporting API Example 2 Source: https://github.com/networkmanager/networkmanager/blob/main/MAINTAINERS.md Example of backporting new API that is already in a stable release, requiring duplicate symbols. ```git 2e2ff6f27aa1bfa7a27d49980b319873240ec84b 19d7e66099ee43f47d6be0e740dc710fc365d200 5eade4da11ee38a0e7faf4a87b2c2b5af07c5eeb ``` -------------------------------- ### Cscope Source Indexing Source: https://github.com/networkmanager/networkmanager/blob/main/CONTRIBUTING.md Example of setting the SOURCEDIRS environment variable for cscope to include additional source trees and then building the cscope database. ```bash export SOURCEDIRS=/path/to/glib:/path/to/libndp cscope -b -q -R -ssrc ``` -------------------------------- ### Meson Option Definition Source: https://github.com/networkmanager/networkmanager/blob/main/src/c-stdaux/meson_options.txt Example of a Meson build option definition for 'version-scripts'. ```meson option( 'version-scripts', choices: ['yes', 'no', 'auto'], description: 'Enable GNU-version-scripts for linking', type: 'combo', value: 'auto', ) ``` -------------------------------- ### Example journalctl commands for WiFi issues Source: https://github.com/networkmanager/networkmanager/blob/main/CONTRIBUTING.md When reporting WiFi-related issues, it's helpful to include logs from NetworkManager and the relevant WiFi supplicant (wpa_supplicant or iwd). ```bash journalctl -u NetworkManager -u wpa_supplicant ``` ```bash journalctl -u NetworkManager -u iwd ``` -------------------------------- ### nm_device_is_available function Source: https://github.com/networkmanager/networkmanager/blob/main/docs/internal/device.md Example of how the nm_device_is_available function calls the virtual method is_available() from the NMDevice class. ```c gboolean nm_device_is_available(NMDevice *self, NMDeviceCheckDevAvailableFlags flags) { ... return NM_DEVICE_GET_CLASS(self)->is_available(self, flags); } ``` -------------------------------- ### Configure build environment with meson Source: https://github.com/networkmanager/networkmanager/blob/main/CONTRIBUTING.md Command to set up the build environment using meson. ```bash meson setup build/ $CONFIGURE_OPTIONS ninja -C build ``` -------------------------------- ### Meson Configure Options Source: https://github.com/networkmanager/networkmanager/blob/main/CONTRIBUTING.md Command to list all possible configuration options for meson. ```bash meson configure ``` -------------------------------- ### Run Unit Tests Source: https://github.com/networkmanager/networkmanager/blob/main/CONTRIBUTING.md Command to run all unit tests using meson. ```bash meson test -C build ``` -------------------------------- ### Help command for nm-in-vm Source: https://github.com/networkmanager/networkmanager/blob/main/tools/nm-guest-data/README.md Shows how to view the help options for the nm-in-vm script. ```bash ./nm-in-vm --help ``` -------------------------------- ### Help command for nm-in-container Source: https://github.com/networkmanager/networkmanager/blob/main/tools/nm-guest-data/README.md Shows how to view the help options for the nm-in-container script. ```bash ./nm-in-container --help ``` -------------------------------- ### Tagging a commit with a signed tag Source: https://github.com/networkmanager/networkmanager/blob/main/MAINTAINERS.md Example command to create a signed Git tag for a release. ```bash git tag -s 1.2.8 -m 'Release 1.2.8' ``` -------------------------------- ### Pushing a tag to origin Source: https://github.com/networkmanager/networkmanager/blob/main/MAINTAINERS.md Example command to push a signed Git tag to the remote repository. ```bash git push origin 1.2.8 ``` -------------------------------- ### Git Configuration for Notes Source: https://github.com/networkmanager/networkmanager/blob/main/CONTRIBUTING.md Commands to configure Git to use 'refs/notes/bugs' for tracking. ```bash $ git config --add 'remote.origin.fetch' 'refs/notes/bugs:refs/notes/bugs' $ git config --add 'notes.displayref' 'refs/notes/bugs' ``` -------------------------------- ### Configure interface renaming via udev rule Source: https://github.com/networkmanager/networkmanager/blob/main/contrib/fedora/rpm/readme-ifcfg-rh.txt Example content for a /etc/udev/rules.d/70-interface-names.rules file to rename an interface based on its MAC address. ```udev SUBSYSTEM=="net",ACTION=="add",ATTR{address}=="00:11:22:33:44:56",ATTR{type}=="1",NAME="ethernet1" ``` -------------------------------- ### Fedora/RHEL/CentOS RPM Build Source: https://github.com/networkmanager/networkmanager/blob/main/CONTRIBUTING.md Script to build an RPM from upstream sources on Fedora/RHEL/CentOS. ```bash ./contrib/fedora/rpm/build_clean.sh -r ``` -------------------------------- ### Configure interface renaming via .link file Source: https://github.com/networkmanager/networkmanager/blob/main/contrib/fedora/rpm/readme-ifcfg-rh.txt Example content for a /etc/systemd/network/70-rename.link file to rename an interface based on its MAC address. ```ini [Match] MACAddress=00:11:22:33:44:56 [Link] Name=ethernet1 ``` -------------------------------- ### Resyncing Local Git Notes Source: https://github.com/networkmanager/networkmanager/blob/main/CONTRIBUTING.md Command to resync local Git notes with the remote. ```bash $ git fetch origin refs/notes/bugs:refs/notes/bugs -f ```