Create dumps for a library with multiple tags

create_reference_dumps.py loads tags and paths from lsdump_paths.txt.
It used to create a dump for each (lib, arch) tuple. Now a dump may
have multiple tags. The script creates a dump for each
(lib, arch, tag).

Test: ./create_reference_dumps.py -products aosp_x86_64 \
      -release next
Bug: 314010764
Change-Id: I105b53bf4519e37493b94d0d938df398f259354f
diff --git a/vndk/tools/header-checker/utils/utils.py b/vndk/tools/header-checker/utils/utils.py
index 5220370..1c6108e 100644
--- a/vndk/tools/header-checker/utils/utils.py
+++ b/vndk/tools/header-checker/utils/utils.py
@@ -227,7 +227,8 @@
     """
     lsdump_paths = collections.defaultdict(
         lambda: collections.defaultdict(dict))
-    suffixes = collections.defaultdict(dict)
+    suffixes = collections.defaultdict(
+        lambda: collections.defaultdict(dict))
 
     with open(lsdump_paths_file_path, 'r') as lsdump_paths_file:
         for line in lsdump_paths_file:
@@ -258,12 +259,12 @@
                 if not variant:
                     continue
                 new_suffix = variant[len(prefix):]
-                old_suffix = suffixes[libname].get(arch_cpu)
+                old_suffix = suffixes[libname][arch_cpu].get(tag)
                 if (not old_suffix or
                         _get_module_variant_sort_key(new_suffix) >
                         _get_module_variant_sort_key(old_suffix)):
                     lsdump_paths[libname][arch_cpu][tag] = path
-                    suffixes[libname][arch_cpu] = new_suffix
+                    suffixes[libname][arch_cpu][tag] = new_suffix
     return lsdump_paths