diff options
author | Michael Smith <msmith@cbnco.com> | 2009-06-27 17:23:33 -0400 |
---|---|---|
committer | Michael Smith <msmith@cbnco.com> | 2009-08-19 09:13:01 -0400 |
commit | 1eb3a77d18748635f38804b78390fc09993c4475 (patch) | |
tree | 3ccc1d6891dee6ff4fe113b42e6c4816392d4f12 /contrib | |
parent | 3555703d298735f509973b30e5aa40c19c1f6a2e (diff) |
oe-checksums-sorter.py: speed up about 4X using a hash
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@cbnco.com>
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/source-checker/oe-checksums-sorter.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/source-checker/oe-checksums-sorter.py b/contrib/source-checker/oe-checksums-sorter.py index cde6ddc73e..3707dba2d2 100755 --- a/contrib/source-checker/oe-checksums-sorter.py +++ b/contrib/source-checker/oe-checksums-sorter.py @@ -88,18 +88,18 @@ if inplace: checksums_parser = ConfigParser.ConfigParser() checksums_parser.readfp(infp) -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() |