summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2015-10-20 12:43:34 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-28 15:55:50 +0100
commit37683ef86e48f30074394de86ed5a080e9e5d74f (patch)
tree204cb77f4d01cf753e9b8ef3278d1361a3a15410 /meta/lib/oeqa/utils
parent3a934a8087c7a7541cf8ef35041d31f7765bb18d (diff)
downloadpoky-37683ef86e48f30074394de86ed5a080e9e5d74f.tar.gz
oeqa/utils/ftools: improve remove_from_file algorithm
The algorithm was sub-optimal so replace it with something more elegant. (From OE-Core rev: 6119a90173f9222efa6df25aacf873af85d64bcd) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r--meta/lib/oeqa/utils/ftools.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/meta/lib/oeqa/utils/ftools.py b/meta/lib/oeqa/utils/ftools.py
index 1bd9a30a40..a7233d4ca6 100644
--- a/meta/lib/oeqa/utils/ftools.py
+++ b/meta/lib/oeqa/utils/ftools.py
@@ -36,10 +36,11 @@ def remove_from_file(path, data):
36 return 36 return
37 else: 37 else:
38 raise 38 raise
39 lines = rdata.splitlines() 39
40 rmdata = data.strip().splitlines() 40 contents = rdata.strip().splitlines()
41 for l in rmdata: 41 for r in data.strip().splitlines():
42 for c in range(0, lines.count(l)): 42 try:
43 i = lines.index(l) 43 contents.remove(r)
44 del(lines[i]) 44 except ValueError:
45 write_file(path, "\n".join(lines)) 45 pass
46 write_file(path, "\n".join(contents))