summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorAndré Draszik <andre.draszik@jci.com>2019-02-05 02:32:29 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-02-06 08:29:06 +0000
commitd05823086d0299272d2aea7ba440d3dae21c48ba (patch)
treea6ade764828e2d19265c971d8ece9a917123233a /meta/classes
parent34ec0fce5f5887473437a0d23f898e5e780e5b99 (diff)
downloadpoky-d05823086d0299272d2aea7ba440d3dae21c48ba.tar.gz
update-alternatives: correctly escape PATHs when updating FILES_${PN}
The recently added support for updating FILES based on the file renames that are happening here is using a regex replace, but failed to properly escape the search pattern (the full path). This manifests itself in FILES not being updated as soon as the full path contains any character that has a special meaning, e.g. '+'. In other words an original path (alt_target in the code) like /opt/poky/2.6+snapshot/sysroots/i686-pokysdk-linux/sbin/losetup can't be matched, and hence we fail to update FILES with the new value, causing packaging errors. Fix by using re.escape() on the original path before passing into re.sub() Fixes: 5c23fe378732 ("update-alternatives: try to update FILES_${PN} when renaming a file"), or bcb3e7b7f88a in poky.git [YOCTO #13058] (From OE-Core rev: 126743162397e4145902b3f127f2dafd80a8a49b) Signed-off-by: André Draszik <andre.draszik@jci.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/update-alternatives.bbclass4
1 files changed, 2 insertions, 2 deletions
diff --git a/meta/classes/update-alternatives.bbclass b/meta/classes/update-alternatives.bbclass
index e252651128..537e85d9a3 100644
--- a/meta/classes/update-alternatives.bbclass
+++ b/meta/classes/update-alternatives.bbclass
@@ -138,12 +138,12 @@ python apply_update_alternative_renames () {
138 if not update_alternatives_enabled(d): 138 if not update_alternatives_enabled(d):
139 return 139 return
140 140
141 from re import sub 141 import re
142 142
143 def update_files(alt_target, alt_target_rename, pkg, d): 143 def update_files(alt_target, alt_target_rename, pkg, d):
144 f = d.getVar('FILES_' + pkg) 144 f = d.getVar('FILES_' + pkg)
145 if f: 145 if f:
146 f = sub(r'(^|\s)%s(\s|$)' % alt_target, r'\1%s\2' % alt_target_rename, f) 146 f = re.sub(r'(^|\s)%s(\s|$)' % re.escape (alt_target), r'\1%s\2' % alt_target_rename, f)
147 d.setVar('FILES_' + pkg, f) 147 d.setVar('FILES_' + pkg, f)
148 148
149 # Check for deprecated usage... 149 # Check for deprecated usage...