[oe-commits] [openembedded-core] 23/62: systemd: allow dots in arguments to template units

git at git.openembedded.org git at git.openembedded.org
Sat Jan 6 10:14:58 UTC 2018


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch rocko
in repository openembedded-core.

commit e6fcc7d31b9105e518cf8a69d04f60291b7dd8fb
Author: Martin Hundebøll <mnhu at prevas.dk>
AuthorDate: Thu Nov 23 13:24:10 2017 +0100

    systemd: allow dots in arguments to template units
    
    When installing systemd template units with an argument, the current code
    removes characters between the '@' and the '.' from service names in
    SYSTEMD_SERVICE_${PN}, e.g.:
    
      getty at tty1.service -> getty at .service
    
    This fails for services with dots in the argument (which is perfectly
    legal in systemd), since the code searches only until the first dot.
    E.g.:
    
      vlan at eth0.1.service -> vlan at 1.service
    
    This is obviously wrong, and fails in systemd_populate_packages(), where
    it fails to find the unit file.
    
    Fix this by reworking the removal of the argument part of the service
    name, so that parts before '@' and after teh last '.' are used as base
    name.
    
    Signed-off-by: Martin Hundebøll <mnhu at prevas.dk>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    (cherry picked from commit 4704bd91458a728f28cbdc57dcf78f5d04cfd0cd)
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 meta/classes/systemd.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index c4b4bb9..1b13432 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -154,8 +154,10 @@ python systemd_populate_packages() {
                 # Deal with adding, for example, 'ifplugd at eth0.service' from
                 # 'ifplugd at .service'
                 base = None
-                if service.find('@') != -1:
-                    base = re.sub('@[^.]+.', '@.', service)
+                at = service.find('@')
+                if at != -1:
+                    ext = service.rfind('.')
+                    base = service[:at] + '@' + service[ext:]
 
                 for path in searchpaths:
                     if os.path.exists(oe.path.join(d.getVar("D"), path, service)):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list