summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe
diff options
context:
space:
mode:
authorAdrian Freihofer <adrian.freihofer@siemens.com>2024-12-12 16:55:25 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-12-17 11:41:52 +0000
commitefa5f65c2214239ed7aaf7bd8998683e755c5660 (patch)
tree2c84a8f6288f081159184c33a3bfdd837db13e6f /meta/classes-recipe
parent0324f6974964b9bc32726e9cbb5b718d90c78503 (diff)
downloadpoky-efa5f65c2214239ed7aaf7bd8998683e755c5660.tar.gz
systemd.bbclass: do not automatically add Also services
Starting a systemd service “Also” does not mean that both services must be in the same package. However, the systemd.bbclass enforces this. Example: a.service: [Install] Also=b.service If a.service is packed in package A, b.service is automatically packed into package A as well. This happens even if b.service is explicitly added to package B using FILES and SYSTEMD_SERVICE variables. The automatic packing of socket files with the corresponding service files is probably a widely used feature of systemd.bbclass. This bahavior does not change. Adding regular service files to a package just because it is another service in the same package that "Also" uses the service is a bug that this commit fixes. (From OE-Core rev: f836d80eb48a2a2f9b1e66980021755cf0ca2a26) Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe')
-rw-r--r--meta/classes-recipe/systemd.bbclass14
1 files changed, 7 insertions, 7 deletions
diff --git a/meta/classes-recipe/systemd.bbclass b/meta/classes-recipe/systemd.bbclass
index be77da4812..4b4470b7b3 100644
--- a/meta/classes-recipe/systemd.bbclass
+++ b/meta/classes-recipe/systemd.bbclass
@@ -132,18 +132,18 @@ python systemd_populate_packages() {
132 # for *.service add *@.service 132 # for *.service add *@.service
133 service_base = service.replace('.service', '') 133 service_base = service.replace('.service', '')
134 systemd_add_files_and_parse(pkg_systemd, path, service_base + '@.service') 134 systemd_add_files_and_parse(pkg_systemd, path, service_base + '@.service')
135 # Add the socket unit which is referred by the Also= in this service file to the same package.
136 with open(fullpath, 'r') as unit_f:
137 for line in unit_f:
138 if line.startswith('Also'):
139 also_unit = line.split('=', 1)[1].strip()
140 if also_unit.find('.socket') != -1:
141 systemd_add_files_and_parse(pkg_systemd, path, also_unit)
135 if service.find('.socket') != -1: 142 if service.find('.socket') != -1:
136 # for *.socket add *.service and *@.service 143 # for *.socket add *.service and *@.service
137 service_base = service.replace('.socket', '') 144 service_base = service.replace('.socket', '')
138 systemd_add_files_and_parse(pkg_systemd, path, service_base + '.service') 145 systemd_add_files_and_parse(pkg_systemd, path, service_base + '.service')
139 systemd_add_files_and_parse(pkg_systemd, path, service_base + '@.service') 146 systemd_add_files_and_parse(pkg_systemd, path, service_base + '@.service')
140 # Add all units which have an Also= referring a unit in this package to this package as well.
141 with open(fullpath, 'r') as unit_f:
142 for line in unit_f:
143 if line.startswith('Also'):
144 also_unit = line.split('=', 1)[1].strip()
145 bb.warn("also: %s" % also_unit)
146 systemd_add_files_and_parse(pkg_systemd, path, also_unit)
147 147
148 # Check service-files and call systemd_add_files_and_parse for each entry 148 # Check service-files and call systemd_add_files_and_parse for each entry
149 def systemd_check_services(): 149 def systemd_check_services():