From 90284b6fe0e5ba89fe63943212bfd7ffc3e96d47 Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Mon, 9 Jan 2017 21:48:43 +0100 Subject: nwztools: fix typo (nwz-zx100 -> nw-zx100) Also now gen_db.py can check for such mismatch Change-Id: I4d91aae0dde08c866eda2ed5da3c11431c46e06a --- utils/nwztools/database/gen_db.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'utils/nwztools/database/gen_db.py') diff --git a/utils/nwztools/database/gen_db.py b/utils/nwztools/database/gen_db.py index cf1423f2a5..8b7d1cbaaf 100755 --- a/utils/nwztools/database/gen_db.py +++ b/utils/nwztools/database/gen_db.py @@ -13,6 +13,7 @@ with open('models.txt') as fp: g_models.append({'mid': int(mid, 0), 'name': name}) # parse series.txt g_series = [] +g_series_codename = set() with open('series.txt') as fp: for line in fp: # we unpack and repack 1) to make the format obvious 2) to catch errors @@ -25,6 +26,7 @@ with open('series.txt') as fp: models = [] models = [int(mid,0) for mid in models] g_series.append({'codename': codename, 'name': name, 'models': models}) + g_series_codename.add(codename) # parse all maps in nvp/ # since most nvps are the same, what we actually do is to compute the md5sum hash # of all files, to identify groups and then each entry in the name is in fact the @@ -38,6 +40,9 @@ for line in subprocess.run(["md5sum"] + map_files, stdout = subprocess.PIPE).std continue hash, file = line.rstrip().split() codename = re.search('nvp/(.*)\.txt', file).group(1) + # sanity check + if not (codename in g_series_codename): + print("Warning: file %s does not have a match series in series.txt" % file) hash = hash[:HASH_SIZE] # only keep one file if not (hash in g_hash_nvp): -- cgit v1.2.3