summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes-global/package_rpm.bbclass16
1 files changed, 8 insertions, 8 deletions
diff --git a/meta/classes-global/package_rpm.bbclass b/meta/classes-global/package_rpm.bbclass
index e0f4de42a1..819ee50278 100644
--- a/meta/classes-global/package_rpm.bbclass
+++ b/meta/classes-global/package_rpm.bbclass
@@ -216,10 +216,12 @@ python write_specfile () {
216 raise e 216 raise e
217 return "%attr({:o},{},{}) ".format(mode, owner, group) 217 return "%attr({:o},{},{}) ".format(mode, owner, group)
218 218
219 def escape_chars(p):
220 return p.replace("%", "%%")
221
219 path = rootpath.replace(walkpath, "") 222 path = rootpath.replace(walkpath, "")
220 if path.endswith("DEBIAN") or path.endswith("CONTROL"): 223 if path.endswith("DEBIAN") or path.endswith("CONTROL"):
221 continue 224 continue
222 path = path.replace("%", "%%%%%%%%")
223 225
224 # Treat all symlinks to directories as normal files. 226 # Treat all symlinks to directories as normal files.
225 # os.walk() lists them as directories. 227 # os.walk() lists them as directories.
@@ -238,29 +240,27 @@ python write_specfile () {
238 for dir in dirs: 240 for dir in dirs:
239 if dir == "CONTROL" or dir == "DEBIAN": 241 if dir == "CONTROL" or dir == "DEBIAN":
240 continue 242 continue
241 dir = dir.replace("%", "%%%%%%%%")
242 p = path + '/' + dir 243 p = path + '/' + dir
243 # All packages own the directories their files are in... 244 # All packages own the directories their files are in...
244 target.append(get_attr(dir) + '%dir "' + p + '"') 245 target.append(get_attr(dir) + '%dir "' + escape_chars(p) + '"')
245 else: 246 else:
246 # packages own only empty directories or explict directory. 247 # packages own only empty directories or explict directory.
247 # This will prevent the overlapping of security permission. 248 # This will prevent the overlapping of security permission.
248 attr = get_attr(path) 249 attr = get_attr(path)
249 if path and not files and not dirs: 250 if path and not files and not dirs:
250 target.append(attr + '%dir "' + path + '"') 251 target.append(attr + '%dir "' + escape_chars(path) + '"')
251 elif path and path in dirfiles: 252 elif path and path in dirfiles:
252 target.append(attr + '%dir "' + path + '"') 253 target.append(attr + '%dir "' + escape_chars(path) + '"')
253 254
254 for file in files: 255 for file in files:
255 if file == "CONTROL" or file == "DEBIAN": 256 if file == "CONTROL" or file == "DEBIAN":
256 continue 257 continue
257 file = file.replace("%", "%%%%%%%%")
258 attr = get_attr(file) 258 attr = get_attr(file)
259 p = path + '/' + file 259 p = path + '/' + file
260 if conffiles.count(p): 260 if conffiles.count(p):
261 target.append(attr + '%config "' + p + '"') 261 target.append(attr + '%config "' + escape_chars(p) + '"')
262 else: 262 else:
263 target.append(attr + '"' + p + '"') 263 target.append(attr + '"' + escape_chars(p) + '"')
264 264
265 # Prevent the prerm/postrm scripts from being run during an upgrade 265 # Prevent the prerm/postrm scripts from being run during an upgrade
266 def wrap_uninstall(scriptvar): 266 def wrap_uninstall(scriptvar):