-
Notifications
You must be signed in to change notification settings - Fork 522
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
netdog: Enable conditional compilation based on network backend #2750
Conversation
This commit sets the `SYSTEMD_NETWORKD` environment variable during the RPM build stage, which is useful to trigger on and emit additional Rust cfgs for conditional compilation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm on the fence about merging this in the current state, since there's no real functionality tied to it, and it seems like an easy patch to maintain on a feature branch. If you can scope it down to netdog
then it's probably OK.
This commit enables conditional compilation of `netdog` based on the network backend. A temporary function has been added that reads the environment variable `SYSTEMD_NETWORKD`, and emits additional cfgs to direct compilation. This environment variable will be passed to the build if a user has enabled the build flag to use systemd-networkd rather than wicked in their variant.
f6e9d53
to
8a47c02
Compare
^ Scoped these changes to |
NET_BACKEND_OVERRIDE | ||
} else { | ||
DEFAULT_NET_BACKEND |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very much a nit: our other cfg!
compile guards use lowercase, kebab-case strings, e.g. aws-k8s
etc. So these screaming snake cases might look a little out of place at their usage sites.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actual cfgs emitted will be: wicked
and systemd-networkd
. These screaming snake case constants are set to those static strings. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah i see 👍
Issue number:
Related to #2449
Description of changes:
This set of temporary changes enables conditional compilation of
netdog
based on network backend. "Temporary" in this case means that these changes (similar to those in #2741 ) will be removed oncesystemd-networkd
development has finished.A new function
emit_net_backend_cfgs()
has been added tonetdog
'sbuild.rs
that triggers off theSYSTEMD_NETWORKD
environment variable that has been added to the build environment. The crate can now use the following to conditionally compile code:Testing done:
Added the following blurb to
netdog generate-net-config
to be conditionally compiled:systemd-networkd
build flag, I observed the above message in the journal. Without the flag, the message didn't show up.Terms of contribution:
By submitting this pull request, I agree that this contribution is dual-licensed under the terms of both the Apache License, version 2.0, and the MIT license.