Message ID | 20251015145936.857490-1-jason.m.bills@linux.intel.com |
---|---|
State | New |
Headers | show |
Series | systemd.bbclass: support template files with dots | expand |
diff --git a/meta/classes-recipe/systemd.bbclass b/meta/classes-recipe/systemd.bbclass index 5a0550b287..fcd47809b2 100644 --- a/meta/classes-recipe/systemd.bbclass +++ b/meta/classes-recipe/systemd.bbclass @@ -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.split('.') template_services.setdefault(servicename + '@.' + service_type, []).append(instance) else: template_services.setdefault(service, [])
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 dot to get the remaining two parameters. 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. Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com> --- meta/classes-recipe/systemd.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)