From ee21e81cffa8b7bd976777a46ae51cb87599fed6 Mon Sep 17 00:00:00 2001 From: Leonardo Sandoval Date: Mon, 21 Aug 2017 17:39:46 +1200 Subject: devtool: append md5sum only if not already present In case the proposed md5sum to be appended to the .devtool_md5 file is already present, do not append it. (From OE-Core rev: f958c5cba3b0d24ca696b2b707857009c9a7b5b8) Signed-off-by: Leonardo Sandoval Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- scripts/lib/devtool/standard.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts/lib') diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index ec192238ed..fa9d347693 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -674,8 +674,11 @@ def _add_md5(config, recipename, filename): def addfile(fn): md5 = bb.utils.md5_file(fn) - with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a') as f: - f.write('%s|%s|%s\n' % (recipename, os.path.relpath(fn, config.workspace_path), md5)) + with open(os.path.join(config.workspace_path, '.devtool_md5'), 'a+') as f: + md5_str = '%s|%s|%s\n' % (recipename, os.path.relpath(fn, config.workspace_path), md5) + f.seek(0, os.SEEK_SET) + if not md5_str in f.read(): + f.write(md5_str) if os.path.isdir(filename): for root, _, files in os.walk(filename): -- cgit v1.2.3-54-g00ecf