diff mbox series

systemd.bbclass: Check for existence of the symlink too

Message ID 20240209192727.4041133-2-pavel@zhukoff.net
State Accepted, archived
Commit 0010d9fbd25c343ecb18014cbe5d0dd036edb651
Headers show
Series systemd.bbclass: Check for existence of the symlink too | expand

Commit Message

Pavel Zhukov Feb. 9, 2024, 7:27 p.m. UTC
If the packages' service file is a link to parameterized service file
provided by different package [1] then link is dangling link at
do_package stage and os.path.exists(path) returns False even if the link
exists. Replace os.path.exists with lexists to fix this issue.

[1]
An example:
  Package A provides myservice@.service

  Package B depends and rdepends on A and provides:
  myservice@B.service -> myservice@.service

Signed-off-by: Pavel Zhukov <pavel@zhukoff.net>
---
 meta/classes-recipe/systemd.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/systemd.bbclass b/meta/classes-recipe/systemd.bbclass
index 9a16babe43..48b364c1d4 100644
--- a/meta/classes-recipe/systemd.bbclass
+++ b/meta/classes-recipe/systemd.bbclass
@@ -170,7 +170,7 @@  python systemd_populate_packages() {
                     base = service[:at] + '@' + service[ext:]
 
                 for path in searchpaths:
-                    if os.path.exists(oe.path.join(d.getVar("D"), path, service)):
+                    if os.path.lexists(oe.path.join(d.getVar("D"), path, service)):
                         path_found = path
                         break
                     elif base is not None: