public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: "Jason M. Bills" <jason.m.bills@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Cc: "Jason M. Bills" <jason.m.bills@linux.intel.com>,
	Ross Burton <Ross.Burton@arm.com>
Subject: [PATCH v2] systemd.bbclass: support template files with dots
Date: Wed, 22 Oct 2025 08:05:17 -0700	[thread overview]
Message-ID: <20251022150517.153368-1-jason.m.bills@linux.intel.com> (raw)

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>
---
changes in v2:
- Changed the postfix split to rsplit only once to support instance
  names with dots.
---
 meta/classes-recipe/systemd.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/systemd.bbclass b/meta/classes-recipe/systemd.bbclass
index 5a0550b287..562e71fb56 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.rsplit('.', 1)
                     template_services.setdefault(servicename + '@.' + service_type, []).append(instance)
                 else:
                     template_services.setdefault(service, [])


                 reply	other threads:[~2025-10-22 15:05 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251022150517.153368-1-jason.m.bills@linux.intel.com \
    --to=jason.m.bills@linux.intel.com \
    --cc=Ross.Burton@arm.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox