[oe] [PATCH 2/2] oe-checksums-sorter.py: speed up about 4X using a hash

Michael Smith msmith at cbnco.com
Sat Jun 27 21:29:39 UTC 2009


OK, this saves a grand total of one second a few times a week, but it
was bugging me...

Signed-off-by: Michael Smith <msmith at cbnco.com>
---
 contrib/source-checker/oe-checksums-sorter.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/contrib/source-checker/oe-checksums-sorter.py b/contrib/source-checker/oe-checksums-sorter.py
index 7388c62..821d247 100755
--- a/contrib/source-checker/oe-checksums-sorter.py
+++ b/contrib/source-checker/oe-checksums-sorter.py
@@ -85,14 +85,17 @@ item = 1;
 files_total   = len(checksums_parser.sections())
 
 new_list = []
+seen = {}
 
 for source in checksums_parser.sections():
     archive = source.split("/")[-1]
     md5 = checksums_parser.get(source, "md5")
     sha = checksums_parser.get(source, "sha256")
 
-    if new_list.count([archive, source, md5, sha]) < 1:
-        new_list += [[archive, source, md5, sha]]
+    tup = (archive, source, md5, sha)
+    if not seen.has_key(tup):
+        new_list.append(tup)
+        seen[tup] = 1
 
 new_list.sort()
 
-- 
1.6.3





More information about the Openembedded-devel mailing list