summaryrefslogtreecommitdiffstats
path: root/meta/classes/package.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/package.bbclass')
-rw-r--r--meta/classes/package.bbclass79
1 files changed, 61 insertions, 18 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index f6c92cb620..9f64ed77e5 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -239,6 +239,66 @@ python () {
239 d.appendVarFlag('do_package', 'deptask', " do_packagedata") 239 d.appendVarFlag('do_package', 'deptask', " do_packagedata")
240} 240}
241 241
242# Get a list of files from file vars by searching files under current working directory
243# The list contains symlinks, directories and normal files.
244def files_from_filevars(filevars):
245 import os,glob
246 cpath = oe.cachedpath.CachedPath()
247 files = []
248 for f in filevars:
249 if os.path.isabs(f):
250 f = '.' + f
251 if not f.startswith("./"):
252 f = './' + f
253 globbed = glob.glob(f)
254 if globbed:
255 if [ f ] != globbed:
256 files += globbed
257 continue
258 files.append(f)
259
260 for f in files:
261 if not cpath.islink(f):
262 if cpath.isdir(f):
263 newfiles = [ os.path.join(f,x) for x in os.listdir(f) ]
264 if newfiles:
265 files += newfiles
266
267 return files
268
269# Called in package_<rpm,ipk,deb>.bbclass to get the correct list of configuration files
270def get_conffiles(pkg, d):
271 pkgdest = d.getVar('PKGDEST', True)
272 root = os.path.join(pkgdest, pkg)
273 cwd = os.getcwd()
274 os.chdir(root)
275
276 conffiles = d.getVar('CONFFILES_%s' % pkg, True);
277 if conffiles == None:
278 conffiles = d.getVar('CONFFILES', True)
279 if conffiles == None:
280 conffiles = ""
281 conffiles = conffiles.split()
282 conf_orig_list = files_from_filevars(conffiles)
283
284 # Remove links and directories from conf_orig_list to get conf_list which only contains normal files
285 conf_list = []
286 for f in conf_orig_list:
287 if os.path.isdir(f):
288 continue
289 if os.path.islink(f):
290 continue
291 if not os.path.exists(f):
292 continue
293 conf_list.append(f)
294
295 # Remove the leading './'
296 for i in range(0, len(conf_list)):
297 conf_list[i] = conf_list[i][1:]
298
299 os.chdir(cwd)
300 return conf_list
301
242def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d): 302def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d):
243 # Function to split a single file into two components, one is the stripped 303 # Function to split a single file into two components, one is the stripped
244 # target system binary, the other contains any debugging information. The 304 # target system binary, the other contains any debugging information. The
@@ -1009,26 +1069,9 @@ python populate_packages () {
1009 filesvar.replace("//", "/") 1069 filesvar.replace("//", "/")
1010 1070
1011 origfiles = filesvar.split() 1071 origfiles = filesvar.split()
1012 files = [] 1072 files = files_from_filevars(origfiles)
1013 for file in origfiles:
1014 if os.path.isabs(file):
1015 file = '.' + file
1016 if not file.startswith("./"):
1017 file = './' + file
1018 globbed = glob.glob(file)
1019 if globbed:
1020 if [ file ] != globbed:
1021 files += globbed
1022 continue
1023 files.append(file)
1024 1073
1025 for file in files: 1074 for file in files:
1026 if not cpath.islink(file):
1027 if cpath.isdir(file):
1028 newfiles = [ os.path.join(file,x) for x in os.listdir(file) ]
1029 if newfiles:
1030 files += newfiles
1031 continue
1032 if (not cpath.islink(file)) and (not cpath.exists(file)): 1075 if (not cpath.islink(file)) and (not cpath.exists(file)):
1033 continue 1076 continue
1034 if file in seen: 1077 if file in seen: