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

This commit is contained in:
Emily 2024-10-02 16:04:20 +01:00 committed by GitHub
commit 7033ba8331
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 26 additions and 6 deletions

View File

@ -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" ];
@ -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:")

View File

@ -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 ];

View File

@ -337,9 +337,8 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"
[[package]]
name = "rust-ini"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d625ed57d8f49af6cfa514c42e1a71fadcff60eb0b1c517ff82fe41aa025b41"
version = "0.21.1"
source = "git+https://github.com/zonyitoo/rust-ini?rev=5748ae57a178216a920b88dfac1296618e967447#5748ae57a178216a920b88dfac1296618e967447"
dependencies = [
"cfg-if",
"ordered-multimap",

View File

@ -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]