summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-05-09 12:38:39 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-27 22:36:43 +0100
commit00a859afd03671b8338b12c4d2cbb788f530eb41 (patch)
treec9236ad71ac8d764614ead1a92756125f19b4b41 /meta/classes
parent5686f4e1fe5229705b8c7d35895aa03827796d13 (diff)
downloadpoky-00a859afd03671b8338b12c4d2cbb788f530eb41.tar.gz
classes/buildhistory: fix failures collecting output signatures
It's possible for tasks to stage symlinks that point to non-existent files; an example is ncurses-native.do_populate_sysroot. There wasn't any error checking here so this broke the build when "task" was included in BUILDHISTORY_FEATURES. In any case we shouldn't be following symlinks and getting the sha256sum of the link target - we need concern ourselves only with the target path, so check if the file is a link and sha256 the target path instead if it is. If it's neither a regular file nor a symlink (perhaps a pipe or a device), just skip it. (From OE-Core rev: f60520d97f53dafe783f61eb58fe249798a1e1be) (From OE-Core rev: 66a0d184d8f55a8da03de9fedb18d166b80b198b) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/buildhistory.bbclass14
1 files changed, 13 insertions, 1 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index f543bb73d6..8eafdc9f72 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -301,6 +301,8 @@ python buildhistory_emit_outputsigs() {
301 if not "task" in (d.getVar('BUILDHISTORY_FEATURES') or "").split(): 301 if not "task" in (d.getVar('BUILDHISTORY_FEATURES') or "").split():
302 return 302 return
303 303
304 import hashlib
305
304 taskoutdir = os.path.join(d.getVar('BUILDHISTORY_DIR'), 'task', 'output') 306 taskoutdir = os.path.join(d.getVar('BUILDHISTORY_DIR'), 'task', 'output')
305 bb.utils.mkdirhier(taskoutdir) 307 bb.utils.mkdirhier(taskoutdir)
306 currenttask = d.getVar('BB_CURRENTTASK') 308 currenttask = d.getVar('BB_CURRENTTASK')
@@ -314,7 +316,17 @@ python buildhistory_emit_outputsigs() {
314 if fname == 'fixmepath': 316 if fname == 'fixmepath':
315 continue 317 continue
316 fullpath = os.path.join(root, fname) 318 fullpath = os.path.join(root, fname)
317 filesigs[os.path.relpath(fullpath, cwd)] = bb.utils.sha256_file(fullpath) 319 try:
320 if os.path.islink(fullpath):
321 sha256 = hashlib.sha256(os.readlink(fullpath).encode('utf-8')).hexdigest()
322 elif os.path.isfile(fullpath):
323 sha256 = bb.utils.sha256_file(fullpath)
324 else:
325 continue
326 except OSError:
327 bb.warn('buildhistory: unable to read %s to get output signature' % fullpath)
328 continue
329 filesigs[os.path.relpath(fullpath, cwd)] = sha256
318 with open(taskfile, 'w') as f: 330 with open(taskfile, 'w') as f:
319 for fpath, fsig in sorted(filesigs.items(), key=lambda item: item[0]): 331 for fpath, fsig in sorted(filesigs.items(), key=lambda item: item[0]):
320 f.write('%s %s\n' % (fpath, fsig)) 332 f.write('%s %s\n' % (fpath, fsig))