]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
systemd.bbclass: support template files with dots
authorJason M. Bills <jason.m.bills@linux.intel.com>
Wed, 22 Oct 2025 15:05:17 +0000 (08:05 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 27 Oct 2025 11:37:39 +0000 (11:37 +0000)
If the SYSTEMD_SERVICE variable contains a template instance that has
dots in the name such as "xyz.openbmc_project.my@instance.service", the
regex splits on all the dots resulting in the following python
exception:

Exception: ValueError: too many values to unpack (expected 3)

To continue to support service files with dots in the name, this changes
to first split only on the '@' to isolate the name, then split the
second half on the last dot to get the remaining two parameters.
Splitting on the last dot allows dots in the instance name, as well.

Confirmed when building that the three parameters for template instances
without dots came out the same and that template instances with dots
include the full name with dots in the first parameter.

Confirmed when using an instance name with dots that the full instance
name came out correctly with dots.

CC: Ross Burton <Ross.Burton@arm.com>
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/systemd.bbclass

index 5a0550b287b4f2803543dd446888a79affe70b16..562e71fb56eb81b1beab2bc5d733c73c91f0d16e 100644 (file)
@@ -247,7 +247,8 @@ python systemd_populate_packages() {
                 if not systemd_service_exists(service, user, d):
                     continue
                 if '@' in service and '@.' not in service:
-                    (servicename, instance, service_type) = re.split('[@.]', service)
+                    (servicename, postfix) = service.split('@')
+                    (instance, service_type) = postfix.rsplit('.', 1)
                     template_services.setdefault(servicename + '@.' + service_type, []).append(instance)
                 else:
                     template_services.setdefault(service, [])