[gnome-continuous-yocto/gnomeostree-3.28-rocko: 3919/8267] classes/package_rpm: handle square brackets in filenames



commit d008867e45b276e69da43adaed93a668800cccf3
Author: Paul Eggleton <paul eggleton linux intel com>
Date:   Thu Dec 22 15:19:56 2016 +1300

    classes/package_rpm: handle square brackets in filenames
    
    When constructing a spec file we list files and directory paths in the
    %files section. If ] or [ characters are in a file or directory name,
    rpm treats them as wildcards which will mean it won't properly match the
    filename. Instead, transform these into an ? wildcard so they don't
    cause a problem.
    
    (This fixes packaging the npm package "file-set" and anything that
    happens to depend upon it, since it includes tests with files that
    contain unusual characters including ] and [).
    
    (From OE-Core rev: f95adb749619e70920c6cc6cd01c6d02cd348fd8)
    
    Signed-off-by: Paul Eggleton <paul eggleton linux intel com>
    Signed-off-by: Ross Burton <ross burton intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 meta/classes/package_rpm.bbclass |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index 638cc1b..b9f049e 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -197,6 +197,8 @@ python write_specfile () {
             if path.endswith("DEBIAN") or path.endswith("CONTROL"):
                 continue
             path = path.replace("%", "%%%%%%%%")
+            path = path.replace("[", "?")
+            path = path.replace("]", "?")
 
             # Treat all symlinks to directories as normal files.
             # os.walk() lists them as directories.
@@ -216,6 +218,8 @@ python write_specfile () {
                     if dir == "CONTROL" or dir == "DEBIAN":
                         continue
                     dir = dir.replace("%", "%%%%%%%%")
+                    dir = dir.replace("[", "?")
+                    dir = dir.replace("]", "?")
                     # All packages own the directories their files are in...
                     target.append('%dir "' + path + '/' + dir + '"')
             else:
@@ -230,6 +234,8 @@ python write_specfile () {
                 if file == "CONTROL" or file == "DEBIAN":
                     continue
                 file = file.replace("%", "%%%%%%%%")
+                file = file.replace("[", "?")
+                file = file.replace("]", "?")
                 if conffiles.count(path + '/' + file):
                     target.append('%config "' + path + '/' + file + '"')
                 else:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]