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

switch-to-configuration-ng: update rust-ini to support multi-line INI… #343145

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion nixos/tests/switch-test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,15 @@ in {
systemd.services."escaped\\x2ddash".serviceConfig.X-Test = "test";
};

unitWithMultilineValue.configuration = {
systemd.services.test.serviceConfig.ExecStart = ''
${pkgs.coreutils}/bin/true \
# ignored
; ignored
blah blah
'';
};

unitStartingWithDash.configuration = {
systemd.services."-" = {
wantedBy = [ "multi-user.target" ];
Expand Down Expand Up @@ -874,9 +883,16 @@ in {
machine.succeed("! test -e /run/current-system/dry-activate")
machine.succeed("! test -e /run/current-system/bin/switch-to-configuration")

# Ensure units with multiline values work
out = switch_to_specialisation("${machine}", "unitWithMultilineValue")
assert_lacks(out, "NOT restarting the following changed units:")
assert_lacks(out, "reloading the following units:")
assert_lacks(out, "restarting the following units:")
assert_lacks(out, "the following new units were started:")
assert_contains(out, "starting the following units: test.service")

# Ensure \ works in unit names
out = switch_to_specialisation("${machine}", "unitWithBackslash")
assert_contains(out, "stopping the following units: test.service\n")
assert_lacks(out, "NOT restarting the following changed units:")
assert_lacks(out, "reloading the following units:")
assert_lacks(out, "\nrestarting the following units:")
Expand Down
5 changes: 4 additions & 1 deletion pkgs/by-name/sw/switch-to-configuration-ng/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ rustPlatform.buildRustPackage {

src = ./src;

cargoLock.lockFile = ./src/Cargo.lock;
cargoLock = {
lockFile = ./src/Cargo.lock;
outputHashes."rust-ini-0.21.1" = "sha256-0nSBhme/g+mVsYdiq0Ash0ek9WEdvbf/b9FRxA7sauk=";
};

nativeBuildInputs = [ pkg-config ];
buildInputs = [ dbus ];
Expand Down
5 changes: 2 additions & 3 deletions pkgs/by-name/sw/switch-to-configuration-ng/src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion pkgs/by-name/sw/switch-to-configuration-ng/src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ glob = "0.3.1"
log = "0.4.21"
nix = { version = "0.28.0", features = ["fs", "signal"] }
regex = "1.10.4"
rust-ini = "0.21.0"
rust-ini = { git = "https://github.com/zonyitoo/rust-ini", rev = "5748ae57a178216a920b88dfac1296618e967447", features = [
"inline-comment",
] }
syslog = "6.1.1"

[build-dependencies]
Expand Down