diff mbox series

[2/2] classes/package_rpm: streamline the logic in one of the condition blocks

Message ID 20240131120438.1097632-2-alex@linutronix.de
State Accepted, archived
Commit e6a8ca554509c0edf9fd36ced88165dc3caf0e87
Headers show
Series [1/2] classes/package_rpm: additionally escape \ and " in filenames | expand

Commit Message

Alexander Kanavin Jan. 31, 2024, 12:04 p.m. UTC
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 meta/classes-global/package_rpm.bbclass | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass
index c9354734756..ffa0623af1d 100644
--- a/meta/classes-global/package_rpm.bbclass
+++ b/meta/classes-global/package_rpm.bbclass
@@ -243,13 +243,11 @@  python write_specfile () {
                     p = path + '/' + dir
                     # All packages own the directories their files are in...
                     target.append(get_attr(dir) + '%dir "' + escape_chars(p) + '"')
-            else:
+            elif path:
                 # packages own only empty directories or explict directory.
                 # This will prevent the overlapping of security permission.
                 attr = get_attr(path)
-                if path and not files and not dirs:
-                    target.append(attr + '%dir "' + escape_chars(path) + '"')
-                elif path and path in dirfiles:
+                if (not files and not dirs) or path in dirfiles:
                     target.append(attr + '%dir "' + escape_chars(path) + '"')
 
             for file in files: