summaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-10-03 17:02:48 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-14 16:55:24 +0100
commit567754acb80e5d1c6cabdb1dae1ea4fbea80e52a (patch)
treea88825e3bcb0187a6865d88de5c38e63c99859f7 /meta/classes/package.bbclass
parent029b0fef50fb118d4e09ac042338621d19a95bc8 (diff)
downloadpoky-567754acb80e5d1c6cabdb1dae1ea4fbea80e52a.tar.gz
classes/package: handle filenames containing wildcards
It is uncommon, but it is possible for upstream sources to contain files that have wildcard characters in their names (Webmin is an example). Because we were running glob.glob() on every entry in the list of entries in FILES and then adding the result to the files list to be processed, the process would loop infinitely if files whose names contained wildcard characters were present. Fix this by avoiding re-processing the output of glob.glob() with itself, and also "escape" wildcard characters in FILES entries added automatically from do_split_packages(). Fixes [YOCTO #1676]. (From OE-Core rev: 1aa3fbb547b0e21455f0dcc9b72ded08dc0efd67) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass28
1 files changed, 19 insertions, 9 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 5b1e902c07..b0f44c7faf 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -183,8 +183,13 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
183 else: 183 else:
184 packages.append(pkg) 184 packages.append(pkg)
185 oldfiles = d.getVar('FILES_' + pkg, True) 185 oldfiles = d.getVar('FILES_' + pkg, True)
186 newfile = os.path.join(root, o)
187 # These names will be passed through glob() so if the filename actually
188 # contains * or ? (rare, but possible) we need to handle that specially
189 newfile = newfile.replace('*', '[*]')
190 newfile = newfile.replace('?', '[?]')
186 if not oldfiles: 191 if not oldfiles:
187 the_files = [os.path.join(root, o)] 192 the_files = [newfile]
188 if aux_files_pattern: 193 if aux_files_pattern:
189 if type(aux_files_pattern) is list: 194 if type(aux_files_pattern) is list:
190 for fp in aux_files_pattern: 195 for fp in aux_files_pattern:
@@ -206,7 +211,7 @@ def do_split_packages(d, root, file_regex, output_pattern, description, postinst
206 if postrm: 211 if postrm:
207 d.setVar('pkg_postrm_' + pkg, postrm) 212 d.setVar('pkg_postrm_' + pkg, postrm)
208 else: 213 else:
209 d.setVar('FILES_' + pkg, oldfiles + " " + os.path.join(root, o)) 214 d.setVar('FILES_' + pkg, oldfiles + " " + newfile)
210 if callable(hook): 215 if callable(hook):
211 hook(f, pkg, file_regex, output_pattern, m.group(1)) 216 hook(f, pkg, file_regex, output_pattern, m.group(1))
212 217
@@ -965,23 +970,28 @@ python populate_packages () {
965 msg = "FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg 970 msg = "FILES variable for package %s contains '//' which is invalid. Attempting to fix this but you should correct the metadata.\n" % pkg
966 package_qa_handle_error("files-invalid", msg, d) 971 package_qa_handle_error("files-invalid", msg, d)
967 filesvar.replace("//", "/") 972 filesvar.replace("//", "/")
968 files = filesvar.split() 973
969 for file in files: 974 origfiles = filesvar.split()
975 files = []
976 for file in origfiles:
970 if os.path.isabs(file): 977 if os.path.isabs(file):
971 file = '.' + file 978 file = '.' + file
972 if not file.startswith("./"): 979 if not file.startswith("./"):
973 file = './' + file 980 file = './' + file
981 globbed = glob.glob(file)
982 if globbed:
983 if [ file ] != globbed:
984 files += globbed
985 continue
986 files.append(file)
987
988 for file in files:
974 if not cpath.islink(file): 989 if not cpath.islink(file):
975 if cpath.isdir(file): 990 if cpath.isdir(file):
976 newfiles = [ os.path.join(file,x) for x in os.listdir(file) ] 991 newfiles = [ os.path.join(file,x) for x in os.listdir(file) ]
977 if newfiles: 992 if newfiles:
978 files += newfiles 993 files += newfiles
979 continue 994 continue
980 globbed = glob.glob(file)
981 if globbed:
982 if [ file ] != globbed:
983 files += globbed
984 continue
985 if (not cpath.islink(file)) and (not cpath.exists(file)): 995 if (not cpath.islink(file)) and (not cpath.exists(file)):
986 continue 996 continue
987 if file in seen: 997 if file in seen: