diff options
| author | Bob Henz <robert_henz@jabil.com> | 2022-09-19 22:02:58 -0400 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-09-28 08:01:10 +0100 |
| commit | c653bfc68b06bfd4fa07ba18322599a130b1c59a (patch) | |
| tree | 86b8270f60c4a5463555145a33b100503919f5a5 | |
| parent | 931cc979a07dd83630649f62d4bad8590eb71bb7 (diff) | |
| download | poky-c653bfc68b06bfd4fa07ba18322599a130b1c59a.tar.gz | |
systemd-systemctl: Fix WantedBy processing
An empty string assignment to WantedBy should clear all prior WantedBy
settings. This matches behavior of the current systemd implementation.
(From OE-Core rev: 8ede0083c28fadf1e83c9256618190b931edd306)
Signed-off-by: Bob Henz <robert_henz@jabil.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | meta/recipes-core/systemd/systemd-systemctl/systemctl | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl index 6d19666d82..cddae75a06 100755 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl | |||
| @@ -26,6 +26,9 @@ locations = list() | |||
| 26 | 26 | ||
| 27 | class SystemdFile(): | 27 | class SystemdFile(): |
| 28 | """Class representing a single systemd configuration file""" | 28 | """Class representing a single systemd configuration file""" |
| 29 | |||
| 30 | _clearable_keys = ['WantedBy'] | ||
| 31 | |||
| 29 | def __init__(self, root, path, instance_unit_name): | 32 | def __init__(self, root, path, instance_unit_name): |
| 30 | self.sections = dict() | 33 | self.sections = dict() |
| 31 | self._parse(root, path) | 34 | self._parse(root, path) |
| @@ -80,6 +83,14 @@ class SystemdFile(): | |||
| 80 | v = m.group('value') | 83 | v = m.group('value') |
| 81 | if k not in section: | 84 | if k not in section: |
| 82 | section[k] = list() | 85 | section[k] = list() |
| 86 | |||
| 87 | # If we come across a "key=" line for a "clearable key", then | ||
| 88 | # forget all preceding assignments. This works because we are | ||
| 89 | # processing files in correct parse order. | ||
| 90 | if k in self._clearable_keys and not v: | ||
| 91 | del section[k] | ||
| 92 | continue | ||
| 93 | |||
| 83 | section[k].extend(v.split()) | 94 | section[k].extend(v.split()) |
| 84 | 95 | ||
| 85 | def get(self, section, prop): | 96 | def get(self, section, prop): |
