summaryrefslogtreecommitdiffstats
path: root/scripts/contrib/convert-variable-renames.py
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2022-02-21 23:21:38 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-22 08:23:50 +0000
commitccbc29bbc4a7d8a4ce2fd708be26b436d7be4194 (patch)
treebfcaae21ad36a42f36228c6ab04f37ecda7fbd19 /scripts/contrib/convert-variable-renames.py
parentcc07ffe8f7734008cb56a73549fce2ef1d4aa033 (diff)
downloadpoky-ccbc29bbc4a7d8a4ce2fd708be26b436d7be4194.tar.gz
scripts: fix file writing in convert-variable-renames
In my test environments (Fedora 35 and Debian 10.10 on AMD 2970WX), running the convert-variable-renames.py rename script was resulting in empty files instead of updated ones. From inspection, the new files are never flushed/closed before moving them into place, which seems inherently racy. Adding an explicit close to flush the modified contents out before moving into place fixes the issue for me. (From OE-Core rev: 187ac1ea0a701a5ba9ec92f6aa32f2a67600a584) Signed-off-by: Scott Murray <scott.murray@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/contrib/convert-variable-renames.py')
-rwxr-xr-xscripts/contrib/convert-variable-renames.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/contrib/convert-variable-renames.py b/scripts/contrib/convert-variable-renames.py
index fca59ca9e1..ed012610db 100755
--- a/scripts/contrib/convert-variable-renames.py
+++ b/scripts/contrib/convert-variable-renames.py
@@ -84,6 +84,7 @@ def processfile(fn):
84 if re.search(check_word, line, re.IGNORECASE): 84 if re.search(check_word, line, re.IGNORECASE):
85 print("%s needs further work at line %s since it contains %s"% (fn, lineno, check_word)) 85 print("%s needs further work at line %s since it contains %s"% (fn, lineno, check_word))
86 new_file.write(line) 86 new_file.write(line)
87 new_file.close()
87 if modified: 88 if modified:
88 print("*** Modified file '%s'" % (fn)) 89 print("*** Modified file '%s'" % (fn))
89 shutil.copymode(fn, abs_path) 90 shutil.copymode(fn, abs_path)