[OE-core] [PATCH] package: handle package name with spaces

Felipe F. Tonello eu at felipetonello.com
Mon May 9 12:08:33 UTC 2016


Gracefuly handle the odd case when a desired file name used to build a package
or used as path for files in a package has spaces.

In that case, this patch ensures that do_split_packages adds files, even with
spaces, to the package.

Signed-off-by: Felipe F. Tonello <eu at felipetonello.com>
---
 meta/classes/package.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index ffd4eff7b140..98206e4ce859 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -69,7 +69,7 @@ def legitimize_package_name(s):
     s = re.sub('<U([0-9A-Fa-f]{1,4})>', fixutf, s)
 
     # Remaining package name validity fixes
-    return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
+    return s.lower().replace(' ', '-').replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
 
 def do_split_packages(d, root, file_regex, output_pattern, description, postinst=None, recursive=False, hook=None, extra_depends=None, aux_files_pattern=None, postrm=None, allow_dirs=False, prepend=False, match_path=False, aux_files_pattern_verbatim=None, allow_links=False, summary=None):
     """
@@ -119,6 +119,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
                       defaults to description if not set.
 
     """
+    import re
 
     dvar = d.getVar('PKGD', True)
     root = d.expand(root)
@@ -193,8 +194,11 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
         newfile = os.path.join(root, o)
         # These names will be passed through glob() so if the filename actually
         # contains * or ? (rare, but possible) we need to handle that specially
+        # Also, in order to support filename with spaces, we have to replace it
+        # with * wildcard character
         newfile = newfile.replace('*', '[*]')
         newfile = newfile.replace('?', '[?]')
+        newfile = re.sub(' +', '*', newfile) # Support spaces in packages
         if not oldfiles:
             the_files = [newfile]
             if aux_files_pattern:
-- 
2.8.2




More information about the Openembedded-core mailing list