summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/package.bbclass30
1 files changed, 26 insertions, 4 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 81acc10367..5cb1939e54 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -259,14 +259,27 @@ def files_from_filevars(filevars):
259 continue 259 continue
260 files.append(f) 260 files.append(f)
261 261
262 for f in files: 262 symlink_paths = []
263 for ind, f in enumerate(files):
264 # Handle directory symlinks. Truncate path to the lowest level symlink
265 parent = ''
266 for dirname in f.split('/')[:-1]:
267 parent = os.path.join(parent, dirname)
268 if dirname == '.':
269 continue
270 if cpath.islink(parent):
271 symlink_paths.append(f)
272 files[ind] = parent
273 f = parent
274 break
275
263 if not cpath.islink(f): 276 if not cpath.islink(f):
264 if cpath.isdir(f): 277 if cpath.isdir(f):
265 newfiles = [ os.path.join(f,x) for x in os.listdir(f) ] 278 newfiles = [ os.path.join(f,x) for x in os.listdir(f) ]
266 if newfiles: 279 if newfiles:
267 files += newfiles 280 files += newfiles
268 281
269 return files 282 return files, symlink_paths
270 283
271# Called in package_<rpm,ipk,deb>.bbclass to get the correct list of configuration files 284# Called in package_<rpm,ipk,deb>.bbclass to get the correct list of configuration files
272def get_conffiles(pkg, d): 285def get_conffiles(pkg, d):
@@ -281,7 +294,7 @@ def get_conffiles(pkg, d):
281 if conffiles == None: 294 if conffiles == None:
282 conffiles = "" 295 conffiles = ""
283 conffiles = conffiles.split() 296 conffiles = conffiles.split()
284 conf_orig_list = files_from_filevars(conffiles) 297 conf_orig_list = files_from_filevars(conffiles)[0]
285 298
286 # Remove links and directories from conf_orig_list to get conf_list which only contains normal files 299 # Remove links and directories from conf_orig_list to get conf_list which only contains normal files
287 conf_list = [] 300 conf_list = []
@@ -1111,7 +1124,7 @@ python populate_packages () {
1111 filesvar.replace("//", "/") 1124 filesvar.replace("//", "/")
1112 1125
1113 origfiles = filesvar.split() 1126 origfiles = filesvar.split()
1114 files = files_from_filevars(origfiles) 1127 files, symlink_paths = files_from_filevars(origfiles)
1115 1128
1116 if autodebug and pkg.endswith("-dbg"): 1129 if autodebug and pkg.endswith("-dbg"):
1117 files.extend(debug) 1130 files.extend(debug)
@@ -1157,6 +1170,15 @@ python populate_packages () {
1157 if ret is False or ret == 0: 1170 if ret is False or ret == 0:
1158 raise bb.build.FuncFailed("File population failed") 1171 raise bb.build.FuncFailed("File population failed")
1159 1172
1173 # Check if symlink paths exist
1174 for file in symlink_paths:
1175 if not os.path.exists(os.path.join(root,file)):
1176 bb.fatal("File '%s' cannot be packaged into '%s' because its "
1177 "parent directory structure does not exist. One of "
1178 "its parent directories is a symlink whose target "
1179 "directory is not included in the package." %
1180 (file, pkg))
1181
1160 os.umask(oldumask) 1182 os.umask(oldumask)
1161 os.chdir(workdir) 1183 os.chdir(workdir)
1162 1184